Collections of useful classes and interfaces I often use in my projects.
Usage:
use Stdlib\Functional\PartialFn;
$mulXYZ = PartialFn::create(function($x, $y, $z) {
return $x * $y * $z;
});
$x = $mulXYZ(2);
$xy = $x(4);
$xyz = $xy(6);
> echo $xyz;
> 48
Usage:
use Stdlib\Math\BigDecimal;
$n = new BigDecimal('12345678900987654321');
$val = $n->mul(12345);
> echo $val->getValue();
> '152407406032692592592745'
Usage:
use Stdlib\Util\Chainable;
class Person {
private $birthday;
public function getBirthday() {
return $this->birthday;
}
public function setBirthday(\DateTime $date) {
return $this->birthday = $date;
}
}
$p1 = new Person();
$p2 = new Person();
$p2->setBirthday(new \DateTime('1990-02-02'));
$bd1 = Chainable::wrap($p1->getBirthday());
$bd2 = Chainable::wrap($p2->getBirthday());
> echo strval($bd1->format('Y-m-d'));
> echo strval($bd2->format('Y-m-d'));
> ''
> '1990-02-02'
Usage:
TODO
Usage:
TODO
Usage:
TODO