protected function _getPathObject($path)
    {
        // return as-is if parameter is
        if (is_a($path, 'stdClass')) {
            return $path;
        }

        // create path object from given string
        $obj = new stdClass();
        $obj->dotted = $path;

        $parts = explode('.', $path);

        if (count($parts) === 1) {
            $obj->toKey = null;
            $obj->key = $path;

            return $obj;
        }

        $key = end($parts);
        array_pop($parts);
        $obj->toKey = implode('.', $parts);
        $obj->key = $key;

        return $obj;
    }
protected function _getPathObject($path)
    {
        // return as-is if parameter is
        if (is_a($path, 'stdClass')) {
            return $path;
        }

        // create path object from given string
        $obj = new stdClass();
        $obj->dotted = $path;

        $parts = explode('.', $path);

        if (count($parts) === 1) {
            $obj->toKey = null;
            $obj->key = $path;

            return $obj;
        }

        $key = end($parts);
        array_pop($parts);
        $obj->toKey = implode('.', $parts);
        $obj->key = $key;

        return $obj;
    }
protected function _getPathObject ( $ path ) { // return as-is if parameter is if ( is_a ( $ path , 'stdClass' ) ) { return $ path ; } // create path object from given string $ obj = new stdClass ( ) ; $ obj -> dotted = $ path ; $ parts = explode ( '.' , $ path ) ; if ( count ( $ parts ) === 1 ) { $ obj -> toKey = null ; $ obj -> key = $ path ; return $ obj ; } $ key = end ( $ parts ) ; array_pop ( $ parts ) ; $ obj -> toKey = implode ( '.' , $ parts ) ; $ obj -> key = $ key ; return $ obj ; }
Helper method to create an object with consistent path strings from
given dot separated path.

@param string|stdClass $path Dot separated path or stdClass $path object
@return \stdClass
Helper method to create an object with consistent path strings from given dot separated path .