public function __callData(string $name, array $args)
    {
        //if the method starts with get
        if (strpos($name, 'get') === 0) {
            //getUserName('-')
            $separator = '_';
            if (isset($args[0]) && is_scalar($args[0])) {
                $separator = (string) $args[0];
            }

            $key = preg_replace("/([A-Z0-9])/", $separator."$1", $name);
            //get rid of get
            $key = strtolower(substr($key, 3 + strlen($separator)));

            return $this->__getData($key);
        } else if (strpos($name, 'set') === 0) {
            //setUserName('Chris', '-')
            $separator = '_';
            if (isset($args[1]) && is_scalar($args[1])) {
                $separator = (string) $args[1];
            }

            $key = preg_replace("/([A-Z0-9])/", $separator."$1", $name);

            //get rid of set
            $key = strtolower(substr($key, 3 + strlen($separator)));

            $this->__setData($key, isset($args[0]) ? $args[0] : null);

            return $this;
        }

        throw DataException::forMethodNotFound(get_class($this), $name);
    }
public function __callData(string $name, array $args)
    {
        //if the method starts with get
        if (strpos($name, 'get') === 0) {
            //getUserName('-')
            $separator = '_';
            if (isset($args[0]) && is_scalar($args[0])) {
                $separator = (string) $args[0];
            }

            $key = preg_replace("/([A-Z0-9])/", $separator."$1", $name);
            //get rid of get
            $key = strtolower(substr($key, 3 + strlen($separator)));

            return $this->__getData($key);
        } else if (strpos($name, 'set') === 0) {
            //setUserName('Chris', '-')
            $separator = '_';
            if (isset($args[1]) && is_scalar($args[1])) {
                $separator = (string) $args[1];
            }

            $key = preg_replace("/([A-Z0-9])/", $separator."$1", $name);

            //get rid of set
            $key = strtolower(substr($key, 3 + strlen($separator)));

            $this->__setData($key, isset($args[0]) ? $args[0] : null);

            return $this;
        }

        throw DataException::forMethodNotFound(get_class($this), $name);
    }
public function __callData ( string $ name , array $ args ) { //if the method starts with get if ( strpos ( $ name , 'get' ) === 0 ) { //getUserName('-') $ separator = '_' ; if ( isset ( $ args [ 0 ] ) && is_scalar ( $ args [ 0 ] ) ) { $ separator = ( string ) $ args [ 0 ] ; } $ key = preg_replace ( "/([A-Z0-9])/" , $ separator . "$1" , $ name ) ; //get rid of get $ key = strtolower ( substr ( $ key , 3 + strlen ( $ separator ) ) ) ; return $ this -> __getData ( $ key ) ; } else if ( strpos ( $ name , 'set' ) === 0 ) { //setUserName('Chris', '-') $ separator = '_' ; if ( isset ( $ args [ 1 ] ) && is_scalar ( $ args [ 1 ] ) ) { $ separator = ( string ) $ args [ 1 ] ; } $ key = preg_replace ( "/([A-Z0-9])/" , $ separator . "$1" , $ name ) ; //get rid of set $ key = strtolower ( substr ( $ key , 3 + strlen ( $ separator ) ) ) ; $ this -> __setData ( $ key , isset ( $ args [ 0 ] ) ? $ args [ 0 ] : null ) ; return $ this ; } throw DataException :: forMethodNotFound ( get_class ( $ this ) , $ name ) ; }
Processes get and set type methods

@param *string $name Name of method
@param *array  $args Arguments to pass

@return mixed
Processes get and set type methods