{static::call}($method, $param) ) { return $return; } } $this->$method = (count($param ?? []) > 1) ? $param : ($param[0] ?? NULL); $this->revolvings[$method] = $this->$method; return $this; } /** * Magic call static * * @param string $method * @param array $param * * @return self */ public static function __callStatic($method, $param) { return (new self)->__call($method, $param); } /** * Default variables * * @param string $type = 'all' * @param bool $self = false * * @return void */ protected function defaultVariables($type = 'all', $self = false) { if( $type === NULL ) { return; } else if( is_array($type) ) { foreach( $type as $key ) { $this->$key = ($self === false ? NULL : $var); } } else { # Gets class variables. $vars = $this->getClassVarsByType($type); # MDefaults all class properties null. foreach( $vars as $key => $var ) { $this->$key = ($self === false ? NULL : $var); } } } /** * Protected get class vars */ protected function getClassVarsByType($type) { return $type === 'all' ? get_class_vars(get_called_class()) : $this->revolvings; } /** * Default revolving variables * * @param void * * @return void */ protected function defaultRevolvingVariables($type = NULL) { # It only converts the properties that this property creates to a null value. $this->defaultVariables($type); } }