public function addPath($path, $key = null)
    {
        // If path element is subclass of PathLocatorInterface, just put it in path bag.
        // You can create any your Path locator class implements from PathLocatorInterface.
        if ($path instanceof PathLocatorInterface) {
            // Nothing to do
        } elseif (is_string($path) || !$path) {
            // If this element is a path string, we create a PathLocator to wrap it.
            $path = new PathLocator($path);
        } else {
            // If type of this element not match our interface, throw exception.
            throw new \InvalidArgumentException(
                'PathCollection need every path element instance of PathLocatorInterface.'
            );
        }

        if ($key) {
            parent::offsetSet($key, $path);
        } else {
            parent::append($path);
        }

        return $this;
    }