src/Manager.php
public function parseIncludes($includes)
    {
        // Wipe these before we go again
        $this->requestedIncludes = $this->includeParams = [];

        if (is_string($includes)) {
            $includes = explode(',', $includes);
        }

        if (! is_array($includes)) {
            throw new \InvalidArgumentException(
                'The parseIncludes() method expects a string or an array. '.gettype($includes).' given'
            );
        }

        foreach ($includes as $include) {
            list($includeName, $allModifiersStr) = array_pad(explode(':', $include, 2), 2, null);

            // Trim it down to a cool level of recursion
            $includeName = $this->trimToAcceptableRecursionLevel($includeName);

            if (in_array($includeName, $this->requestedIncludes)) {
                continue;
            }
            $this->requestedIncludes[] = $includeName;

            // No Params? Bored
            if ($allModifiersStr === null) {
                continue;
            }

            // Matches multiple instances of 'something(foo|bar|baz)' in the string
            // I guess it ignores : so you could use anything, but probably don't do that
            preg_match_all('/([\w]+)(\(([^\)]+)\))?/', $allModifiersStr, $allModifiersArr);

            // [0] is full matched strings...
            $modifierCount = count($allModifiersArr[0]);

            $modifierArr = [];

            for ($modifierIt = 0; $modifierIt < $modifierCount; $modifierIt++) {
                // [1] is the modifier
                $modifierName = $allModifiersArr[1][$modifierIt];

                // and [3] is delimited params
                $modifierParamStr = $allModifiersArr[3][$modifierIt];

                // Make modifier array key with an array of params as the value
                $modifierArr[$modifierName] = explode($this->paramDelimiter, $modifierParamStr);
            }

            $this->includeParams[$includeName] = $modifierArr;
        }

        // This should be optional and public someday, but without it includes would never show up
        $this->autoIncludeParents();

        return $this;
    }
public function parseIncludes($includes)
    {
        // Wipe these before we go again
        $this->requestedIncludes = $this->includeParams = [];

        if (is_string($includes)) {
            $includes = explode(',', $includes);
        }

        if (! is_array($includes)) {
            throw new \InvalidArgumentException(
                'The parseIncludes() method expects a string or an array. '.gettype($includes).' given'
            );
        }

        foreach ($includes as $include) {
            list($includeName, $allModifiersStr) = array_pad(explode(':', $include, 2), 2, null);

            // Trim it down to a cool level of recursion
            $includeName = $this->trimToAcceptableRecursionLevel($includeName);

            if (in_array($includeName, $this->requestedIncludes)) {
                continue;
            }
            $this->requestedIncludes[] = $includeName;

            // No Params? Bored
            if ($allModifiersStr === null) {
                continue;
            }

            // Matches multiple instances of 'something(foo|bar|baz)' in the string
            // I guess it ignores : so you could use anything, but probably don't do that
            preg_match_all('/([\w]+)(\(([^\)]+)\))?/', $allModifiersStr, $allModifiersArr);

            // [0] is full matched strings...
            $modifierCount = count($allModifiersArr[0]);

            $modifierArr = [];

            for ($modifierIt = 0; $modifierIt < $modifierCount; $modifierIt++) {
                // [1] is the modifier
                $modifierName = $allModifiersArr[1][$modifierIt];

                // and [3] is delimited params
                $modifierParamStr = $allModifiersArr[3][$modifierIt];

                // Make modifier array key with an array of params as the value
                $modifierArr[$modifierName] = explode($this->paramDelimiter, $modifierParamStr);
            }

            $this->includeParams[$includeName] = $modifierArr;
        }

        // This should be optional and public someday, but without it includes would never show up
        $this->autoIncludeParents();

        return $this;
    }
public function parseIncludes ( $ includes ) { // Wipe these before we go again $ this -> requestedIncludes = $ this -> includeParams = [ ] ; if ( is_string ( $ includes ) ) { $ includes = explode ( ',' , $ includes ) ; } if ( ! is_array ( $ includes ) ) { throw new \ InvalidArgumentException ( 'The parseIncludes() method expects a string or an array. ' . gettype ( $ includes ) . ' given' ) ; } foreach ( $ includes as $ include ) { list ( $ includeName , $ allModifiersStr ) = array_pad ( explode ( ':' , $ include , 2 ) , 2 , null ) ; // Trim it down to a cool level of recursion $ includeName = $ this -> trimToAcceptableRecursionLevel ( $ includeName ) ; if ( in_array ( $ includeName , $ this -> requestedIncludes ) ) { continue ; } $ this -> requestedIncludes [ ] = $ includeName ; // No Params? Bored if ( $ allModifiersStr === null ) { continue ; } // Matches multiple instances of 'something(foo|bar|baz)' in the string // I guess it ignores : so you could use anything, but probably don't do that preg_match_all ( '/([\w]+)(\(([^\)]+)\))?/' , $ allModifiersStr , $ allModifiersArr ) ; // [0] is full matched strings... $ modifierCount = count ( $ allModifiersArr [ 0 ] ) ; $ modifierArr = [ ] ; for ( $ modifierIt = 0 ; $ modifierIt < $ modifierCount ; $ modifierIt ++ ) { // [1] is the modifier $ modifierName = $ allModifiersArr [ 1 ] [ $ modifierIt ] ; // and [3] is delimited params $ modifierParamStr = $ allModifiersArr [ 3 ] [ $ modifierIt ] ; // Make modifier array key with an array of params as the value $ modifierArr [ $ modifierName ] = explode ( $ this -> paramDelimiter , $ modifierParamStr ) ; } $ this -> includeParams [ $ includeName ] = $ modifierArr ; } // This should be optional and public someday, but without it includes would never show up $ this -> autoIncludeParents ( ) ; return $ this ; }
Parse Include String.

@param array|string $includes Array or csv string of resources to include

@return $this
Parse Include String .