Stop timing on selected item and return instance of this item

@param string $name

@return Item
@throws \InvalidArgumentException
342991
public function stop(?string $name = null): Item
    {
        $name = $name ?? self::BASE_ITEM;
        $item = $this->items[$name] ?? null;

        if (null !== $item) {
            unset($this->activeItems[$name]);

            return $item->stop();
        }

        throw new \InvalidArgumentException(sprintf('Item with name %s not found!', $name));
    }
371952
public function unlock($name)
    {
        if (!$this->has($name)) {
            throw new ItemNotFoundException($name);
        }

        unset($this->locked[$name]);

        return $this;
    }
1115029
public static function getInstance(string $name)
    {
        if (!isset(self::$instances[$name]) || empty(self::$instances[$name])) {
            new static($name);
        }
        return (self::$instances[$name]);
    }
273839
public function find($name)
    {
        if ($this->is_registered($name)) {
            return $this->items[$name];
        }
        $model = $this->adaptor->getModel($name);
        if ($model) {
            return $model;
        }
        throw new \InvalidArgumentException("{$name} not registered");
    }
893673
public function spawn(string $name): Scope
    {
        $scope = new Scope($name);
        $scope->parent = $this;
        $this->children[]= $scope;

        return $scope;
    }
1010337
public function pop($name)
    {
        $previousValue = $this->get($name);

        $value = array_pop($previousValue);

        $this->create($name, $previousValue);

        return $value;
    }
395456
public function start($name = null): self
    {
        if (null !== $name) {
            $this->items[$name] = clone $this->items[self::BASE_ITEM];
            $this->activeItems[$name] = $item = $this->items[$name] ?? new Item($name);
            $item->start($name);

            return $this;
        }

        $this->activeItems[self::BASE_ITEM] = $item = $this->items[self::BASE_ITEM];
        $item->start(self::BASE_ITEM);

        return $this;
    }
175525
public function setSelected(string $name)
    {
        return $this->transform(function (Item $item) use ($name) {
            return $item->setSelected($name);
        });
    }
1038391
public function get(string $name, $default = null)
    {
        if ( ! $this->has($name)) {
            throw new \RuntimeException('No item "' . $name . '" exists in the registry.');
        }

        return Arr::get($this->registry, $name, $default);
    }
1295673
public function get($name)
    {
        if (! $this->has($name)) throw new \InvalidArgumentException('no such task');

        $task = new Task($this, $this->getReflection()->getMethod($name . 'Task'));
        return $task;
    }
1175297
public static function getInstance($name=null) {
		if( !$name ) {
			$name = 'default';
		}
		if( !isset(static::$instances[$name]) ) {
			static::make($name);
		}
		return static::$instances[$name];
	}
181789
protected function removeItemWithoutPriority(string $name): self
    {
        foreach ($this->items as $priority => $items) {
            if (isset($items[$name])) {
                unset($this->items[$priority][$name]);
            }
        }

        return $this;
    }
703397
public function _get($name)
    {
        $getMethod = 'get' . ucfirst($name);
        if (method_exists($this, $getMethod)) {
            return $this->$getMethod();
        }
        throw new \InvalidArgumentException(sprintf('Getter does not exist for "%s" property', $name));
    }
1200131
public function get($name)
    {
        if (!$this->has($name)) {
            throw new ItemNotFoundException($name);
        }

        return $this->items[$name];
    }
933171
public function setSelected(string $name)
    {
        $this->selected = ($this->name === $name);
        $this->children->setSelected($name);

        return $this;
    }
483321
public function pop($name)
    {
        $queue = $this->getInstance($name);
        return $queue->isEmpty() ? false : $queue->dequeue();
    }
342647
public function getOption($name) {
    if (!array_key_exists($name, $this->options)) {
      throw new InvalidArgumentException(sprintf('Undefined option: "%s"', $name));
    }

    return $this->options[$name];
  }