| @@ 49-85 (lines=37) @@ | ||
| 46 | * @param mixed $data |
|
| 47 | * @throws InvalidArgumentException |
|
| 48 | */ |
|
| 49 | protected function validateData($data) |
|
| 50 | { |
|
| 51 | if (!is_array($data)) { |
|
| 52 | throw new InvalidArgumentException( |
|
| 53 | 'data must be an array' |
|
| 54 | ); |
|
| 55 | } |
|
| 56 | ||
| 57 | if (empty($data)) { |
|
| 58 | throw new InvalidArgumentException( |
|
| 59 | 'data array must contain content' |
|
| 60 | ); |
|
| 61 | } |
|
| 62 | ||
| 63 | $mandatoryKeysToExpectedValueTyp = array( |
|
| 64 | 'class_name' => 'string', |
|
| 65 | 'file_path' => 'string' |
|
| 66 | ); |
|
| 67 | ||
| 68 | $this->validateDataWithMandatoryKeysAndExpectedValueType( |
|
| 69 | $data, |
|
| 70 | $mandatoryKeysToExpectedValueTyp |
|
| 71 | ); |
|
| 72 | ||
| 73 | $optionalKeysToExpectedValueTyp = array( |
|
| 74 | 'extends' => 'string', |
|
| 75 | 'instances' => 'array', |
|
| 76 | 'implements' => 'array', |
|
| 77 | 'namespace' => 'string', |
|
| 78 | 'uses' => 'array' |
|
| 79 | ); |
|
| 80 | ||
| 81 | $this->validateDataWithOptionalKeysAndExpectedValueTypeOrSetExpectedValueAsDefault( |
|
| 82 | $data, |
|
| 83 | $optionalKeysToExpectedValueTyp |
|
| 84 | ); |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * @param array $data |
|
| @@ 82-119 (lines=38) @@ | ||
| 79 | * @param mixed $data |
|
| 80 | * @throws InvalidArgumentException |
|
| 81 | */ |
|
| 82 | protected function validateData($data) |
|
| 83 | { |
|
| 84 | if (!is_array($data)) { |
|
| 85 | throw new InvalidArgumentException( |
|
| 86 | 'data must be an array' |
|
| 87 | ); |
|
| 88 | } |
|
| 89 | ||
| 90 | if (empty($data)) { |
|
| 91 | throw new InvalidArgumentException( |
|
| 92 | 'data array must contain content' |
|
| 93 | ); |
|
| 94 | } |
|
| 95 | ||
| 96 | $mandatoryKeysToExpectedValueTyp = array( |
|
| 97 | 'class_name' => 'string', |
|
| 98 | 'file_path' => 'string' |
|
| 99 | ); |
|
| 100 | ||
| 101 | $this->validateDataWithMandatoryKeysAndExpectedValueType( |
|
| 102 | $data, |
|
| 103 | $mandatoryKeysToExpectedValueTyp |
|
| 104 | ); |
|
| 105 | ||
| 106 | $optionalKeysToExpectedValueTyp = array( |
|
| 107 | 'extends' => 'string', |
|
| 108 | 'implements' => 'array', |
|
| 109 | 'method_name_without_namespace' => 'boolean', |
|
| 110 | 'namespace' => 'string', |
|
| 111 | 'path_to_schema_xml' => 'string', |
|
| 112 | 'uses' => 'array' |
|
| 113 | ); |
|
| 114 | ||
| 115 | $this->validateDataWithOptionalKeysAndExpectedValueTypeOrSetExpectedValueAsDefault( |
|
| 116 | $data, |
|
| 117 | $optionalKeysToExpectedValueTyp |
|
| 118 | ); |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param string $pathToSchemaXml |
|