<?php /** * Copyright 2018 Kacper Donat * * @author Kacper "Kadet" Donat <kacper@kadet.net> * * Full license available in separate LICENSE file */ namespace Kadet\Functional\Utils; use function Kadet\Functional\apply; use Kadet\Functional\Decorator; class FixedFunction implements Decorator { /** * @var callable */ private $fixed; /** * FixedFunction constructor. * * @param callable $fixed */ public function __construct(callable $fixed) { $this->fixed = $fixed; } public function __invoke(...$args) { return apply($this->fixed, $this, ...$args); } public function getDecorated() { return $this->fixed; } }