Simplified Case with Immutable Classfinal class Secret implements IFoo{    private $header;    public function __construct(array $header = [])    {        $this->header = $header;    }    public function secret(array $header = []) : string    {        return empty($header) ? $this->header : $header;    }}Scenario 1$secret = new Secret(['a' => 1]);$secret->secret(); // returns ['a' => 1]Scenario 2// Need to instantiate, but don't know the argument$secret = new Secret();// Don't still know the argument// .......// I know the argument now$secret->secret(['a' => 1]); // returns ['a' => 1]What About OOP?Scenario 2 is handy if you need to instantiate the class, but don't know the argument.Is this valid OOP: use local parameter if global parameter is empty?Why, What's Your Problem?In the IoC container, I bind interface IFoo to the class Secret. But, in the IoC container, I don't know the argument!
Use Local Parameters If Global are empty?
object oriented;php;immutability;properties