src/Micrometa/Ports/Item/ItemList.php
public function getFirstItem(...$types)
    {
        $items = $this->getItems(...$types);

        // If there are no matching items
        if (!count($items)) {
            throw new OutOfBoundsException(
                OutOfBoundsException::NO_MATCHING_ITEMS_STR,
                OutOfBoundsException::NO_MATCHING_ITEMS
            );
        }

        return $items[0];
    }
public function getFirstItem(...$types)
    {
        $items = $this->getItems(...$types);

        // If there are no matching items
        if (!count($items)) {
            throw new OutOfBoundsException(
                OutOfBoundsException::NO_MATCHING_ITEMS_STR,
                OutOfBoundsException::NO_MATCHING_ITEMS
            );
        }

        return $items[0];
    }
public function getFirstItem ( ... $ types ) { $ items = $ this -> getItems ( ... $ types ) ; // If there are no matching items if ( ! count ( $ items ) ) { throw new OutOfBoundsException ( OutOfBoundsException :: NO_MATCHING_ITEMS_STR , OutOfBoundsException :: NO_MATCHING_ITEMS ) ; } return $ items [ 0 ] ; }
Return the first item, optionally of particular types

@param array ...$types Item types

@return ItemInterface Item
@throws OutOfBoundsException If there are no matching items
@api
Return the first item optionally of particular types