| @@ -2,12 +2,12 @@ | ||
| 2 | 2 | |
| 3 | 3 | abstract class plGraphvizProcessorStyle | 
| 4 | 4 |  { | 
| 5 | - public static function factory( $style ) | |
| 5 | + public static function factory($style) | |
| 6 | 6 |      { | 
| 7 | - $classname = 'plGraphvizProcessor' . ucfirst( $style ) . 'Style'; | |
| 8 | - if ( class_exists( $classname ) === false ) | |
| 7 | + $classname = 'plGraphvizProcessor' . ucfirst($style) . 'Style'; | |
| 8 | + if (class_exists($classname) === false) | |
| 9 | 9 |          { | 
| 10 | - throw new plGraphvizProcessorStyleNotFoundException( $style ); | |
| 10 | + throw new plGraphvizProcessorStyleNotFoundException($style); | |
| 11 | 11 | } | 
| 12 | 12 | return new $classname(); | 
| 13 | 13 | } | 
| @@ -3,24 +3,24 @@ | ||
| 3 | 3 | abstract class plExternalCommandProcessor extends plProcessor | 
| 4 | 4 |  { | 
| 5 | 5 | |
| 6 | - abstract public function execute( $infile, $outfile, $type ); | |
| 6 | + abstract public function execute($infile, $outfile, $type); | |
| 7 | 7 | |
| 8 | - public function process( $input, $type ) | |
| 8 | + public function process($input, $type) | |
| 9 | 9 |      { | 
| 10 | 10 | // Create temporary datafiles | 
| 11 | - $infile = tempnam( '/tmp', 'phuml' ); | |
| 12 | - $outfile = tempnam( '/tmp', 'phuml' ); | |
| 11 | +        $infile  = tempnam('/tmp', 'phuml'); | |
| 12 | +        $outfile = tempnam('/tmp', 'phuml'); | |
| 13 | 13 | |
| 14 | - file_put_contents( $infile, $input ); | |
| 14 | + file_put_contents($infile, $input); | |
| 15 | 15 | |
| 16 | - unlink( $outfile ); | |
| 16 | + unlink($outfile); | |
| 17 | 17 | |
| 18 | - $this->execute( $infile, $outfile, $type ); | |
| 18 | + $this->execute($infile, $outfile, $type); | |
| 19 | 19 | |
| 20 | - $outdata = file_get_contents( $outfile ); | |
| 20 | + $outdata = file_get_contents($outfile); | |
| 21 | 21 | |
| 22 | - unlink( $infile ); | |
| 23 | - unlink( $outfile ); | |
| 22 | + unlink($infile); | |
| 23 | + unlink($outfile); | |
| 24 | 24 | |
| 25 | 25 | return $outdata; | 
| 26 | 26 | } | 
| @@ -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 | } | 
| @@ -15,9 +15,9 @@ discard block | ||
| 15 | 15 | public static function getProcessors() | 
| 16 | 16 |      { | 
| 17 | 17 | $processors = array(); | 
| 18 | - foreach( plBase::getAutoloadClasses() as $autoload ) | |
| 18 | + foreach (plBase::getAutoloadClasses() as $autoload) | |
| 19 | 19 |          { | 
| 20 | - if ( preg_match( '@^pl([A-Z][a-z]*)Processor$@', $autoload, $matches ) ) | |
| 20 | +            if (preg_match('@^pl([A-Z][a-z]*)Processor$@', $autoload, $matches))  | |
| 21 | 21 |              { | 
| 22 | 22 | $processors[] = $matches[1]; | 
| 23 | 23 | } | 
| @@ -25,14 +25,14 @@ discard block | ||
| 25 | 25 | return $processors; | 
| 26 | 26 | } | 
| 27 | 27 | |
| 28 | - public function writeToDisk( $input, $output ) | |
| 28 | + public function writeToDisk($input, $output) | |
| 29 | 29 |      { | 
| 30 | - file_put_contents( $output, $input ); | |
| 30 | + file_put_contents($output, $input); | |
| 31 | 31 | } | 
| 32 | 32 | |
| 33 | 33 | abstract public function getInputTypes(); | 
| 34 | 34 | abstract public function getOutputType(); | 
| 35 | - abstract public function process( $input, $type ); | |
| 35 | + abstract public function process($input, $type); | |
| 36 | 36 | |
| 37 | 37 | } | 
| 38 | 38 | |
| @@ -2,17 +2,17 @@ | ||
| 2 | 2 | |
| 3 | 3 | abstract class plStructureGenerator | 
| 4 | 4 |  { | 
| 5 | - public static function factory( $generator ) | |
| 5 | + public static function factory($generator) | |
| 6 | 6 |      { | 
| 7 | - $classname = 'plStructure' . ucfirst( $generator ) . 'Generator'; | |
| 8 | - if ( class_exists( $classname ) === false ) | |
| 7 | + $classname = 'plStructure' . ucfirst($generator) . 'Generator'; | |
| 8 | + if (class_exists($classname) === false) | |
| 9 | 9 |          { | 
| 10 | - throw new plStructureGeneratorNotFoundException( $generator ); | |
| 10 | + throw new plStructureGeneratorNotFoundException($generator); | |
| 11 | 11 | } | 
| 12 | 12 | return new $classname(); | 
| 13 | 13 | } | 
| 14 | 14 | |
| 15 | - public abstract function createStructure( array $files ); | |
| 15 | + public abstract function createStructure(array $files); | |
| 16 | 16 | } | 
| 17 | 17 | |
| 18 | 18 | ?> | 
| @@ -1,19 +1,19 @@ | ||
| 1 | 1 | <?php | 
| 2 | 2 | |
| 3 | -define( "BASEDIR", dirname( __FILE__ ) . '/..' ); | |
| 3 | +define("BASEDIR", dirname(__FILE__) . '/..'); | |
| 4 | 4 | |
| 5 | 5 | ini_set( | 
| 6 | 6 | 'include_path', | 
| 7 | - ini_get( "include_path" ) . PATH_SEPARATOR . BASEDIR | |
| 7 | +    ini_get("include_path") . PATH_SEPARATOR . BASEDIR | |
| 8 | 8 | ); | 
| 9 | 9 | |
| 10 | -require_once( 'classes/base.php' ); | |
| 10 | +require_once('classes/base.php'); | |
| 11 | 11 | |
| 12 | -plBase::addAutoloadDirectory( dirname( __FILE__ ). '/../autoload' ); | |
| 12 | +plBase::addAutoloadDirectory(dirname(__FILE__) . '/../autoload'); | |
| 13 | 13 | |
| 14 | -function __autoload( $classname ) | |
| 14 | +function __autoload($classname) | |
| 15 | 15 |  { | 
| 16 | - plBase::autoload( $classname ); | |
| 16 | + plBase::autoload($classname); | |
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | 19 | ?> | 
| @@ -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 plPhpFunctionParameter( $param[1], $param[0] ); | |
| 525 | + $params[] = new plPhpFunctionParameter($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 plPhpFunctionParameter( $param[1], $param[0] ); | |
| 556 | + $params[] = new plPhpFunctionParameter($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 | } | 
| @@ -10,38 +10,38 @@ discard block | ||
| 10 | 10 | public function __construct() | 
| 11 | 11 |      { | 
| 12 | 12 | $this->properties = array( | 
| 13 | - 'generator' => plStructureGenerator::factory( 'tokenparser' ), | |
| 13 | +            'generator'     => plStructureGenerator::factory('tokenparser'), | |
| 14 | 14 | ); | 
| 15 | 15 | |
| 16 | 16 | $this->files = array(); | 
| 17 | 17 | } | 
| 18 | 18 | |
| 19 | - public function addFile( $file ) | |
| 19 | + public function addFile($file) | |
| 20 | 20 |      { | 
| 21 | 21 | $this->files[] = $file; | 
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | - public function addDirectory( $directory, $extension = 'php', $recursive = true ) | |
| 24 | + public function addDirectory($directory, $extension = 'php', $recursive = true) | |
| 25 | 25 |      { | 
| 26 | - if ( $recursive === false ) | |
| 26 | + if ($recursive === false) | |
| 27 | 27 |          { | 
| 28 | - $iterator = new DirectoryIterator( $directory ); | |
| 28 | + $iterator = new DirectoryIterator($directory); | |
| 29 | 29 | } | 
| 30 | 30 | else | 
| 31 | 31 |          { | 
| 32 | 32 | $iterator = new RecursiveIteratorIterator( | 
| 33 | - new RecursiveDirectoryIterator( $directory ) | |
| 33 | + new RecursiveDirectoryIterator($directory) | |
| 34 | 34 | ); | 
| 35 | 35 | } | 
| 36 | 36 | |
| 37 | - foreach( $iterator as $entry ) | |
| 37 | + foreach ($iterator as $entry) | |
| 38 | 38 |          { | 
| 39 | - if ( $entry->isDir() === true ) | |
| 39 | + if ($entry->isDir() === true) | |
| 40 | 40 |              { | 
| 41 | 41 | continue; | 
| 42 | 42 | } | 
| 43 | 43 | |
| 44 | - if ( $sub = strtolower( substr( $entry->getFilename(), -1 * strlen( $extension ) ) ) !== strtolower( $extension ) ) | |
| 44 | + if ($sub = strtolower(substr($entry->getFilename(), -1 * strlen($extension))) !== strtolower($extension)) | |
| 45 | 45 |              { | 
| 46 | 46 | continue; | 
| 47 | 47 | } | 
| @@ -50,77 +50,77 @@ discard block | ||
| 50 | 50 | } | 
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | - public function addProcessor( $processor ) | |
| 53 | + public function addProcessor($processor) | |
| 54 | 54 |      { | 
| 55 | - if ( count( $this->processors ) === 0 ) | |
| 55 | + if (count($this->processors) === 0) | |
| 56 | 56 |          { | 
| 57 | 57 | // First processor must support application/phuml-structure | 
| 58 | - if ( !in_array( 'application/phuml-structure', $processor->getInputTypes() ) ) | |
| 58 | +            if (!in_array('application/phuml-structure', $processor->getInputTypes()))  | |
| 59 | 59 |              { | 
| 60 | - throw new plPhumlInvalidProcessorChainException( 'application/phuml-structure', $processor->getInputTypes() ); | |
| 60 | +                throw new plPhumlInvalidProcessorChainException('application/phuml-structure', $processor->getInputTypes()); | |
| 61 | 61 | } | 
| 62 | 62 | } | 
| 63 | 63 | else | 
| 64 | 64 |          { | 
| 65 | - $this->checkProcessorCompatibility( end( $this->processors ), $processor ); | |
| 65 | + $this->checkProcessorCompatibility(end($this->processors), $processor); | |
| 66 | 66 | |
| 67 | 67 | } | 
| 68 | 68 | $this->processors[] = $processor; | 
| 69 | 69 | } | 
| 70 | 70 | |
| 71 | - private function checkProcessorCompatibility( $first, $second ) | |
| 71 | + private function checkProcessorCompatibility($first, $second) | |
| 72 | 72 |      { | 
| 73 | - if ( !( $first instanceof plProcessor ) || !( $second instanceof plProcessor ) ) | |
| 73 | + if (!($first instanceof plProcessor) || !($second instanceof plProcessor)) | |
| 74 | 74 |          { | 
| 75 | 75 | throw new plPhumlInvalidProcessorException(); | 
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | - if ( !in_array( $first->getOutputType(), $second->getInputTypes() ) ) | |
| 78 | + if (!in_array($first->getOutputType(), $second->getInputTypes())) | |
| 79 | 79 |          { | 
| 80 | - throw new plPhumlInvalidProcessorChainException( $first->getOutputType(), $second->getInputTypes() ); | |
| 80 | + throw new plPhumlInvalidProcessorChainException($first->getOutputType(), $second->getInputTypes()); | |
| 81 | 81 | } | 
| 82 | 82 | } | 
| 83 | 83 | |
| 84 | - public function generate( $outfile ) | |
| 84 | + public function generate($outfile) | |
| 85 | 85 |      { | 
| 86 | 86 | echo "[|] Parsing class structure", "\n"; | 
| 87 | - $structure = $this->generator->createStructure( $this->files ); | |
| 87 | + $structure = $this->generator->createStructure($this->files); | |
| 88 | 88 | |
| 89 | - $temporary = array( $structure, 'application/phuml-structure' ); | |
| 90 | - foreach( $this->processors as $processor ) | |
| 89 | + $temporary = array($structure, 'application/phuml-structure'); | |
| 90 | + foreach ($this->processors as $processor) | |
| 91 | 91 |          {             | 
| 92 | 92 | preg_match( | 
| 93 | 93 | '@^pl([A-Z][a-z]*)Processor$@', | 
| 94 | - get_class( $processor ), | |
| 94 | + get_class($processor), | |
| 95 | 95 | $matches | 
| 96 | 96 | ); | 
| 97 | 97 | |
| 98 | 98 | echo "[|] Running '" . $matches[1] . "' processor", "\n"; | 
| 99 | 99 | $temporary = array( | 
| 100 | - $processor->process( $temporary[0], $temporary[1] ), | |
| 100 | + $processor->process($temporary[0], $temporary[1]), | |
| 101 | 101 | $processor->getOutputType(), | 
| 102 | 102 | ); | 
| 103 | 103 | } | 
| 104 | 104 | |
| 105 | 105 | echo "[|] Writing generated data to disk", "\n"; | 
| 106 | - end( $this->processors )->writeToDisk( $temporary[0], $outfile ); | |
| 106 | + end($this->processors)->writeToDisk($temporary[0], $outfile); | |
| 107 | 107 | } | 
| 108 | 108 | |
| 109 | 109 | |
| 110 | - public function __get( $key ) | |
| 110 | + public function __get($key) | |
| 111 | 111 |      { | 
| 112 | - if ( !array_key_exists( $key, $this->properties ) ) | |
| 112 | + if (!array_key_exists($key, $this->properties)) | |
| 113 | 113 |          { | 
| 114 | - throw new plBasePropertyException( $key, plBasePropertyException::READ ); | |
| 114 | + throw new plBasePropertyException($key, plBasePropertyException::READ); | |
| 115 | 115 | } | 
| 116 | 116 | return $this->properties[$key]; | 
| 117 | 117 | } | 
| 118 | 118 | |
| 119 | - public function __set( $key, $val ) | |
| 119 | + public function __set($key, $val) | |
| 120 | 120 |      { | 
| 121 | - if ( !array_key_exists( $key, $this->properties ) ) | |
| 121 | + if (!array_key_exists($key, $this->properties)) | |
| 122 | 122 |          { | 
| 123 | - throw new plBasePropertyException( $key, plBasePropertyException::WRITE ); | |
| 123 | + throw new plBasePropertyException($key, plBasePropertyException::WRITE); | |
| 124 | 124 | } | 
| 125 | 125 | $this->properties[$key] = $val; | 
| 126 | 126 | } | 
| @@ -26,8 +26,7 @@ discard block | ||
| 26 | 26 | if ( $recursive === false ) | 
| 27 | 27 |          { | 
| 28 | 28 | $iterator = new DirectoryIterator( $directory ); | 
| 29 | - } | |
| 30 | - else | |
| 29 | + } else | |
| 31 | 30 |          { | 
| 32 | 31 | $iterator = new RecursiveIteratorIterator( | 
| 33 | 32 | new RecursiveDirectoryIterator( $directory ) | 
| @@ -59,8 +58,7 @@ discard block | ||
| 59 | 58 |              { | 
| 60 | 59 | throw new plPhumlInvalidProcessorChainException( 'application/phuml-structure', $processor->getInputTypes() ); | 
| 61 | 60 | } | 
| 62 | - } | |
| 63 | - else | |
| 61 | + } else | |
| 64 | 62 |          { | 
| 65 | 63 | $this->checkProcessorCompatibility( end( $this->processors ), $processor ); | 
| 66 | 64 | |
| @@ -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 !== null ) | |
| 59 | + if ($attribute->type !== null) | |
| 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 !== null ) | |
| 66 | + if ($attribute->type !== null) | |
| 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 !== null ) | |
| 73 | + if ($attribute->type !== null) | |
| 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 | 
| @@ -21,17 +21,17 @@ | ||
| 21 | 21 | return 'image/png'; | 
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | - public function execute( $infile, $outfile, $type ) | |
| 24 | + public function execute($infile, $outfile, $type) | |
| 25 | 25 |      { | 
| 26 | 26 | exec( | 
| 27 | - 'dot -Tpng -o ' . escapeshellarg( $outfile ) . ' ' . escapeshellarg( $infile ), | |
| 27 | + 'dot -Tpng -o ' . escapeshellarg($outfile) . ' ' . escapeshellarg($infile), | |
| 28 | 28 | $output, | 
| 29 | 29 | $return | 
| 30 | 30 | ); | 
| 31 | 31 | |
| 32 | - if ( $return !== 0 ) | |
| 32 | + if ($return !== 0) | |
| 33 | 33 |          { | 
| 34 | - throw new plProcessorExternalExecutionException( $output ); | |
| 34 | + throw new plProcessorExternalExecutionException($output); | |
| 35 | 35 | } | 
| 36 | 36 | } | 
| 37 | 37 | } |