private function generateUrlParts(array $resources, array $arguments, $httpMethod)
    {
        $urlParts = [];
        foreach ($resources as $i => $resource) {
            // if we already added all parent routes paths to URL & we have
            // prefix - add it
            if (!empty($this->routePrefix) && $i === count($this->parents)) {
                $urlParts[] = $this->routePrefix;
            }

            // if we have argument for current resource, then it's object.
            // otherwise - it's collection
            if (isset($arguments[$i])) {
                if (null !== $resource) {
                    $urlParts[] =
                        strtolower($this->generateResourceName($resource))
                        .'/{'.$arguments[$i]->getName().'}';
                } else {
                    $urlParts[] = '{'.$arguments[$i]->getName().'}';
                }
            } elseif (null !== $resource) {
                if ((0 === count($arguments) && !in_array($httpMethod, $this->availableHTTPMethods))
                    || 'new' === $httpMethod
                    || 'post' === $httpMethod
                ) {
                    $urlParts[] = $this->generateResourceName(strtolower($resource));
                } else {
                    $urlParts[] = strtolower($resource);
                }
            }
        }

        return $urlParts;
    }
private function generateUrlParts(array $resources, array $arguments, $httpMethod)
    {
        $urlParts = [];
        foreach ($resources as $i => $resource) {
            // if we already added all parent routes paths to URL & we have
            // prefix - add it
            if (!empty($this->routePrefix) && $i === count($this->parents)) {
                $urlParts[] = $this->routePrefix;
            }

            // if we have argument for current resource, then it's object.
            // otherwise - it's collection
            if (isset($arguments[$i])) {
                if (null !== $resource) {
                    $urlParts[] =
                        strtolower($this->generateResourceName($resource))
                        .'/{'.$arguments[$i]->getName().'}';
                } else {
                    $urlParts[] = '{'.$arguments[$i]->getName().'}';
                }
            } elseif (null !== $resource) {
                if ((0 === count($arguments) && !in_array($httpMethod, $this->availableHTTPMethods))
                    || 'new' === $httpMethod
                    || 'post' === $httpMethod
                ) {
                    $urlParts[] = $this->generateResourceName(strtolower($resource));
                } else {
                    $urlParts[] = strtolower($resource);
                }
            }
        }

        return $urlParts;
    }
private function generateUrlParts ( array $ resources , array $ arguments , $ httpMethod ) { $ urlParts = [ ] ; foreach ( $ resources as $ i => $ resource ) { // if we already added all parent routes paths to URL & we have // prefix - add it if ( ! empty ( $ this -> routePrefix ) && $ i === count ( $ this -> parents ) ) { $ urlParts [ ] = $ this -> routePrefix ; } // if we have argument for current resource, then it's object. // otherwise - it's collection if ( isset ( $ arguments [ $ i ] ) ) { if ( null !== $ resource ) { $ urlParts [ ] = strtolower ( $ this -> generateResourceName ( $ resource ) ) . '/{' . $ arguments [ $ i ] -> getName ( ) . '}' ; } else { $ urlParts [ ] = '{' . $ arguments [ $ i ] -> getName ( ) . '}' ; } } elseif ( null !== $ resource ) { if ( ( 0 === count ( $ arguments ) && ! in_array ( $ httpMethod , $ this -> availableHTTPMethods ) ) || 'new' === $ httpMethod || 'post' === $ httpMethod ) { $ urlParts [ ] = $ this -> generateResourceName ( strtolower ( $ resource ) ) ; } else { $ urlParts [ ] = strtolower ( $ resource ) ; } } } return $ urlParts ; }
Generates URL parts for route from resources list.

@param string[]               $resources
@param \ReflectionParameter[] $arguments
@param string                 $httpMethod

@return array
Generates URL parts for route from resources list .