summaryrefslogtreecommitdiff
path: root/scripts/dev/generate-phpt/src/setup/gtPreConditionList.php
blob: 286699cfb800266ecf67df4f561e9eb48a133ec1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php

/**
 * List of preconditions.
 *
 */
class gtPreConditionList {

  private $preConditions = array(
      'gtIsSpecifiedTestType',
      'gtIsSpecifiedFunctionOrMethod',
      'gtIfClassHasMethod',
      'gtIsValidClass',
      'gtIsValidFunction',
      'gtIsValidMethod',
  );


  /**
   * Create an instance of each pre-condition and run their check methods
   *
   */
  public function check($clo) {
    foreach ($this->preConditions as $preCon) {
      $checkThis = new $preCon;
      if(!$checkThis->check($clo)) {
        echo $checkThis->getMessage();
        die(gtText::get('help'));
      }
    }
  }
}
?>