src/Tomahawk/Asset/AssetManager.php
protected function dependencyIsValid($asset, $dependency, $original, $assets)
    {
        if ( ! isset($original[$dependency])) {
            return false;
        }
        else if ($dependency === $asset) {
            throw new SelfDependencyException(sprintf('Asset "%" is dependent on itself.', $asset));
        }
        else if (isset($assets[$dependency]) && in_array($asset, $assets[$dependency]['dependencies'])) {
            throw new CircularDependencyException(sprintf('Assets "%s" and "%s" have a circular dependency.', $asset, $dependency));
        }

        return true;
    }
protected function dependencyIsValid($asset, $dependency, $original, $assets)
    {
        if ( ! isset($original[$dependency])) {
            return false;
        }
        else if ($dependency === $asset) {
            throw new SelfDependencyException(sprintf('Asset "%" is dependent on itself.', $asset));
        }
        else if (isset($assets[$dependency]) && in_array($asset, $assets[$dependency]['dependencies'])) {
            throw new CircularDependencyException(sprintf('Assets "%s" and "%s" have a circular dependency.', $asset, $dependency));
        }

        return true;
    }
Verify that an asset's dependency is valid.

A dependency is considered valid if it exists, is not a circular reference, and is
not a reference to the owning asset itself. If the dependency doesn't exist, no
error or warning will be given. For the other cases, an exception is thrown.

@param  string $asset
@param  string $dependency
@param  array $original
@param  array $assets
@throws SelfDependencyException
@throws CircularDependencyException
@return bool