for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* PHP Billing Library
*
* @link https://github.com/hiqdev/php-billing
* @package php-billing
* @license BSD-3-Clause
* @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
*/
namespace hiqdev\php\billing\charge\modifiers;
use hiqdev\php\billing\action\ActionInterface;
use hiqdev\php\billing\charge\ChargeInterface;
use hiqdev\php\billing\charge\ChargeModifier;
* Last combination.
* @author Andrii Vasyliev <[email protected]>
class LastCombination implements ChargeModifier
{
public function __construct(ChargeModifier $left, ChargeModifier $right)
$this->left = $left;
left
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
class MyClass { } $x = new MyClass(); $x->foo = true;
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:
class MyClass { public $foo; } $x = new MyClass(); $x->foo = true;
$this->right = $right;
right
}
public function modifyCharge(?ChargeInterface $charge, ActionInterface $action): array
if ($this->right->isSuitable($charge, $action)) {
return $this->right->modifyCharge($charge, $action);
return $this->left->modifyCharge($charge, $action);
public function isSuitable(?ChargeInterface $charge, ActionInterface $action): bool
return $this->left->isSuitable($charge, $action) || $this->right->isSuitable($charge, $action);
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: