| Total Complexity | 6 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | abstract class Testing extends Model |
||
| 18 | { |
||
| 19 | public $name; |
||
| 20 | public $method; |
||
| 21 | public $comment; |
||
| 22 | protected $_result; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @return \carono\exchange1c\ExchangeModule|Module |
||
| 26 | */ |
||
| 27 | public static function module() |
||
| 28 | { |
||
| 29 | return \Yii::$app->controller->module; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * @return array |
||
| 34 | */ |
||
| 35 | public static function findAll() |
||
| 36 | { |
||
| 37 | $reflection = new \ReflectionClass(static::class); |
||
| 38 | $methods = $reflection->getMethods(\ReflectionMethod::IS_STATIC); |
||
| 39 | $methods = ArrayHelper::map(array_filter($methods, function ($data) { |
||
| 40 | return StringHelper::startsWith($data->name, 'test'); |
||
| 41 | }), 'name', 'name'); |
||
| 42 | $data = []; |
||
| 43 | foreach ($methods as $method) { |
||
| 44 | if ($test = call_user_func(static::class . "::$method")) { |
||
| 45 | $data[] = $test; |
||
| 46 | } |
||
| 47 | } |
||
| 48 | return $data; |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @return bool |
||
| 53 | */ |
||
| 54 | public function testing() |
||
| 55 | { |
||
| 56 | return !$this->hasErrors(); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Testing constructor. |
||
| 61 | * |
||
| 62 | * @param array $config |
||
| 63 | */ |
||
| 64 | public function __construct(array $config = []) |
||
| 67 | } |
||
| 68 | } |