@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | class plStructureGeneratorNotFoundException extends Exception |
4 | 4 | { |
5 | - public function __construct( $generator ) |
|
5 | + public function __construct($generator) |
|
6 | 6 | { |
7 | - parent::__construct( 'The needed generator class "' . $generator . '" could not be found.' ); |
|
7 | + parent::__construct('The needed generator class "' . $generator . '" could not be found.'); |
|
8 | 8 | } |
9 | 9 | } |
10 | 10 |
@@ -4,10 +4,10 @@ |
||
4 | 4 | { |
5 | 5 | public function __construct( $output ) |
6 | 6 | { |
7 | - // Convert array to string if is_array |
|
8 | - if(is_array($output)) { |
|
9 | - $output = var_export($output, true); |
|
10 | - } |
|
7 | + // Convert array to string if is_array |
|
8 | + if(is_array($output)) { |
|
9 | + $output = var_export($output, true); |
|
10 | + } |
|
11 | 11 | parent::__construct( 'Execution of external program failed:' . "\n" . $output ); |
12 | 12 | } |
13 | 13 | } |
@@ -2,13 +2,13 @@ |
||
2 | 2 | |
3 | 3 | class plProcessorExternalExecutionException extends Exception |
4 | 4 | { |
5 | - public function __construct( $output ) |
|
5 | + public function __construct($output) |
|
6 | 6 | { |
7 | 7 | // Convert array to string if is_array |
8 | - if(is_array($output)) { |
|
8 | + if (is_array($output)) { |
|
9 | 9 | $output = var_export($output, true); |
10 | 10 | } |
11 | - parent::__construct( 'Execution of external program failed:' . "\n" . $output ); |
|
11 | + parent::__construct('Execution of external program failed:' . "\n" . $output); |
|
12 | 12 | } |
13 | 13 | } |
14 | 14 |
@@ -17,7 +17,7 @@ |
||
17 | 17 | : ( ( $type === self::UNKNOWN ) |
18 | 18 | ? ( 'existent' ) |
19 | 19 | : ( 'writable') |
20 | - ) |
|
20 | + ) |
|
21 | 21 | . ' in this context.' |
22 | 22 | ); |
23 | 23 | } |
@@ -6,17 +6,17 @@ |
||
6 | 6 | const WRITE = 2; |
7 | 7 | const UNKNOWN = 3; |
8 | 8 | |
9 | - public function __construct( $key, $type ) |
|
9 | + public function __construct($key, $type) |
|
10 | 10 | { |
11 | 11 | parent::__construct( |
12 | 12 | 'The option "' |
13 | 13 | . $key |
14 | 14 | . '" is not ' |
15 | - . ( $type === self::READ ) |
|
16 | - ? ( 'readable' ) |
|
17 | - : ( ( $type === self::UNKNOWN ) |
|
18 | - ? ( 'existent' ) |
|
19 | - : ( 'writable') |
|
15 | + . ($type === self::READ) |
|
16 | + ? ('readable') |
|
17 | + : (($type === self::UNKNOWN) |
|
18 | + ? ('existent') |
|
19 | + : ('writable') |
|
20 | 20 | ) |
21 | 21 | . ' in this context.' |
22 | 22 | ); |
@@ -2,9 +2,9 @@ |
||
2 | 2 | |
3 | 3 | class plProcessorNotFoundException extends Exception |
4 | 4 | { |
5 | - public function __construct( $processor ) |
|
5 | + public function __construct($processor) |
|
6 | 6 | { |
7 | - parent::__construct( 'The needed processor class "' . $processor . '" could not be found.' ); |
|
7 | + parent::__construct('The needed processor class "' . $processor . '" could not be found.'); |
|
8 | 8 | } |
9 | 9 | } |
10 | 10 |
@@ -2,12 +2,12 @@ discard block |
||
2 | 2 | |
3 | 3 | abstract class plProcessor |
4 | 4 | { |
5 | - public static function factory( $processor ) |
|
5 | + public static function factory($processor) |
|
6 | 6 | { |
7 | - $classname = 'pl' . ucfirst( $processor ) . 'Processor'; |
|
8 | - if ( class_exists( $classname ) === false ) |
|
7 | + $classname = 'pl' . ucfirst($processor) . 'Processor'; |
|
8 | + if (class_exists($classname) === false) |
|
9 | 9 | { |
10 | - throw new plProcessorNotFoundException( $processor ); |
|
10 | + throw new plProcessorNotFoundException($processor); |
|
11 | 11 | } |
12 | 12 | return new $classname(); |
13 | 13 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | return $processors; |
24 | 24 | } |
25 | 25 | |
26 | - public function writeToDisk( $input, $output ) |
|
26 | + public function writeToDisk($input, $output) |
|
27 | 27 | { |
28 | - file_put_contents( $output, $input ); |
|
28 | + file_put_contents($output, $input); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | abstract public function getInputTypes(); |
32 | 32 | abstract public function getOutputType(); |
33 | - abstract public function process( $input, $type ); |
|
33 | + abstract public function process($input, $type); |
|
34 | 34 | |
35 | 35 | } |
@@ -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 | } |
@@ -45,22 +45,22 @@ discard block |
||
45 | 45 | $this->lastToken = array(); |
46 | 46 | } |
47 | 47 | |
48 | - public function createStructure( array $files ) |
|
48 | + public function createStructure(array $files) |
|
49 | 49 | { |
50 | 50 | $this->initGlobalAttributes(); |
51 | 51 | |
52 | - foreach( $files as $file ) |
|
52 | + foreach ($files as $file) |
|
53 | 53 | { |
54 | 54 | $this->initParserAttributes(); |
55 | - $tokens = token_get_all( file_get_contents( $file ) ); |
|
55 | + $tokens = token_get_all(file_get_contents($file)); |
|
56 | 56 | |
57 | 57 | // Loop through all tokens |
58 | - foreach( $tokens as $token ) |
|
58 | + foreach ($tokens as $token) |
|
59 | 59 | { |
60 | 60 | // Split into Simple and complex token |
61 | - if ( is_array( $token ) !== true ) |
|
61 | + if (is_array($token) !== true) |
|
62 | 62 | { |
63 | - switch( $token ) |
|
63 | + switch ($token) |
|
64 | 64 | { |
65 | 65 | case ',': |
66 | 66 | $this->comma(); |
@@ -82,80 +82,80 @@ discard block |
||
82 | 82 | $this->lastToken = null; |
83 | 83 | } |
84 | 84 | } |
85 | - else if ( is_array( $token ) === true ) |
|
85 | + else if (is_array($token) === true) |
|
86 | 86 | { |
87 | - switch ( $token[0] ) |
|
87 | + switch ($token[0]) |
|
88 | 88 | { |
89 | 89 | case T_WHITESPACE: |
90 | - $this->t_whitespace( $token ); |
|
90 | + $this->t_whitespace($token); |
|
91 | 91 | break; |
92 | 92 | |
93 | 93 | case T_FUNCTION: |
94 | - $this->t_function( $token ); |
|
94 | + $this->t_function($token); |
|
95 | 95 | break; |
96 | 96 | |
97 | 97 | case T_VAR: |
98 | - $this->t_var( $token ); |
|
98 | + $this->t_var($token); |
|
99 | 99 | break; |
100 | 100 | |
101 | 101 | case T_VARIABLE: |
102 | - $this->t_variable( $token ); |
|
102 | + $this->t_variable($token); |
|
103 | 103 | break; |
104 | 104 | |
105 | 105 | case T_ARRAY: |
106 | - $this->t_array( $token ); |
|
106 | + $this->t_array($token); |
|
107 | 107 | break; |
108 | 108 | |
109 | 109 | case T_CONSTANT_ENCAPSED_STRING: |
110 | - $this->t_constant_encapsed_string( $token ); |
|
110 | + $this->t_constant_encapsed_string($token); |
|
111 | 111 | break; |
112 | 112 | |
113 | 113 | case T_LNUMBER: |
114 | - $this->t_lnumber( $token ); |
|
114 | + $this->t_lnumber($token); |
|
115 | 115 | break; |
116 | 116 | |
117 | 117 | case T_DNUMBER: |
118 | - $this->t_dnumber( $token ); |
|
118 | + $this->t_dnumber($token); |
|
119 | 119 | break; |
120 | 120 | |
121 | 121 | case T_PAAMAYIM_NEKUDOTAYIM: |
122 | - $this->t_paamayim_neukudotayim( $token ); |
|
122 | + $this->t_paamayim_neukudotayim($token); |
|
123 | 123 | break; |
124 | 124 | |
125 | 125 | case T_STRING: |
126 | - $this->t_string( $token ); |
|
126 | + $this->t_string($token); |
|
127 | 127 | break; |
128 | 128 | |
129 | 129 | case T_INTERFACE: |
130 | - $this->t_interface( $token ); |
|
130 | + $this->t_interface($token); |
|
131 | 131 | break; |
132 | 132 | |
133 | 133 | case T_CLASS: |
134 | - $this->t_class( $token ); |
|
134 | + $this->t_class($token); |
|
135 | 135 | break; |
136 | 136 | |
137 | 137 | case T_IMPLEMENTS: |
138 | - $this->t_implements( $token ); |
|
138 | + $this->t_implements($token); |
|
139 | 139 | break; |
140 | 140 | |
141 | 141 | case T_EXTENDS: |
142 | - $this->t_extends( $token ); |
|
142 | + $this->t_extends($token); |
|
143 | 143 | break; |
144 | 144 | |
145 | 145 | case T_PUBLIC: |
146 | - $this->t_public( $token ); |
|
146 | + $this->t_public($token); |
|
147 | 147 | break; |
148 | 148 | |
149 | 149 | case T_PROTECTED: |
150 | - $this->t_protected( $token ); |
|
150 | + $this->t_protected($token); |
|
151 | 151 | break; |
152 | 152 | |
153 | 153 | case T_PRIVATE: |
154 | - $this->t_private( $token ); |
|
154 | + $this->t_private($token); |
|
155 | 155 | break; |
156 | 156 | |
157 | 157 | case T_DOC_COMMENT: |
158 | - $this->t_doc_comment( $token ); |
|
158 | + $this->t_doc_comment($token); |
|
159 | 159 | break; |
160 | 160 | |
161 | 161 | default: |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $this->fixObjectConnections(); |
177 | 177 | |
178 | 178 | // Return the class and interface structure |
179 | - return array_merge( $this->classes, $this->interfaces ); |
|
179 | + return array_merge($this->classes, $this->interfaces); |
|
180 | 180 | } |
181 | 181 | |
182 | 182 | private function comma() |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | private function closing_bracket() |
194 | 194 | { |
195 | - switch ( $this->lastToken ) |
|
195 | + switch ($this->lastToken) |
|
196 | 196 | { |
197 | 197 | case T_FUNCTION: |
198 | 198 | // The function declaration has been closed |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | |
224 | 224 | private function equal_sign() |
225 | 225 | { |
226 | - switch ( $this->lastToken ) |
|
226 | + switch ($this->lastToken) |
|
227 | 227 | { |
228 | 228 | case T_FUNCTION: |
229 | 229 | // just ignore the equal sign |
@@ -233,14 +233,14 @@ discard block |
||
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
236 | - private function t_whitespace( $token ) |
|
236 | + private function t_whitespace($token) |
|
237 | 237 | { |
238 | 238 | // Ignore whitespaces |
239 | 239 | } |
240 | 240 | |
241 | - private function t_function( $token ) |
|
241 | + private function t_function($token) |
|
242 | 242 | { |
243 | - switch( $this->lastToken ) |
|
243 | + switch ($this->lastToken) |
|
244 | 244 | { |
245 | 245 | case null: |
246 | 246 | case T_PUBLIC: |
@@ -253,9 +253,9 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | - private function t_var( $token ) |
|
256 | + private function t_var($token) |
|
257 | 257 | { |
258 | - switch ( $this->lastToken ) |
|
258 | + switch ($this->lastToken) |
|
259 | 259 | { |
260 | 260 | case T_FUNCTION: |
261 | 261 | // just ignore the T_VAR |
@@ -265,9 +265,9 @@ discard block |
||
265 | 265 | } |
266 | 266 | } |
267 | 267 | |
268 | - private function t_variable( $token ) |
|
268 | + private function t_variable($token) |
|
269 | 269 | { |
270 | - switch( $this->lastToken ) |
|
270 | + switch ($this->lastToken) |
|
271 | 271 | { |
272 | 272 | case T_PUBLIC: |
273 | 273 | case T_PROTECTED: |
@@ -292,9 +292,9 @@ discard block |
||
292 | 292 | } |
293 | 293 | } |
294 | 294 | |
295 | - private function t_array( $token ) |
|
295 | + private function t_array($token) |
|
296 | 296 | { |
297 | - switch ( $this->lastToken ) |
|
297 | + switch ($this->lastToken) |
|
298 | 298 | { |
299 | 299 | case T_FUNCTION: |
300 | 300 | // just ignore the T_ARRAY |
@@ -304,9 +304,9 @@ discard block |
||
304 | 304 | } |
305 | 305 | } |
306 | 306 | |
307 | - private function t_constant_encapsed_string( $token ) |
|
307 | + private function t_constant_encapsed_string($token) |
|
308 | 308 | { |
309 | - switch ( $this->lastToken ) |
|
309 | + switch ($this->lastToken) |
|
310 | 310 | { |
311 | 311 | case T_FUNCTION: |
312 | 312 | // just ignore the T_CONSTANT_ENCAPSED_STRING |
@@ -316,9 +316,9 @@ discard block |
||
316 | 316 | } |
317 | 317 | } |
318 | 318 | |
319 | - private function t_lnumber( $token ) |
|
319 | + private function t_lnumber($token) |
|
320 | 320 | { |
321 | - switch ( $this->lastToken ) |
|
321 | + switch ($this->lastToken) |
|
322 | 322 | { |
323 | 323 | case T_FUNCTION: |
324 | 324 | // just ignore the T_LNUMBER |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | } |
329 | 329 | } |
330 | 330 | |
331 | - private function t_dnumber( $token ) |
|
331 | + private function t_dnumber($token) |
|
332 | 332 | { |
333 | - switch ( $this->lastToken ) |
|
333 | + switch ($this->lastToken) |
|
334 | 334 | { |
335 | 335 | case T_FUNCTION: |
336 | 336 | // just ignore the T_DNUMBER |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | } |
341 | 341 | } |
342 | 342 | |
343 | - private function t_paamayim_neukudotayim( $token ) |
|
343 | + private function t_paamayim_neukudotayim($token) |
|
344 | 344 | { |
345 | - switch ( $this->lastToken ) |
|
345 | + switch ($this->lastToken) |
|
346 | 346 | { |
347 | 347 | case T_FUNCTION: |
348 | 348 | // just ignore the T_PAAMAYIM_NEKUDOTAYIM |
@@ -352,9 +352,9 @@ discard block |
||
352 | 352 | } |
353 | 353 | } |
354 | 354 | |
355 | - private function t_string( $token ) |
|
355 | + private function t_string($token) |
|
356 | 356 | { |
357 | - switch( $this->lastToken ) |
|
357 | + switch ($this->lastToken) |
|
358 | 358 | { |
359 | 359 | case T_IMPLEMENTS: |
360 | 360 | // Add interface to implements array |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | case T_FUNCTION: |
372 | 372 | // Add the current function only if there is no function name already |
373 | 373 | // Because if we know the function name already this is a type hint |
374 | - if ( $this->parserStruct['function'] === null ) |
|
374 | + if ($this->parserStruct['function'] === null) |
|
375 | 375 | { |
376 | 376 | // Function name |
377 | 377 | $this->parserStruct['function'] = $token[1]; |
@@ -399,9 +399,9 @@ discard block |
||
399 | 399 | } |
400 | 400 | } |
401 | 401 | |
402 | - private function t_interface( $token ) |
|
402 | + private function t_interface($token) |
|
403 | 403 | { |
404 | - switch( $this->lastToken ) |
|
404 | + switch ($this->lastToken) |
|
405 | 405 | { |
406 | 406 | case null: |
407 | 407 | // New initial interface token |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | } |
419 | 419 | } |
420 | 420 | |
421 | - private function t_class( $token ) |
|
421 | + private function t_class($token) |
|
422 | 422 | { |
423 | - switch( $this->lastToken ) |
|
423 | + switch ($this->lastToken) |
|
424 | 424 | { |
425 | 425 | case null: |
426 | 426 | // New initial interface token |
@@ -437,9 +437,9 @@ discard block |
||
437 | 437 | } |
438 | 438 | } |
439 | 439 | |
440 | - private function t_implements( $token ) |
|
440 | + private function t_implements($token) |
|
441 | 441 | { |
442 | - switch ( $this->lastToken ) |
|
442 | + switch ($this->lastToken) |
|
443 | 443 | { |
444 | 444 | case null: |
445 | 445 | $this->lastToken = $token[0]; |
@@ -449,9 +449,9 @@ discard block |
||
449 | 449 | } |
450 | 450 | } |
451 | 451 | |
452 | - private function t_extends( $token ) |
|
452 | + private function t_extends($token) |
|
453 | 453 | { |
454 | - switch ( $this->lastToken ) |
|
454 | + switch ($this->lastToken) |
|
455 | 455 | { |
456 | 456 | case null: |
457 | 457 | $this->lastToken = $token[0]; |
@@ -461,9 +461,9 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | |
464 | - private function t_public( $token ) |
|
464 | + private function t_public($token) |
|
465 | 465 | { |
466 | - switch ( $this->lastToken ) |
|
466 | + switch ($this->lastToken) |
|
467 | 467 | { |
468 | 468 | case null: |
469 | 469 | $this->lastToken = $token[0]; |
@@ -474,9 +474,9 @@ discard block |
||
474 | 474 | } |
475 | 475 | } |
476 | 476 | |
477 | - private function t_protected( $token ) |
|
477 | + private function t_protected($token) |
|
478 | 478 | { |
479 | - switch ( $this->lastToken ) |
|
479 | + switch ($this->lastToken) |
|
480 | 480 | { |
481 | 481 | case null: |
482 | 482 | $this->lastToken = $token[0]; |
@@ -487,9 +487,9 @@ discard block |
||
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
490 | - private function t_private( $token ) |
|
490 | + private function t_private($token) |
|
491 | 491 | { |
492 | - switch ( $this->lastToken ) |
|
492 | + switch ($this->lastToken) |
|
493 | 493 | { |
494 | 494 | case null: |
495 | 495 | $this->lastToken = $token[0]; |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | } |
501 | 501 | } |
502 | 502 | |
503 | - private function t_doc_comment( $token ) |
|
503 | + private function t_doc_comment($token) |
|
504 | 504 | { |
505 | - switch ( $this->lastToken ) |
|
505 | + switch ($this->lastToken) |
|
506 | 506 | { |
507 | 507 | case null: |
508 | 508 | $this->parserStruct['docblock'] = $token[1]; |
@@ -516,19 +516,19 @@ discard block |
||
516 | 516 | private function storeClassOrInterface() |
517 | 517 | { |
518 | 518 | // First we need to check if we should store interface data found so far |
519 | - if ( $this->parserStruct['interface'] !== null ) |
|
519 | + if ($this->parserStruct['interface'] !== null) |
|
520 | 520 | { |
521 | 521 | // Init data storage |
522 | 522 | $functions = array(); |
523 | 523 | |
524 | 524 | // Create the data objects |
525 | - foreach( $this->parserStruct['functions'] as $function ) |
|
525 | + foreach ($this->parserStruct['functions'] as $function) |
|
526 | 526 | { |
527 | 527 | // Create the needed parameter objects |
528 | 528 | $params = array(); |
529 | - foreach( $function[2] as $param) |
|
529 | + foreach ($function[2] as $param) |
|
530 | 530 | { |
531 | - $params[] = new Variable( $param[1], $param[0] ); |
|
531 | + $params[] = new Variable($param[1], $param[0]); |
|
532 | 532 | } |
533 | 533 | $functions[] = new Method( |
534 | 534 | $function[0], |
@@ -546,20 +546,20 @@ discard block |
||
546 | 546 | $this->interfaces[$this->parserStruct['interface']] = $interface; |
547 | 547 | } |
548 | 548 | // If there is no interface, we maybe need to store a class |
549 | - else if ( $this->parserStruct['class'] !== null ) |
|
549 | + else if ($this->parserStruct['class'] !== null) |
|
550 | 550 | { |
551 | 551 | // Init data storage |
552 | 552 | $functions = array(); |
553 | 553 | $attributes = array(); |
554 | 554 | |
555 | 555 | // Create the data objects |
556 | - foreach( $this->parserStruct['functions'] as $function ) |
|
556 | + foreach ($this->parserStruct['functions'] as $function) |
|
557 | 557 | { |
558 | 558 | // Create the needed parameter objects |
559 | 559 | $params = array(); |
560 | - foreach( $function[2] as $param) |
|
560 | + foreach ($function[2] as $param) |
|
561 | 561 | { |
562 | - $params[] = new Variable( $param[1], $param[0] ); |
|
562 | + $params[] = new Variable($param[1], $param[0]); |
|
563 | 563 | } |
564 | 564 | $functions[] = new Method( |
565 | 565 | $function[0], |
@@ -567,21 +567,21 @@ discard block |
||
567 | 567 | $params |
568 | 568 | ); |
569 | 569 | } |
570 | - foreach ( $this->parserStruct['attributes'] as $attribute ) |
|
570 | + foreach ($this->parserStruct['attributes'] as $attribute) |
|
571 | 571 | { |
572 | 572 | $type = null; |
573 | 573 | // If there is a docblock try to isolate the attribute type |
574 | - if ( $attribute[2] !== null ) |
|
574 | + if ($attribute[2] !== null) |
|
575 | 575 | { |
576 | 576 | // Regular expression that extracts types in array annotations |
577 | 577 | $regexp = '/^[\s*]*@var\s+array\(\s*(\w+\s*=>\s*)?(\w+)\s*\).*$/m'; |
578 | - if ( preg_match( $regexp, $attribute[2], $matches ) ) |
|
578 | + if (preg_match($regexp, $attribute[2], $matches)) |
|
579 | 579 | { |
580 | 580 | $type = $matches[2]; |
581 | 581 | } |
582 | - else if ( $return = preg_match( '/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches ) ) |
|
582 | + else if ($return = preg_match('/^[\s*]*@var\s+(\S+).*$/m', $attribute[2], $matches)) |
|
583 | 583 | { |
584 | - $type = trim( $matches[1] ); |
|
584 | + $type = trim($matches[1]); |
|
585 | 585 | } |
586 | 586 | } |
587 | 587 | $attributes[] = new Attribute( |
@@ -606,34 +606,34 @@ discard block |
||
606 | 606 | |
607 | 607 | private function fixObjectConnections() |
608 | 608 | { |
609 | - foreach( $this->classes as $class ) |
|
609 | + foreach ($this->classes as $class) |
|
610 | 610 | { |
611 | 611 | $implements = array(); |
612 | - foreach( $class->implements as $key => $impl ) |
|
612 | + foreach ($class->implements as $key => $impl) |
|
613 | 613 | { |
614 | - $implements[$key] = array_key_exists( $impl, $this->interfaces ) |
|
614 | + $implements[$key] = array_key_exists($impl, $this->interfaces) |
|
615 | 615 | ? $this->interfaces[$impl] |
616 | - : $this->interfaces[$impl] = new InterfaceDefinition( $impl ); |
|
616 | + : $this->interfaces[$impl] = new InterfaceDefinition($impl); |
|
617 | 617 | } |
618 | 618 | $class->implements = $implements; |
619 | 619 | |
620 | - if ( $class->extends === null ) |
|
620 | + if ($class->extends === null) |
|
621 | 621 | { |
622 | 622 | continue; |
623 | 623 | } |
624 | - $class->extends = array_key_exists( $class->extends, $this->classes ) |
|
624 | + $class->extends = array_key_exists($class->extends, $this->classes) |
|
625 | 625 | ? $this->classes[$class->extends] |
626 | - : ( $this->classes[$class->extends] = new ClassDefinition( $class->extends ) ); |
|
626 | + : ($this->classes[$class->extends] = new ClassDefinition($class->extends)); |
|
627 | 627 | } |
628 | - foreach( $this->interfaces as $interface ) |
|
628 | + foreach ($this->interfaces as $interface) |
|
629 | 629 | { |
630 | - if ( $interface->extends === null ) |
|
630 | + if ($interface->extends === null) |
|
631 | 631 | { |
632 | 632 | continue; |
633 | 633 | } |
634 | - $interface->extends = array_key_exists( $interface->extends, $this->interfaces ) |
|
634 | + $interface->extends = array_key_exists($interface->extends, $this->interfaces) |
|
635 | 635 | ? $this->interfaces[$interface->extends] |
636 | - : ( $this->interfaces[$interface->extends] = new InterfaceDefinition( $interface->extends ) ); |
|
636 | + : ($this->interfaces[$interface->extends] = new InterfaceDefinition($interface->extends)); |
|
637 | 637 | } |
638 | 638 | } |
639 | 639 | } |
@@ -62,7 +62,7 @@ |
||
62 | 62 | |
63 | 63 | private function elementsToDotLanguage(): string |
64 | 64 | { |
65 | - $dotFormat = array_map(function (HasDotRepresentation $element) { |
|
65 | + $dotFormat = array_map(function(HasDotRepresentation $element) { |
|
66 | 66 | return $element->toDotLanguage(); |
67 | 67 | }, $this->dotElements); |
68 | 68 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | |
11 | 11 | public function __construct() |
12 | 12 | { |
13 | - $this->options = new plProcessorOptions(); |
|
13 | + $this->options = new plProcessorOptions(); |
|
14 | 14 | $this->information = array(); |
15 | 15 | } |
16 | 16 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | return 'text/plain'; |
27 | 27 | } |
28 | 28 | |
29 | - public function process( $input, $type ) |
|
29 | + public function process($input, $type) |
|
30 | 30 | { |
31 | 31 | // Initialize the values |
32 | 32 | $this->information['interfaceCount'] = 0; |
@@ -42,38 +42,38 @@ discard block |
||
42 | 42 | $this->information['privateTypedAttributes'] = 0; |
43 | 43 | |
44 | 44 | // Loop through the classes and interfaces |
45 | - foreach ( $input as $definition ) |
|
45 | + foreach ($input as $definition) |
|
46 | 46 | { |
47 | - if ( $definition instanceof InterfaceDefinition ) |
|
47 | + if ($definition instanceof InterfaceDefinition) |
|
48 | 48 | { |
49 | 49 | $this->information['interfaceCount']++; |
50 | 50 | } |
51 | 51 | |
52 | - if ( $definition instanceof ClassDefinition ) |
|
52 | + if ($definition instanceof ClassDefinition) |
|
53 | 53 | { |
54 | 54 | $this->information['classCount']++; |
55 | 55 | |
56 | - foreach( $definition->attributes as $attribute ) |
|
56 | + foreach ($definition->attributes as $attribute) |
|
57 | 57 | { |
58 | - switch ( $attribute->modifier ) |
|
58 | + switch ($attribute->modifier) |
|
59 | 59 | { |
60 | 60 | case 'public': |
61 | 61 | $this->information['publicAttributeCount']++; |
62 | - if ( $attribute->type->isPresent() ) |
|
62 | + if ($attribute->type->isPresent()) |
|
63 | 63 | { |
64 | 64 | $this->information['publicTypedAttributes']++; |
65 | 65 | } |
66 | 66 | break; |
67 | 67 | case 'protected': |
68 | 68 | $this->information['protectedAttributeCount']++; |
69 | - if ( $attribute->type->isPresent() ) |
|
69 | + if ($attribute->type->isPresent()) |
|
70 | 70 | { |
71 | 71 | $this->information['protectedTypedAttributes']++; |
72 | 72 | } |
73 | 73 | break; |
74 | 74 | case 'private': |
75 | 75 | $this->information['privateAttributeCount']++; |
76 | - if ( $attribute->type->isPresent() ) |
|
76 | + if ($attribute->type->isPresent()) |
|
77 | 77 | { |
78 | 78 | $this->information['privateTypedAttributes']++; |
79 | 79 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - foreach( $definition->functions as $function ) |
|
85 | + foreach ($definition->functions as $function) |
|
86 | 86 | { |
87 | - switch ( $function->modifier ) |
|
87 | + switch ($function->modifier) |
|
88 | 88 | { |
89 | 89 | case 'public': |
90 | 90 | $this->information['publicFunctionCount']++; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | $this->information['functionCount'] = $this->information['publicFunctionCount'] + $this->information['protectedFunctionCount'] + $this->information['privateFunctionCount']; |
103 | 103 | $this->information['attributeCount'] = $this->information['publicAttributeCount'] + $this->information['protectedAttributeCount'] + $this->information['privateAttributeCount']; |
104 | 104 | $this->information['typedAttributeCount'] = $this->information['publicTypedAttributes'] + $this->information['protectedTypedAttributes'] + $this->information['privateTypedAttributes']; |
105 | - $this->information['attributesPerClass'] = round( $this->information['attributeCount'] / $this->information['classCount'], 2 ); |
|
106 | - $this->information['functionsPerClass'] = round( $this->information['functionCount'] / $this->information['classCount'], 2 ); |
|
105 | + $this->information['attributesPerClass'] = round($this->information['attributeCount'] / $this->information['classCount'], 2); |
|
106 | + $this->information['functionsPerClass'] = round($this->information['functionCount'] / $this->information['classCount'], 2); |
|
107 | 107 | |
108 | 108 | // Generate the needed text output |
109 | 109 | return <<<END |
@@ -18,7 +18,7 @@ |
||
18 | 18 | public function __construct(Digraph $digraph = null) |
19 | 19 | { |
20 | 20 | $this->options = new plGraphvizProcessorOptions(); |
21 | - $labelBuilder = new NodeLabelBuilder(new TemplateEngine( |
|
21 | + $labelBuilder = new NodeLabelBuilder(new TemplateEngine( |
|
22 | 22 | new FileSystem(__DIR__ . '/../../Graphviz/templates') |
23 | 23 | ), new HtmlLabelStyle()); |
24 | 24 | $classElements = new ClassGraphElements($this->options->createAssociations, $labelBuilder); |