@@ -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 | } |
@@ -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 | } |
@@ -8,20 +8,20 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | protected $properties = array(); |
| 10 | 10 | |
| 11 | - public function __get( $key ) |
|
| 11 | + public function __get($key) |
|
| 12 | 12 | { |
| 13 | - if ( !array_key_exists( $key, $this->properties ) ) |
|
| 13 | + if (!array_key_exists($key, $this->properties)) |
|
| 14 | 14 | { |
| 15 | - throw new plProcessorOptionException( $key, plProcessorOptionException::READ ); |
|
| 15 | + throw new plProcessorOptionException($key, plProcessorOptionException::READ); |
|
| 16 | 16 | } |
| 17 | 17 | return $this->properties[$key]['data']; |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - public function __set( $key, $val ) |
|
| 20 | + public function __set($key, $val) |
|
| 21 | 21 | { |
| 22 | - if ( !array_key_exists( $key, $this->properties ) ) |
|
| 22 | + if (!array_key_exists($key, $this->properties)) |
|
| 23 | 23 | { |
| 24 | - throw new plProcessorOptionException( $key, plProcessorOptionException::WRITE ); |
|
| 24 | + throw new plProcessorOptionException($key, plProcessorOptionException::WRITE); |
|
| 25 | 25 | } |
| 26 | 26 | $this->properties[$key]['data'] = $val; |
| 27 | 27 | } |
@@ -29,27 +29,27 @@ discard block |
||
| 29 | 29 | public function getOptions() |
| 30 | 30 | { |
| 31 | 31 | $options = array(); |
| 32 | - foreach( $this->properties as $key => $property ) |
|
| 32 | + foreach ($this->properties as $key => $property) |
|
| 33 | 33 | { |
| 34 | 34 | $options[] = $key; |
| 35 | 35 | } |
| 36 | 36 | return $options; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - public function getOptionDescription( $option ) |
|
| 39 | + public function getOptionDescription($option) |
|
| 40 | 40 | { |
| 41 | - if ( !array_key_exists( $option, $this->properties ) ) |
|
| 41 | + if (!array_key_exists($option, $this->properties)) |
|
| 42 | 42 | { |
| 43 | - throw new plProcessorOptionException( $option, plProcessorOptionException::UNKNOWN ); |
|
| 43 | + throw new plProcessorOptionException($option, plProcessorOptionException::UNKNOWN); |
|
| 44 | 44 | } |
| 45 | 45 | return $this->properties[$option]['description']; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - public function getOptionType( $option ) |
|
| 48 | + public function getOptionType($option) |
|
| 49 | 49 | { |
| 50 | - if ( !array_key_exists( $option, $this->properties ) ) |
|
| 50 | + if (!array_key_exists($option, $this->properties)) |
|
| 51 | 51 | { |
| 52 | - throw new plProcessorOptionException( $option, plProcessorOptionException::UNKNOWN ); |
|
| 52 | + throw new plProcessorOptionException($option, plProcessorOptionException::UNKNOWN); |
|
| 53 | 53 | } |
| 54 | 54 | return $this->properties[$option]['type']; |
| 55 | 55 | } |
@@ -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 | - 'neato -Tpng -o ' . escapeshellarg( $outfile ) . ' ' . escapeshellarg( $infile ), |
|
| 27 | + 'neato -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 | } |
@@ -2,13 +2,13 @@ |
||
| 2 | 2 | |
| 3 | 3 | class plPhumlInvalidProcessorChainException extends Exception |
| 4 | 4 | { |
| 5 | - public function __construct( $first, $second ) |
|
| 5 | + public function __construct($first, $second) |
|
| 6 | 6 | { |
| 7 | 7 | parent::__construct( |
| 8 | 8 | 'To processors in the chain are incompatible. The first processor\'s output is "' |
| 9 | 9 | . $first |
| 10 | 10 | . '". The next Processor in the queue does only support the following input types: ' |
| 11 | - . implode( ', ', $second ) |
|
| 11 | + . implode(', ', $second) |
|
| 12 | 12 | . '.' |
| 13 | 13 | ); |
| 14 | 14 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | { |
| 5 | 5 | public function __construct() |
| 6 | 6 | { |
| 7 | - parent::__construct( 'The supplied processor is invalid.' ); |
|
| 7 | + parent::__construct('The supplied processor is invalid.'); |
|
| 8 | 8 | } |
| 9 | 9 | } |
| 10 | 10 | |
@@ -5,9 +5,9 @@ |
||
| 5 | 5 | const READ = 1; |
| 6 | 6 | const WRITE = 2; |
| 7 | 7 | |
| 8 | - public function __construct( $key, $type ) |
|
| 8 | + public function __construct($key, $type) |
|
| 9 | 9 | { |
| 10 | - parent::__construct( 'Invalid property access. The property "' . $key . '" is not '. ( $type === self::READ ? 'readable' : 'writable' ) . '.' ); |
|
| 10 | + parent::__construct('Invalid property access. The property "' . $key . '" is not ' . ($type === self::READ ? 'readable' : 'writable') . '.'); |
|
| 11 | 11 | } |
| 12 | 12 | } |
| 13 | 13 | |
@@ -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 | |
@@ -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 | |