GraphQL\Tests\Validator\QueryDepthTest::buildRecursiveQueryPart PHP Метод

buildRecursiveQueryPart() приватный Метод

private buildRecursiveQueryPart ( $depth )
    private function buildRecursiveQueryPart($depth)
    {
        $templates = ['human' => ' { firstName%s } ', 'dog' => ' dogs { name%s } '];
        $part = $templates['human'];
        for ($i = 1; $i <= $depth; ++$i) {
            $key = $i % 2 == 1 ? 'human' : 'dog';
            $template = $templates[$key];
            $part = sprintf($part, ('human' == $key ? ' owner ' : '') . $template);
        }
        $part = str_replace('%s', '', $part);
        return $part;
    }