public function hydrate($objectClass, array $data, $indexOfBy = false)
    {
        $this->objectClass = $objectClass;

        if (0 == count($data)) {

            yield $this->createObjectToHydrate($this->objectClass);
        } elseif (! is_array(current($data))) {

            yield $this->hydrateItem($this->objectClass, $data);
        } elseif (false === $indexOfBy) {

            foreach ($data as $item) {
                yield $this->hydrateItem($this->objectClass, $item);
            }
        } else {

            foreach ($this->hydrateBy($data, $indexOfBy) as $valueOfBy => $item) {
                yield $valueOfBy => $item;
            }
        }
    }