protected function registerClassesFromMagicProperties()
    {
        $reflection      = new \ReflectionClass(self::class);

        $docComment      = $reflection->getDocComment();
        $magicProperties = $docComment ? explode(PHP_EOL, $docComment) : [];

        foreach ($magicProperties as $magicProperty) {
            if (strpos($magicProperty, '@property') === false) {
                continue;
            }

            $partsString = trim(str_replace('* @property', '', $magicProperty));
            $parts       = explode('$', $partsString);

            list($className, $property) = $parts;

            $this->registerClass(trim($property), trim($className));
        }
        return $this;
    }
protected function registerClassesFromMagicProperties()
    {
        $reflection      = new \ReflectionClass(self::class);

        $docComment      = $reflection->getDocComment();
        $magicProperties = $docComment ? explode(PHP_EOL, $docComment) : [];

        foreach ($magicProperties as $magicProperty) {
            if (strpos($magicProperty, '@property') === false) {
                continue;
            }

            $partsString = trim(str_replace('* @property', '', $magicProperty));
            $parts       = explode('$', $partsString);

            list($className, $property) = $parts;

            $this->registerClass(trim($property), trim($className));
        }
        return $this;
    }
protected function registerClassesFromMagicProperties ( ) { $ reflection = new \ ReflectionClass ( self :: class ) ; $ docComment = $ reflection -> getDocComment ( ) ; $ magicProperties = $ docComment ? explode ( PHP_EOL , $ docComment ) : [ ] ; foreach ( $ magicProperties as $ magicProperty ) { if ( strpos ( $ magicProperty , '@property' ) === false ) { continue ; } $ partsString = trim ( str_replace ( '* @property' , '' , $ magicProperty ) ) ; $ parts = explode ( '$' , $ partsString ) ; list ( $ className , $ property ) = $ parts ; $ this -> registerClass ( trim ( $ property ) , trim ( $ className ) ) ; } return $ this ; }
For all the magic properties defined at the start of this class, loop through them
and add them to our list of magic properties.

@return $this
For all the magic properties defined at the start of this class loop through them and add them to our list of magic properties .