getUser($request), $folder)) { throw new AuthorizationFailedException(); } $subfolders = array_map( function ($subfolder) { return $subfolder->getTypedFolder(); }, $folder->subfolders->getArrayCopy() ); list($offset, $limit) = $this->getOffsetAndLimit(); return $this->getPaginatedContentResponse( array_slice($subfolders, $offset, $limit), count($subfolders) ); } }