$value){ if(!property_exists($this, $policy)){ throw new \InvalidArgumentException($policy); } $this->$policy = $value; } foreach($nationPolicy as $policy){ if(!property_exists($this, $policy)){ throw new \InvalidArgumentException($policy); } $this->$policy = $value; } if(!$this->priority){ $this->priority = $this::$defaultPriority; } } }