@@ -57,7 +57,7 @@ |
||
| 57 | 57 | |
| 58 | 58 | private function elementsToDotLanguage(): string |
| 59 | 59 | { |
| 60 | - $dotFormat = array_map(function (plHasDotRepresentation $element) { |
|
| 60 | + $dotFormat = array_map(function(plHasDotRepresentation $element) { |
|
| 61 | 61 | return $element->toDotLanguage(); |
| 62 | 62 | }, $this->dotElements); |
| 63 | 63 | |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public function __construct() |
| 9 | 9 | { |
| 10 | - $this->options = new plProcessorOptions(); |
|
| 10 | + $this->options = new plProcessorOptions(); |
|
| 11 | 11 | $this->information = array(); |
| 12 | 12 | } |
| 13 | 13 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | return 'text/plain'; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - public function process( $input, $type ) |
|
| 26 | + public function process($input, $type) |
|
| 27 | 27 | { |
| 28 | 28 | // Initialize the values |
| 29 | 29 | $this->information['interfaceCount'] = 0; |
@@ -39,38 +39,38 @@ discard block |
||
| 39 | 39 | $this->information['privateTypedAttributes'] = 0; |
| 40 | 40 | |
| 41 | 41 | // Loop through the classes and interfaces |
| 42 | - foreach ( $input as $definition ) |
|
| 42 | + foreach ($input as $definition) |
|
| 43 | 43 | { |
| 44 | - if ( $definition instanceof plPhpInterface ) |
|
| 44 | + if ($definition instanceof plPhpInterface) |
|
| 45 | 45 | { |
| 46 | 46 | $this->information['interfaceCount']++; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if ( $definition instanceof plPhpClass ) |
|
| 49 | + if ($definition instanceof plPhpClass) |
|
| 50 | 50 | { |
| 51 | 51 | $this->information['classCount']++; |
| 52 | 52 | |
| 53 | - foreach( $definition->attributes as $attribute ) |
|
| 53 | + foreach ($definition->attributes as $attribute) |
|
| 54 | 54 | { |
| 55 | - switch ( $attribute->modifier ) |
|
| 55 | + switch ($attribute->modifier) |
|
| 56 | 56 | { |
| 57 | 57 | case 'public': |
| 58 | 58 | $this->information['publicAttributeCount']++; |
| 59 | - if ( $attribute->type->isPresent() ) |
|
| 59 | + if ($attribute->type->isPresent()) |
|
| 60 | 60 | { |
| 61 | 61 | $this->information['publicTypedAttributes']++; |
| 62 | 62 | } |
| 63 | 63 | break; |
| 64 | 64 | case 'protected': |
| 65 | 65 | $this->information['protectedAttributeCount']++; |
| 66 | - if ( $attribute->type->isPresent() ) |
|
| 66 | + if ($attribute->type->isPresent()) |
|
| 67 | 67 | { |
| 68 | 68 | $this->information['protectedTypedAttributes']++; |
| 69 | 69 | } |
| 70 | 70 | break; |
| 71 | 71 | case 'private': |
| 72 | 72 | $this->information['privateAttributeCount']++; |
| 73 | - if ( $attribute->type->isPresent() ) |
|
| 73 | + if ($attribute->type->isPresent()) |
|
| 74 | 74 | { |
| 75 | 75 | $this->information['privateTypedAttributes']++; |
| 76 | 76 | } |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | } |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - foreach( $definition->functions as $function ) |
|
| 82 | + foreach ($definition->functions as $function) |
|
| 83 | 83 | { |
| 84 | - switch ( $function->modifier ) |
|
| 84 | + switch ($function->modifier) |
|
| 85 | 85 | { |
| 86 | 86 | case 'public': |
| 87 | 87 | $this->information['publicFunctionCount']++; |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | $this->information['functionCount'] = $this->information['publicFunctionCount'] + $this->information['protectedFunctionCount'] + $this->information['privateFunctionCount']; |
| 100 | 100 | $this->information['attributeCount'] = $this->information['publicAttributeCount'] + $this->information['protectedAttributeCount'] + $this->information['privateAttributeCount']; |
| 101 | 101 | $this->information['typedAttributeCount'] = $this->information['publicTypedAttributes'] + $this->information['protectedTypedAttributes'] + $this->information['privateTypedAttributes']; |
| 102 | - $this->information['attributesPerClass'] = round( $this->information['attributeCount'] / $this->information['classCount'], 2 ); |
|
| 103 | - $this->information['functionsPerClass'] = round( $this->information['functionCount'] / $this->information['classCount'], 2 ); |
|
| 102 | + $this->information['attributesPerClass'] = round($this->information['attributeCount'] / $this->information['classCount'], 2); |
|
| 103 | + $this->information['functionsPerClass'] = round($this->information['functionCount'] / $this->information['classCount'], 2); |
|
| 104 | 104 | |
| 105 | 105 | // Generate the needed text output |
| 106 | 106 | return <<<END |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct(plDigraph $digraph = null) |
| 14 | 14 | { |
| 15 | 15 | $this->options = new plGraphvizProcessorOptions(); |
| 16 | - $labelBuilder = new plNodeLabelBuilder(new TemplateEngine( |
|
| 16 | + $labelBuilder = new plNodeLabelBuilder(new TemplateEngine( |
|
| 17 | 17 | new FileSystem(__DIR__ . '/../processor/graphviz/digraph/templates') |
| 18 | 18 | ), new plGraphvizProcessorDefaultStyle()); |
| 19 | 19 | $classElements = new plClassGraphElements($this->options->createAssociations, $labelBuilder); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | public function hasConstructor(): bool |
| 38 | 38 | { |
| 39 | - return count(array_filter($this->functions, function (plPhpFunction $function) { |
|
| 39 | + return count(array_filter($this->functions, function(plPhpFunction $function) { |
|
| 40 | 40 | return $function->isConstructor(); |
| 41 | 41 | })) === 1; |
| 42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | return []; |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | - $constructors = array_filter($this->functions, function (plPhpFunction $function) { |
|
| 51 | + $constructors = array_filter($this->functions, function(plPhpFunction $function) { |
|
| 52 | 52 | return $function->isConstructor(); |
| 53 | 53 | }); |
| 54 | 54 | |
@@ -39,22 +39,22 @@ discard block |
||
| 39 | 39 | $this->lastToken = array(); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - public function createStructure( array $files ) |
|
| 42 | + public function createStructure(array $files) |
|
| 43 | 43 | { |
| 44 | 44 | $this->initGlobalAttributes(); |
| 45 | 45 | |
| 46 | - foreach( $files as $file ) |
|
| 46 | + foreach ($files as $file) |
|
| 47 | 47 | { |
| 48 | 48 | $this->initParserAttributes(); |
| 49 | - $tokens = token_get_all( file_get_contents( $file ) ); |
|
| 49 | + $tokens = token_get_all(file_get_contents($file)); |
|
| 50 | 50 | |
| 51 | 51 | // Loop through all tokens |
| 52 | - foreach( $tokens as $token ) |
|
| 52 | + foreach ($tokens as $token) |
|
| 53 | 53 | { |
| 54 | 54 | // Split into Simple and complex token |
| 55 | - if ( is_array( $token ) !== true ) |
|
| 55 | + if (is_array($token) !== true) |
|
| 56 | 56 | { |
| 57 | - switch( $token ) |
|
| 57 | + switch ($token) |
|
| 58 | 58 | { |
| 59 | 59 | case ',': |
| 60 | 60 | $this->comma(); |
@@ -76,80 +76,80 @@ discard block |
||
| 76 | 76 | $this->lastToken = null; |
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | - else if ( is_array( $token ) === true ) |
|
| 79 | + else if (is_array($token) === true) |
|
| 80 | 80 | { |
| 81 | - switch ( $token[0] ) |
|
| 81 | + switch ($token[0]) |
|
| 82 | 82 | { |
| 83 | 83 | case T_WHITESPACE: |
| 84 | - $this->t_whitespace( $token ); |
|
| 84 | + $this->t_whitespace($token); |
|
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case T_FUNCTION: |
| 88 | - $this->t_function( $token ); |
|
| 88 | + $this->t_function($token); |
|
| 89 | 89 | break; |
| 90 | 90 | |
| 91 | 91 | case T_VAR: |
| 92 | - $this->t_var( $token ); |
|
| 92 | + $this->t_var($token); |
|
| 93 | 93 | break; |
| 94 | 94 | |
| 95 | 95 | case T_VARIABLE: |
| 96 | - $this->t_variable( $token ); |
|
| 96 | + $this->t_variable($token); |
|
| 97 | 97 | break; |
| 98 | 98 | |
| 99 | 99 | case T_ARRAY: |
| 100 | - $this->t_array( $token ); |
|
| 100 | + $this->t_array($token); |
|
| 101 | 101 | break; |
| 102 | 102 | |
| 103 | 103 | case T_CONSTANT_ENCAPSED_STRING: |
| 104 | - $this->t_constant_encapsed_string( $token ); |
|
| 104 | + $this->t_constant_encapsed_string($token); |
|
| 105 | 105 | break; |
| 106 | 106 | |
| 107 | 107 | case T_LNUMBER: |
| 108 | - $this->t_lnumber( $token ); |
|
| 108 | + $this->t_lnumber($token); |
|
| 109 | 109 | break; |
| 110 | 110 | |
| 111 | 111 | case T_DNUMBER: |
| 112 | - $this->t_dnumber( $token ); |
|
| 112 | + $this->t_dnumber($token); |
|
| 113 | 113 | break; |
| 114 | 114 | |
| 115 | 115 | case T_PAAMAYIM_NEKUDOTAYIM: |
| 116 | - $this->t_paamayim_neukudotayim( $token ); |
|
| 116 | + $this->t_paamayim_neukudotayim($token); |
|
| 117 | 117 | break; |
| 118 | 118 | |
| 119 | 119 | case T_STRING: |
| 120 | - $this->t_string( $token ); |
|
| 120 | + $this->t_string($token); |
|
| 121 | 121 | break; |
| 122 | 122 | |
| 123 | 123 | case T_INTERFACE: |
| 124 | - $this->t_interface( $token ); |
|
| 124 | + $this->t_interface($token); |
|
| 125 | 125 | break; |
| 126 | 126 | |
| 127 | 127 | case T_CLASS: |
| 128 | - $this->t_class( $token ); |
|
| 128 | + $this->t_class($token); |
|
| 129 | 129 | break; |
| 130 | 130 | |
| 131 | 131 | case T_IMPLEMENTS: |
| 132 | - $this->t_implements( $token ); |
|
| 132 | + $this->t_implements($token); |
|
| 133 | 133 | break; |
| 134 | 134 | |
| 135 | 135 | case T_EXTENDS: |
| 136 | - $this->t_extends( $token ); |
|
| 136 | + $this->t_extends($token); |
|
| 137 | 137 | break; |
| 138 | 138 | |
| 139 | 139 | case T_PUBLIC: |
| 140 | - $this->t_public( $token ); |
|
| 140 | + $this->t_public($token); |
|
| 141 | 141 | break; |
| 142 | 142 | |
| 143 | 143 | case T_PROTECTED: |
| 144 | - $this->t_protected( $token ); |
|
| 144 | + $this->t_protected($token); |
|
| 145 | 145 | break; |
| 146 | 146 | |
| 147 | 147 | case T_PRIVATE: |
| 148 | - $this->t_private( $token ); |
|
| 148 | + $this->t_private($token); |
|
| 149 | 149 | break; |
| 150 | 150 | |
| 151 | 151 | case T_DOC_COMMENT: |
| 152 | - $this->t_doc_comment( $token ); |
|
| 152 | + $this->t_doc_comment($token); |
|
| 153 | 153 | break; |
| 154 | 154 | |
| 155 | 155 | default: |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | $this->fixObjectConnections(); |
| 171 | 171 | |
| 172 | 172 | // Return the class and interface structure |
| 173 | - return array_merge( $this->classes, $this->interfaces ); |
|
| 173 | + return array_merge($this->classes, $this->interfaces); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | private function comma() |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | private function closing_bracket() |
| 188 | 188 | { |
| 189 | - switch ( $this->lastToken ) |
|
| 189 | + switch ($this->lastToken) |
|
| 190 | 190 | { |
| 191 | 191 | case T_FUNCTION: |
| 192 | 192 | // The function declaration has been closed |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | private function equal_sign() |
| 219 | 219 | { |
| 220 | - switch ( $this->lastToken ) |
|
| 220 | + switch ($this->lastToken) |
|
| 221 | 221 | { |
| 222 | 222 | case T_FUNCTION: |
| 223 | 223 | // just ignore the equal sign |
@@ -227,14 +227,14 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | - private function t_whitespace( $token ) |
|
| 230 | + private function t_whitespace($token) |
|
| 231 | 231 | { |
| 232 | 232 | // Ignore whitespaces |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | - private function t_function( $token ) |
|
| 235 | + private function t_function($token) |
|
| 236 | 236 | { |
| 237 | - switch( $this->lastToken ) |
|
| 237 | + switch ($this->lastToken) |
|
| 238 | 238 | { |
| 239 | 239 | case null: |
| 240 | 240 | case T_PUBLIC: |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | } |
| 248 | 248 | } |
| 249 | 249 | |
| 250 | - private function t_var( $token ) |
|
| 250 | + private function t_var($token) |
|
| 251 | 251 | { |
| 252 | - switch ( $this->lastToken ) |
|
| 252 | + switch ($this->lastToken) |
|
| 253 | 253 | { |
| 254 | 254 | case T_FUNCTION: |
| 255 | 255 | // just ignore the T_VAR |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
| 262 | - private function t_variable( $token ) |
|
| 262 | + private function t_variable($token) |
|
| 263 | 263 | { |
| 264 | - switch( $this->lastToken ) |
|
| 264 | + switch ($this->lastToken) |
|
| 265 | 265 | { |
| 266 | 266 | case T_PUBLIC: |
| 267 | 267 | case T_PROTECTED: |
@@ -286,9 +286,9 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - private function t_array( $token ) |
|
| 289 | + private function t_array($token) |
|
| 290 | 290 | { |
| 291 | - switch ( $this->lastToken ) |
|
| 291 | + switch ($this->lastToken) |
|
| 292 | 292 | { |
| 293 | 293 | case T_FUNCTION: |
| 294 | 294 | // just ignore the T_ARRAY |
@@ -298,9 +298,9 @@ discard block |
||
| 298 | 298 | } |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - private function t_constant_encapsed_string( $token ) |
|
| 301 | + private function t_constant_encapsed_string($token) |
|
| 302 | 302 | { |
| 303 | - switch ( $this->lastToken ) |
|
| 303 | + switch ($this->lastToken) |
|
| 304 | 304 | { |
| 305 | 305 | case T_FUNCTION: |
| 306 | 306 | // just ignore the T_CONSTANT_ENCAPSED_STRING |
@@ -310,9 +310,9 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - private function t_lnumber( $token ) |
|
| 313 | + private function t_lnumber($token) |
|
| 314 | 314 | { |
| 315 | - switch ( $this->lastToken ) |
|
| 315 | + switch ($this->lastToken) |
|
| 316 | 316 | { |
| 317 | 317 | case T_FUNCTION: |
| 318 | 318 | // just ignore the T_LNUMBER |
@@ -322,9 +322,9 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - private function t_dnumber( $token ) |
|
| 325 | + private function t_dnumber($token) |
|
| 326 | 326 | { |
| 327 | - switch ( $this->lastToken ) |
|
| 327 | + switch ($this->lastToken) |
|
| 328 | 328 | { |
| 329 | 329 | case T_FUNCTION: |
| 330 | 330 | // just ignore the T_DNUMBER |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - private function t_paamayim_neukudotayim( $token ) |
|
| 337 | + private function t_paamayim_neukudotayim($token) |
|
| 338 | 338 | { |
| 339 | - switch ( $this->lastToken ) |
|
| 339 | + switch ($this->lastToken) |
|
| 340 | 340 | { |
| 341 | 341 | case T_FUNCTION: |
| 342 | 342 | // just ignore the T_PAAMAYIM_NEKUDOTAYIM |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | - private function t_string( $token ) |
|
| 349 | + private function t_string($token) |
|
| 350 | 350 | { |
| 351 | - switch( $this->lastToken ) |
|
| 351 | + switch ($this->lastToken) |
|
| 352 | 352 | { |
| 353 | 353 | case T_IMPLEMENTS: |
| 354 | 354 | // Add interface to implements array |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | case T_FUNCTION: |
| 366 | 366 | // Add the current function only if there is no function name already |
| 367 | 367 | // Because if we know the function name already this is a type hint |
| 368 | - if ( $this->parserStruct['function'] === null ) |
|
| 368 | + if ($this->parserStruct['function'] === null) |
|
| 369 | 369 | { |
| 370 | 370 | // Function name |
| 371 | 371 | $this->parserStruct['function'] = $token[1]; |
@@ -393,9 +393,9 @@ discard block |
||
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
| 396 | - private function t_interface( $token ) |
|
| 396 | + private function t_interface($token) |
|
| 397 | 397 | { |
| 398 | - switch( $this->lastToken ) |
|
| 398 | + switch ($this->lastToken) |
|
| 399 | 399 | { |
| 400 | 400 | case null: |
| 401 | 401 | // New initial interface token |
@@ -412,9 +412,9 @@ discard block |
||
| 412 | 412 | } |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - private function t_class( $token ) |
|
| 415 | + private function t_class($token) |
|
| 416 | 416 | { |
| 417 | - switch( $this->lastToken ) |
|
| 417 | + switch ($this->lastToken) |
|
| 418 | 418 | { |
| 419 | 419 | case null: |
| 420 | 420 | // New initial interface token |
@@ -431,9 +431,9 @@ discard block |
||
| 431 | 431 | } |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | - private function t_implements( $token ) |
|
| 434 | + private function t_implements($token) |
|
| 435 | 435 | { |
| 436 | - switch ( $this->lastToken ) |
|
| 436 | + switch ($this->lastToken) |
|
| 437 | 437 | { |
| 438 | 438 | case null: |
| 439 | 439 | $this->lastToken = $token[0]; |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } |
| 445 | 445 | |
| 446 | - private function t_extends( $token ) |
|
| 446 | + private function t_extends($token) |
|
| 447 | 447 | { |
| 448 | - switch ( $this->lastToken ) |
|
| 448 | + switch ($this->lastToken) |
|
| 449 | 449 | { |
| 450 | 450 | case null: |
| 451 | 451 | $this->lastToken = $token[0]; |
@@ -455,9 +455,9 @@ discard block |
||
| 455 | 455 | } |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - private function t_public( $token ) |
|
| 458 | + private function t_public($token) |
|
| 459 | 459 | { |
| 460 | - switch ( $this->lastToken ) |
|
| 460 | + switch ($this->lastToken) |
|
| 461 | 461 | { |
| 462 | 462 | case null: |
| 463 | 463 | $this->lastToken = $token[0]; |
@@ -468,9 +468,9 @@ discard block |
||
| 468 | 468 | } |
| 469 | 469 | } |
| 470 | 470 | |
| 471 | - private function t_protected( $token ) |
|
| 471 | + private function t_protected($token) |
|
| 472 | 472 | { |
| 473 | - switch ( $this->lastToken ) |
|
| 473 | + switch ($this->lastToken) |
|
| 474 | 474 | { |
| 475 | 475 | case null: |
| 476 | 476 | $this->lastToken = $token[0]; |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | - private function t_private( $token ) |
|
| 484 | + private function t_private($token) |
|
| 485 | 485 | { |
| 486 | - switch ( $this->lastToken ) |
|
| 486 | + switch ($this->lastToken) |
|
| 487 | 487 | { |
| 488 | 488 | case null: |
| 489 | 489 | $this->lastToken = $token[0]; |
@@ -494,9 +494,9 @@ discard block |
||
| 494 | 494 | } |
| 495 | 495 | } |
| 496 | 496 | |
| 497 | - private function t_doc_comment( $token ) |
|
| 497 | + private function t_doc_comment($token) |
|
| 498 | 498 | { |
| 499 | - switch ( $this->lastToken ) |
|
| 499 | + switch ($this->lastToken) |
|
| 500 | 500 | { |
| 501 | 501 | case null: |
| 502 | 502 | $this->parserStruct['docblock'] = $token[1]; |
@@ -510,19 +510,19 @@ discard block |
||
| 510 | 510 | private function storeClassOrInterface() |
| 511 | 511 | { |
| 512 | 512 | // First we need to check if we should store interface data found so far |
| 513 | - if ( $this->parserStruct['interface'] !== null ) |
|
| 513 | + if ($this->parserStruct['interface'] !== null) |
|
| 514 | 514 | { |
| 515 | 515 | // Init data storage |
| 516 | 516 | $functions = array(); |
| 517 | 517 | |
| 518 | 518 | // Create the data objects |
| 519 | - foreach( $this->parserStruct['functions'] as $function ) |
|
| 519 | + foreach ($this->parserStruct['functions'] as $function) |
|
| 520 | 520 | { |
| 521 | 521 | // Create the needed parameter objects |
| 522 | 522 | $params = array(); |
| 523 | - foreach( $function[2] as $param) |
|
| 523 | + foreach ($function[2] as $param) |
|
| 524 | 524 | { |
| 525 | - $params[] = new plPhpVariable( $param[1], $param[0] ); |
|
| 525 | + $params[] = new plPhpVariable($param[1], $param[0]); |
|
| 526 | 526 | } |
| 527 | 527 | $functions[] = new plPhpFunction( |
| 528 | 528 | $function[0], |
@@ -540,20 +540,20 @@ discard block |
||
| 540 | 540 | $this->interfaces[$this->parserStruct['interface']] = $interface; |
| 541 | 541 | } |
| 542 | 542 | // If there is no interface, we maybe need to store a class |
| 543 | - else if ( $this->parserStruct['class'] !== null ) |
|
| 543 | + else if ($this->parserStruct['class'] !== null) |
|
| 544 | 544 | { |
| 545 | 545 | // Init data storage |
| 546 | 546 | $functions = array(); |
| 547 | 547 | $attributes = array(); |
| 548 | 548 | |
| 549 | 549 | // Create the data objects |
| 550 | - foreach( $this->parserStruct['functions'] as $function ) |
|
| 550 | + foreach ($this->parserStruct['functions'] as $function) |
|
| 551 | 551 | { |
| 552 | 552 | // Create the needed parameter objects |
| 553 | 553 | $params = array(); |
| 554 | - foreach( $function[2] as $param) |
|
| 554 | + foreach ($function[2] as $param) |
|
| 555 | 555 | { |
| 556 | - $params[] = new plPhpVariable( $param[1], $param[0] ); |
|
| 556 | + $params[] = new plPhpVariable($param[1], $param[0]); |
|
| 557 | 557 | } |
| 558 | 558 | $functions[] = new plPhpFunction( |
| 559 | 559 | $function[0], |
@@ -561,21 +561,21 @@ discard block |
||
| 561 | 561 | $params |
| 562 | 562 | ); |
| 563 | 563 | } |
| 564 | - foreach ( $this->parserStruct['attributes'] as $attribute ) |
|
| 564 | + foreach ($this->parserStruct['attributes'] as $attribute) |
|
| 565 | 565 | { |
| 566 | 566 | $type = null; |
| 567 | 567 | // If there is a docblock try to isolate the attribute type |
| 568 | - if ( $attribute[2] !== null ) |
|
| 568 | + if ($attribute[2] !== null) |
|
| 569 | 569 | { |
| 570 | 570 | // Regular expression that extracts types in array annotations |
| 571 | 571 | $regexp = '/^[\s*]*@var\s+array\(\s*(\w+\s*=>\s*)?(\w+)\s*\).*$/m'; |
| 572 | - if ( preg_match( $regexp, $attribute[2], $matches ) ) |
|
| 572 | + if (preg_match($regexp, $attribute[2], $matches)) |
|
| 573 | 573 | { |
| 574 | 574 | $type = $matches[2]; |
| 575 | 575 | } |
| 576 | - else if ( $return = preg_match( '/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches ) ) |
|
| 576 | + else if ($return = preg_match('/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches)) |
|
| 577 | 577 | { |
| 578 | - $type = trim( $matches[1] ); |
|
| 578 | + $type = trim($matches[1]); |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | $attributes[] = new plPhpAttribute( |
@@ -600,34 +600,34 @@ discard block |
||
| 600 | 600 | |
| 601 | 601 | private function fixObjectConnections() |
| 602 | 602 | { |
| 603 | - foreach( $this->classes as $class ) |
|
| 603 | + foreach ($this->classes as $class) |
|
| 604 | 604 | { |
| 605 | 605 | $implements = array(); |
| 606 | - foreach( $class->implements as $key => $impl ) |
|
| 606 | + foreach ($class->implements as $key => $impl) |
|
| 607 | 607 | { |
| 608 | - $implements[$key] = array_key_exists( $impl, $this->interfaces ) |
|
| 608 | + $implements[$key] = array_key_exists($impl, $this->interfaces) |
|
| 609 | 609 | ? $this->interfaces[$impl] |
| 610 | - : $this->interfaces[$impl] = new plPhpInterface( $impl ); |
|
| 610 | + : $this->interfaces[$impl] = new plPhpInterface($impl); |
|
| 611 | 611 | } |
| 612 | 612 | $class->implements = $implements; |
| 613 | 613 | |
| 614 | - if ( $class->extends === null ) |
|
| 614 | + if ($class->extends === null) |
|
| 615 | 615 | { |
| 616 | 616 | continue; |
| 617 | 617 | } |
| 618 | - $class->extends = array_key_exists( $class->extends, $this->classes ) |
|
| 618 | + $class->extends = array_key_exists($class->extends, $this->classes) |
|
| 619 | 619 | ? $this->classes[$class->extends] |
| 620 | - : ( $this->classes[$class->extends] = new plPhpClass( $class->extends ) ); |
|
| 620 | + : ($this->classes[$class->extends] = new plPhpClass($class->extends)); |
|
| 621 | 621 | } |
| 622 | - foreach( $this->interfaces as $interface ) |
|
| 622 | + foreach ($this->interfaces as $interface) |
|
| 623 | 623 | { |
| 624 | - if ( $interface->extends === null ) |
|
| 624 | + if ($interface->extends === null) |
|
| 625 | 625 | { |
| 626 | 626 | continue; |
| 627 | 627 | } |
| 628 | - $interface->extends = array_key_exists( $interface->extends, $this->interfaces ) |
|
| 628 | + $interface->extends = array_key_exists($interface->extends, $this->interfaces) |
|
| 629 | 629 | ? $this->interfaces[$interface->extends] |
| 630 | - : ( $this->interfaces[$interface->extends] = new plPhpInterface( $interface->extends ) ); |
|
| 630 | + : ($this->interfaces[$interface->extends] = new plPhpInterface($interface->extends)); |
|
| 631 | 631 | } |
| 632 | 632 | } |
| 633 | 633 | } |
@@ -75,8 +75,7 @@ discard block |
||
| 75 | 75 | // Ignore everything else |
| 76 | 76 | $this->lastToken = null; |
| 77 | 77 | } |
| 78 | - } |
|
| 79 | - else if ( is_array( $token ) === true ) |
|
| 78 | + } else if ( is_array( $token ) === true ) |
|
| 80 | 79 | { |
| 81 | 80 | switch ( $token[0] ) |
| 82 | 81 | { |
@@ -369,8 +368,7 @@ discard block |
||
| 369 | 368 | { |
| 370 | 369 | // Function name |
| 371 | 370 | $this->parserStruct['function'] = $token[1]; |
| 372 | - } |
|
| 373 | - else |
|
| 371 | + } else |
|
| 374 | 372 | { |
| 375 | 373 | // Type hint |
| 376 | 374 | $this->parserStruct['typehint'] = $token[1]; |
@@ -572,8 +570,7 @@ discard block |
||
| 572 | 570 | if ( preg_match( $regexp, $attribute[2], $matches ) ) |
| 573 | 571 | { |
| 574 | 572 | $type = $matches[2]; |
| 575 | - } |
|
| 576 | - else if ( $return = preg_match( '/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches ) ) |
|
| 573 | + } else if ( $return = preg_match( '/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches ) ) |
|
| 577 | 574 | { |
| 578 | 575 | $type = trim( $matches[1] ); |
| 579 | 576 | } |