protected function guardType($items) : void {
        // this allows guardType($items) to receive
        // both a single item or an array of items
        if ( ! is_array($items)) {
            $items = array($items);
        }

        // throw an exception if any items are not
        // an instance of the required type
        foreach ($items as $item) {
            if ( ! $item instanceof $this->collectionType) {
                throw new \InvalidArgumentException(
                    "Got " . (is_object($item) ? get_class($item) : $item) . " but expected " . $this->collectionType
                );
            }
        }
    }