| @@ -30,18 +30,18 @@ discard block | ||
| 30 | 30 |  header('Content-type: text/plain'); | 
| 31 | 31 | |
| 32 | 32 | $keywords = new Behat\Gherkin\Keywords\ArrayKeywords(array( | 
| 33 | - 'en' => array( | |
| 34 | - 'feature' => 'Feature', | |
| 35 | - 'background' => 'Background', | |
| 36 | - 'scenario' => 'Scenario', | |
| 37 | - 'scenario_outline' => 'Scenario Outline', | |
| 38 | - 'examples' => 'Examples', | |
| 39 | - 'given' => 'Given', | |
| 40 | - 'when' => 'When', | |
| 41 | - 'then' => 'Then', | |
| 42 | - 'and' => 'And', | |
| 43 | - 'but' => 'But' | |
| 44 | - ), | |
| 33 | + 'en' => array( | |
| 34 | + 'feature' => 'Feature', | |
| 35 | + 'background' => 'Background', | |
| 36 | + 'scenario' => 'Scenario', | |
| 37 | + 'scenario_outline' => 'Scenario Outline', | |
| 38 | + 'examples' => 'Examples', | |
| 39 | + 'given' => 'Given', | |
| 40 | + 'when' => 'When', | |
| 41 | + 'then' => 'Then', | |
| 42 | + 'and' => 'And', | |
| 43 | + 'but' => 'But' | |
| 44 | + ), | |
| 45 | 45 | )); | 
| 46 | 46 | $lexer = new Behat\Gherkin\Lexer($keywords); | 
| 47 | 47 | $parser = new Behat\Gherkin\Parser($lexer); | 
| @@ -51,23 +51,23 @@ discard block | ||
| 51 | 51 | } | 
| 52 | 52 |  catch (Exception $ex) { | 
| 53 | 53 | echo $ex->getMessage() . "\n"; | 
| 54 | - exit; | |
| 54 | + exit; | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 |  foreach ($feature->getScenarios() as $scenario) { | 
| 58 | -    if ($scenario instanceof OutlineNode) { | |
| 59 | - echo $scenario->getExampleTable() . "\n\n"; | |
| 60 | - } | |
| 61 | -    elseif ($scenario instanceof ScenarioNode) { | |
| 62 | -        foreach ($scenario->getSteps() as $step) { | |
| 63 | -            foreach ($step->getArguments() as $argument) { | |
| 64 | -                if ($argument instanceof TableNode) { | |
| 65 | - echo $argument . "\n\n"; | |
| 66 | - } | |
| 67 | - } | |
| 68 | - // print_r($step); | |
| 69 | - } | |
| 70 | - } | |
| 58 | +	if ($scenario instanceof OutlineNode) { | |
| 59 | + echo $scenario->getExampleTable() . "\n\n"; | |
| 60 | + } | |
| 61 | +	elseif ($scenario instanceof ScenarioNode) { | |
| 62 | +		foreach ($scenario->getSteps() as $step) { | |
| 63 | +			foreach ($step->getArguments() as $argument) { | |
| 64 | +				if ($argument instanceof TableNode) { | |
| 65 | + echo $argument . "\n\n"; | |
| 66 | + } | |
| 67 | + } | |
| 68 | + // print_r($step); | |
| 69 | + } | |
| 70 | + } | |
| 71 | 71 | } | 
| 72 | 72 | |
| 73 | 73 | print_r($feature); | 
| @@ -48,8 +48,7 @@ discard block | ||
| 48 | 48 | |
| 49 | 49 |  try { | 
| 50 | 50 | $feature = $parser->parse($feature); | 
| 51 | -} | |
| 52 | -catch (Exception $ex) { | |
| 51 | +} catch (Exception $ex) { | |
| 53 | 52 | echo $ex->getMessage() . "\n"; | 
| 54 | 53 | exit; | 
| 55 | 54 | } | 
| @@ -57,8 +56,7 @@ discard block | ||
| 57 | 56 |  foreach ($feature->getScenarios() as $scenario) { | 
| 58 | 57 |      if ($scenario instanceof OutlineNode) { | 
| 59 | 58 | echo $scenario->getExampleTable() . "\n\n"; | 
| 60 | - } | |
| 61 | -    elseif ($scenario instanceof ScenarioNode) { | |
| 59 | +    } elseif ($scenario instanceof ScenarioNode) { | |
| 62 | 60 |          foreach ($scenario->getSteps() as $step) { | 
| 63 | 61 |              foreach ($step->getArguments() as $argument) { | 
| 64 | 62 |                  if ($argument instanceof TableNode) { | 
| @@ -50,19 +50,19 @@ | ||
| 50 | 50 | $feature = $parser->parse($feature); | 
| 51 | 51 | } | 
| 52 | 52 |  catch (Exception $ex) { | 
| 53 | - echo $ex->getMessage() . "\n"; | |
| 53 | + echo $ex->getMessage()."\n"; | |
| 54 | 54 | exit; | 
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 |  foreach ($feature->getScenarios() as $scenario) { | 
| 58 | 58 |      if ($scenario instanceof OutlineNode) { | 
| 59 | - echo $scenario->getExampleTable() . "\n\n"; | |
| 59 | + echo $scenario->getExampleTable()."\n\n"; | |
| 60 | 60 | } | 
| 61 | 61 |      elseif ($scenario instanceof ScenarioNode) { | 
| 62 | 62 |          foreach ($scenario->getSteps() as $step) { | 
| 63 | 63 |              foreach ($step->getArguments() as $argument) { | 
| 64 | 64 |                  if ($argument instanceof TableNode) { | 
| 65 | - echo $argument . "\n\n"; | |
| 65 | + echo $argument."\n\n"; | |
| 66 | 66 | } | 
| 67 | 67 | } | 
| 68 | 68 | // print_r($step); | 
| @@ -17,35 +17,35 @@ | ||
| 17 | 17 | /** | 
| 18 | 18 | * | 
| 19 | 19 | */ | 
| 20 | -	protected function convertor( $toUnit ) { | |
| 20 | +	protected function convertor($toUnit) { | |
| 21 | 21 | return $this->convertUsingMethods($toUnit); | 
| 22 | 22 | } | 
| 23 | 23 | |
| 24 | 24 | /** | 
| 25 | 25 | * | 
| 26 | 26 | */ | 
| 27 | -	protected function kToF( $amount ) { | |
| 28 | - return ($amount - 273.15) * 9/5 + 32; | |
| 27 | +	protected function kToF($amount) { | |
| 28 | + return ($amount - 273.15) * 9 / 5 + 32; | |
| 29 | 29 | } | 
| 30 | 30 | |
| 31 | 31 | /** | 
| 32 | 32 | * | 
| 33 | 33 | */ | 
| 34 | -	protected function fToK( $amount ) { | |
| 35 | - return ($amount - 32) * 5/9 + 273.15; | |
| 34 | +	protected function fToK($amount) { | |
| 35 | + return ($amount - 32) * 5 / 9 + 273.15; | |
| 36 | 36 | } | 
| 37 | 37 | |
| 38 | 38 | /** | 
| 39 | 39 | * | 
| 40 | 40 | */ | 
| 41 | -	protected function kToC( $amount ) { | |
| 41 | +	protected function kToC($amount) { | |
| 42 | 42 | return $amount - 273.15; | 
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 | /** | 
| 46 | 46 | * | 
| 47 | 47 | */ | 
| 48 | -	protected function cToK( $amount ) { | |
| 48 | +	protected function cToK($amount) { | |
| 49 | 49 | return $amount + 273.15; | 
| 50 | 50 | } | 
| 51 | 51 | |
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * The convertor heart, that every sub class needs | 
| 27 | 27 | */ | 
| 28 | -	protected function convertor( $toUnit ) { | |
| 28 | +	protected function convertor($toUnit) { | |
| 29 | 29 | return $this->convertUsingTable($toUnit); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * The convertor heart, that every sub class needs | 
| 27 | 27 | */ | 
| 28 | -	protected function convertor( $toUnit ) { | |
| 28 | +	protected function convertor($toUnit) { | |
| 29 | 29 | return $this->convertUsingTable($toUnit); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -15,7 +15,7 @@ discard block | ||
| 15 | 15 | /** | 
| 16 | 16 | * Convert without the bother of an object | 
| 17 | 17 | */ | 
| 18 | -	static public function convert( $amount, $fromUnit, $toUnit ) { | |
| 18 | +	static public function convert($amount, $fromUnit, $toUnit) { | |
| 19 | 19 | $quantity = new static($amount, $fromUnit); | 
| 20 | 20 | return $quantity->to($toUnit); | 
| 21 | 21 | } | 
| @@ -23,9 +23,9 @@ discard block | ||
| 23 | 23 | /** | 
| 24 | 24 | * Check if the given unit is valid for this quantity | 
| 25 | 25 | */ | 
| 26 | -	static public function validUnit( $unit ) { | |
| 26 | +	static public function validUnit($unit) { | |
| 27 | 27 | $units = static::$units; | 
| 28 | -		if ( isset($units[0]) ) { | |
| 28 | +		if (isset($units[0])) { | |
| 29 | 29 | return in_array($unit, $units); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -41,9 +41,9 @@ discard block | ||
| 41 | 41 | /** | 
| 42 | 42 | * | 
| 43 | 43 | */ | 
| 44 | -	public function __construct( $amount, $unit = null, $convertToDefault = true ) { | |
| 44 | +	public function __construct($amount, $unit = null, $convertToDefault = true) { | |
| 45 | 45 | // Invalid unit! | 
| 46 | -		if ( $unit && !static::validUnit($unit) ) { | |
| 46 | +		if ($unit && !static::validUnit($unit)) { | |
| 47 | 47 | $quantity = (new \ReflectionClass(get_called_class()))->getShortName(); | 
| 48 | 48 |  			throw new ConversionException("Can't import '$quantity' as '$unit'."); | 
| 49 | 49 | } | 
| @@ -54,7 +54,7 @@ discard block | ||
| 54 | 54 | $this->original_unit = $this->unit; | 
| 55 | 55 | |
| 56 | 56 | // Convert incoming unit into storage unit | 
| 57 | -		if ( $convertToDefault && $this->unit != $this::$default_unit ) { | |
| 57 | +		if ($convertToDefault && $this->unit != $this::$default_unit) { | |
| 58 | 58 | $this->amount = $this->to($this::$default_unit); | 
| 59 | 59 | $this->unit = $this::$default_unit; | 
| 60 | 60 | } | 
| @@ -63,21 +63,21 @@ discard block | ||
| 63 | 63 | /** | 
| 64 | 64 | * Convert object amount to another unit, and return, don't save | 
| 65 | 65 | */ | 
| 66 | -	public function to( $toUnit ) { | |
| 66 | +	public function to($toUnit) { | |
| 67 | 67 | return $this->convertor($toUnit); | 
| 68 | 68 | } | 
| 69 | 69 | |
| 70 | 70 | /** | 
| 71 | 71 | * The convertor heart, that every sub class needs | 
| 72 | 72 | */ | 
| 73 | - abstract protected function convertor( $toUnit ); | |
| 73 | + abstract protected function convertor($toUnit); | |
| 74 | 74 | |
| 75 | 75 | /** | 
| 76 | 76 | * The default convertor, using the Quantity's conversion table | 
| 77 | 77 | */ | 
| 78 | -	protected function convertUsingTable( $toUnit ) { | |
| 78 | +	protected function convertUsingTable($toUnit) { | |
| 79 | 79 | // Invalid unit! | 
| 80 | -		if ( !$this::validUnit($toUnit) ) { | |
| 80 | +		if (!$this::validUnit($toUnit)) { | |
| 81 | 81 | $quantity = (new \ReflectionClass($this))->getShortName(); | 
| 82 | 82 |  			throw new ConversionException("Can't convert '$quantity' to '$toUnit'."); | 
| 83 | 83 | } | 
| @@ -98,15 +98,15 @@ discard block | ||
| 98 | 98 | /** | 
| 99 | 99 | * Advanded convertor, using unit-base-unit methods | 
| 100 | 100 | */ | 
| 101 | -	protected function convertUsingMethods( $toUnit ) { | |
| 101 | +	protected function convertUsingMethods($toUnit) { | |
| 102 | 102 | $amount = $this->amount; | 
| 103 | 103 | |
| 104 | -		if ( $this->unit != $this::BASE_UNIT ) { | |
| 105 | - $amount = call_user_func(array($this, $this->unit . 'to' . $this::BASE_UNIT), $amount); | |
| 104 | +		if ($this->unit != $this::BASE_UNIT) { | |
| 105 | + $amount = call_user_func(array($this, $this->unit.'to'.$this::BASE_UNIT), $amount); | |
| 106 | 106 | } | 
| 107 | 107 | |
| 108 | -		if ( $this::BASE_UNIT != $toUnit ) { | |
| 109 | - $amount = call_user_func(array($this, $this::BASE_UNIT . 'to' . $toUnit), $amount); | |
| 108 | +		if ($this::BASE_UNIT != $toUnit) { | |
| 109 | + $amount = call_user_func(array($this, $this::BASE_UNIT.'to'.$toUnit), $amount); | |
| 110 | 110 | } | 
| 111 | 111 | |
| 112 | 112 | return $amount; | 
| @@ -115,7 +115,7 @@ discard block | ||
| 115 | 115 | /** | 
| 116 | 116 | * Convert the object to another standard unit | 
| 117 | 117 | */ | 
| 118 | -	public function convertTo( $unit ) { | |
| 118 | +	public function convertTo($unit) { | |
| 119 | 119 | $this->amount = $this->to($unit); | 
| 120 | 120 | $this->unit = $unit; | 
| 121 | 121 | } | 
| @@ -125,8 +125,8 @@ discard block | ||
| 125 | 125 | */ | 
| 126 | 126 |  	public function all() { | 
| 127 | 127 | $all = array(); | 
| 128 | -		foreach ( $this::$units as $unit => $conversion ) { | |
| 129 | -			if ( is_int($unit) ) { | |
| 128 | +		foreach ($this::$units as $unit => $conversion) { | |
| 129 | +			if (is_int($unit)) { | |
| 130 | 130 | $unit = $conversion; | 
| 131 | 131 | } | 
| 132 | 132 | |
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * The convertor heart, that every sub class needs | 
| 27 | 27 | */ | 
| 28 | -	protected function convertor( $toUnit ) { | |
| 28 | +	protected function convertor($toUnit) { | |
| 29 | 29 | return $this->convertUsingTable($toUnit); | 
| 30 | 30 | } | 
| 31 | 31 | |
| @@ -12,7 +12,7 @@ discard block | ||
| 12 | 12 | [1, 23, 456], | 
| 13 | 13 | [456, 23, 1], | 
| 14 | 14 | ]); | 
| 15 | -echo $table . "\n\n"; | |
| 15 | +echo $table."\n\n"; | |
| 16 | 16 | print_r($table); | 
| 17 | 17 | |
| 18 | 18 | echo "\n\n\n\n"; | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 | [' 1', '23', '456'], | 
| 24 | 24 | ['456', '23', ' 1'], | 
| 25 | 25 | ]); | 
| 26 | -echo $table . "\n\n"; | |
| 26 | +echo $table."\n\n"; | |
| 27 | 27 | print_r($table); | 
| 28 | 28 | |
| 29 | 29 | echo "\n\n\n\n"; | 
| @@ -25,7 +25,7 @@ | ||
| 25 | 25 | /** | 
| 26 | 26 | * The convertor heart, that every sub class needs | 
| 27 | 27 | */ | 
| 28 | -	protected function convertor( $toUnit ) { | |
| 28 | +	protected function convertor($toUnit) { | |
| 29 | 29 | return $this->convertUsingTable($toUnit); | 
| 30 | 30 | } | 
| 31 | 31 | |