Creates new collection with only pages of the specified type

@param string $type

@return Collection The collection
504783
public function ofType($type)
    {
        $items = [];

        foreach ($this->items as $path => $slug) {
            $page = $this->pages->get($path);
            if ($page !== null && $page->template() === $type) {
                $items[$path] = $slug;
            }
        }

        $this->items = $items;

        return $this;
    }
858956
public static function createWriter($type)
    {
        switch ($type) {
            case self::JSON:
                return new Impl\Json();
            case self::YAML:
                return new Impl\Yaml();
            case self::INI:
                return new Impl\Ini();
            case self::COLUMNS:
                return new Impl\Columns();
            case self::TABLE:
                return new Impl\ConsoleTable();
            case self::MARKDOWN:
                return new Impl\MarkdownTable();
            case self::DUMP:
                return new Impl\Dump();
        }

        throw new UnknownWriterTypeException("Sorry, writer type {$type} is not something I do");
    }
700807
public function pageType($typeOrId)
    {
        $this->pageTypeId = $typeOrId instanceof PageType ? $typeOrId->getId() : $typeOrId;
        $this->query->where('page_type', $this->pageTypeId);
        return $this;
    }
256468
@SuppressWarnings("unchecked")
  private Collection<Object> newCollection(Class<?> type) {
    if (SortedSet.class.isAssignableFrom(type)) return new TreeSet();
    else if (LinkedHashSet.class.isAssignableFrom(type)) return new LinkedHashSet();
    else if (Set.class.isAssignableFrom(type)) return new HashSet();
    else if (List.class.isAssignableFrom(type)) return new ArrayList();
    else {
      throw new ParameterException("Parameters of Collection type '" + type.getSimpleName()
                                  + "' are not supported. Please use List or Set instead.");
    }
  }
343773
public function newObject($type, array $data = [])
    {
        $type = $this->getFullType($type);
        if (class_exists($type)) {
            $table = $type::getCollection();
            return new $type($data, $this->mongodb->$table, $this->cache);
        }
        return null;
    }
203064
public function withType(string $type): self
    {
        $this->type = UserPermissionEnum::ensureValid($type);
        return $this;
    }
226980
public function getRatings(string $type = null): PaginatedResults
    {
        if ($type !== null) {
            if (Rating::isValidRatingType($type) === false) {
                throw new InvalidArgumentException('Invalid rating type');
            }
            $json = $this->parent->performAPICallWithJsonResponse(
                'get',
                '/user/ratings/query',
                ['query' => ['itemType' => $type]]
            );
        } else {
            $json = $this->parent->performAPICallWithJsonResponse('get', '/user/ratings');
        }

        return new PaginatedResults(DataParser::parseDataArray($json, Rating::class), $this->parent->getLastLinks());
    }
503849
public static function factory($type)
    {
        if (isset(self::$transports[$type])) {
            return self::$transports[$type];
        }

        self::$transports[$type] = new Transport($type);
        return self::$transports[$type];
    }
400853
public function setPageType(\Concrete\Core\Page\Type\Type $type = null)
    {
        $ptID = 0;
        if (is_object($type)) {
            $ptID = $type->getPageTypeID();
        }
        $db = Database::connection();
        $db->executeQuery('update Pages set ptID = ? where cID = ?', [$ptID, $this->cID]);
        $this->ptID = $ptID;
    }
50030
public function create(string $type) : ?Controller
    {
        if (\class_exists($type) === false) {
            return $this->fallthrough($type);
        }

        $ref = new \ReflectionClass($type);
        $ctor = $ref->getConstructor();
        if ($ctor === null || $ctor->getNumberOfParameters() === 0) {
            return new $type();
        }

        return $this->fallthrough($type);
    }
483362
public function createLegend($type = 'legend')
  {
    switch ($type)
    {
      case 'legend':
        $tmp = new Legend();
        break;

      default:
        $tmp = new $type();
    }

    $this->legend = $tmp;

    return $tmp;
  }
1159930
public function build($type)
    {
        if (!isset($this->types[$type])) {
            throw new \Exception("Unknown request type.");
        }
        return new $this->types[$type]();
    }
795540
public function create($data)
    {
        $collection = new DescriptorCollection();

        foreach ($data as $type) {
            $collection->add($this->createDescriptorForType($type));
        }

        return $collection;
    }
1097615
public function createNew($type = OrderTypes::TYPE_ORDER)
    {
        $order = parent::createNew();
        $order->setType($type);

        return $order;
    }
435439
public function type($type = null)
    {
        if (is_null($type)) {
            unset($this->filters['post_type']);
        } else {
            $this->filters['post_type'] = $type;
        }
        return $this;
    }
1025383
public function setType($type): self
    {
        if ($type instanceof Type) {
            $this->setIndex($type->getIndex()->getName());
            $type = $type->getName();
        }

        $this->_type = (string) $type;

        return $this;
    }
38247
public function addType($type)
    {
        if (is_string($type)) {
            $type = array($type);
        }

        foreach($type as $typ) {
            if (defined('self::' . strtoupper($typ)) && !in_array($typ, $this->_type)) {
                $this->_type[] = $typ;
            }

            if (($typ == self::ALL)) {
                $this->_type = array_keys($this->_cardLength);
            }
        }

        return $this;
    }