| Conditions | 1 |
| Paths | 1 |
| Total Lines | 101 |
| Code Lines | 97 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 107 | public static function setUpProperties($properties, Schema1 $ownerSchema) |
||
| 108 | { |
||
| 109 | $properties->ref = Schema1::string(); |
||
| 110 | $ownerSchema->addPropertyMapping('$ref', self::names()->ref); |
||
|
|
|||
| 111 | $properties->format = Schema1::string(); |
||
| 112 | $properties->title = Schema1::string(); |
||
| 113 | $properties->description = Schema1::string(); |
||
| 114 | $properties->default = new Schema1(); |
||
| 115 | $properties->multipleOf = Schema1::number(); |
||
| 116 | $properties->multipleOf->minimum = 0; |
||
| 117 | $properties->multipleOf->exclusiveMinimum = true; |
||
| 118 | $properties->maximum = Schema1::number(); |
||
| 119 | $properties->exclusiveMaximum = Schema1::boolean(); |
||
| 120 | $properties->exclusiveMaximum->default = false; |
||
| 121 | $properties->minimum = Schema1::number(); |
||
| 122 | $properties->exclusiveMinimum = Schema1::boolean(); |
||
| 123 | $properties->exclusiveMinimum->default = false; |
||
| 124 | $properties->maxLength = Schema1::integer(); |
||
| 125 | $properties->maxLength->minimum = 0; |
||
| 126 | $properties->minLength = new Schema1(); |
||
| 127 | $properties->minLength->allOf[0] = Schema1::integer(); |
||
| 128 | $properties->minLength->allOf[0]->minimum = 0; |
||
| 129 | $properties->minLength->allOf[1] = new Schema1(); |
||
| 130 | $properties->minLength->allOf[1]->default = 0; |
||
| 131 | $properties->pattern = Schema1::string(); |
||
| 132 | $properties->pattern->format = 'regex'; |
||
| 133 | $properties->maxItems = Schema1::integer(); |
||
| 134 | $properties->maxItems->minimum = 0; |
||
| 135 | $properties->minItems = new Schema1(); |
||
| 136 | $properties->minItems->allOf[0] = Schema1::integer(); |
||
| 137 | $properties->minItems->allOf[0]->minimum = 0; |
||
| 138 | $properties->minItems->allOf[1] = new Schema1(); |
||
| 139 | $properties->minItems->allOf[1]->default = 0; |
||
| 140 | $properties->uniqueItems = Schema1::boolean(); |
||
| 141 | $properties->uniqueItems->default = false; |
||
| 142 | $properties->maxProperties = Schema1::integer(); |
||
| 143 | $properties->maxProperties->minimum = 0; |
||
| 144 | $properties->minProperties = new Schema1(); |
||
| 145 | $properties->minProperties->allOf[0] = Schema1::integer(); |
||
| 146 | $properties->minProperties->allOf[0]->minimum = 0; |
||
| 147 | $properties->minProperties->allOf[1] = new Schema1(); |
||
| 148 | $properties->minProperties->allOf[1]->default = 0; |
||
| 149 | $properties->required = Schema1::arr(); |
||
| 150 | $properties->required->items = Schema1::string(); |
||
| 151 | $properties->required->minItems = 1; |
||
| 152 | $properties->required->uniqueItems = true; |
||
| 153 | $properties->enum = Schema1::arr(); |
||
| 154 | $properties->enum->minItems = 1; |
||
| 155 | $properties->enum->uniqueItems = true; |
||
| 156 | $properties->additionalProperties = new Schema1(); |
||
| 157 | $properties->additionalProperties->anyOf[0] = Schema::schema(); |
||
| 158 | $properties->additionalProperties->anyOf[1] = Schema1::boolean(); |
||
| 159 | $properties->additionalProperties->default = new \stdClass(); |
||
| 160 | $properties->type = new Schema1(); |
||
| 161 | $properties->type->anyOf[0] = new Schema1(); |
||
| 162 | $properties->type->anyOf[0]->enum = array ( |
||
| 163 | 0 => 'array', |
||
| 164 | 1 => 'boolean', |
||
| 165 | 2 => 'integer', |
||
| 166 | 3 => 'null', |
||
| 167 | 4 => 'number', |
||
| 168 | 5 => 'object', |
||
| 169 | 6 => 'string', |
||
| 170 | ); |
||
| 171 | $properties->type->anyOf[1] = Schema1::arr(); |
||
| 172 | $properties->type->anyOf[1]->items = new Schema1(); |
||
| 173 | $properties->type->anyOf[1]->items->enum = array ( |
||
| 174 | 0 => 'array', |
||
| 175 | 1 => 'boolean', |
||
| 176 | 2 => 'integer', |
||
| 177 | 3 => 'null', |
||
| 178 | 4 => 'number', |
||
| 179 | 5 => 'object', |
||
| 180 | 6 => 'string', |
||
| 181 | ); |
||
| 182 | $properties->type->anyOf[1]->minItems = 1; |
||
| 183 | $properties->type->anyOf[1]->uniqueItems = true; |
||
| 184 | $properties->items = new Schema1(); |
||
| 185 | $properties->items->anyOf[0] = Schema::schema(); |
||
| 186 | $properties->items->anyOf[1] = Schema1::arr(); |
||
| 187 | $properties->items->anyOf[1]->items = Schema::schema(); |
||
| 188 | $properties->items->anyOf[1]->minItems = 1; |
||
| 189 | $properties->items->default = new \stdClass(); |
||
| 190 | $properties->allOf = Schema1::arr(); |
||
| 191 | $properties->allOf->items = Schema::schema(); |
||
| 192 | $properties->allOf->minItems = 1; |
||
| 193 | $properties->properties = Schema1::object(); |
||
| 194 | $properties->properties->additionalProperties = Schema::schema(); |
||
| 195 | $properties->properties->default = new \stdClass(); |
||
| 196 | $properties->discriminator = Schema1::string(); |
||
| 197 | $properties->readOnly = Schema1::boolean(); |
||
| 198 | $properties->readOnly->default = false; |
||
| 199 | $properties->xml = Xml::schema(); |
||
| 200 | $properties->externalDocs = ExternalDocs::schema(); |
||
| 201 | $properties->example = new Schema1(); |
||
| 202 | $ownerSchema->type = 'object'; |
||
| 203 | $ownerSchema->additionalProperties = false; |
||
| 204 | $ownerSchema->patternProperties['^x-'] = new Schema1(); |
||
| 205 | $ownerSchema->patternProperties['^x-']->description = 'Any property starting with x- is valid.'; |
||
| 206 | $ownerSchema->description = 'A deterministic version of a JSON Schema object.'; |
||
| 207 | } |
||
| 208 | } |
||
| 210 |
Since your code implements the magic getter
_get, this function will be called for any read access on an undefined variable. You can add the@propertyannotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.