original_string: protected function dependencyIsValid(
          string $asset,
          string $dependency,
          array $original,
          array $assets
      ): bool {
          // Determine if asset and dependency is circular.
          $isCircular = function ($asset, $dependency, $assets) {
              return isset($assets[$dependency]) && \in_array($asset, $assets[$dependency]['dependencies']);
          };
  
          if (! isset($original[$dependency])) {
              return false;
          } elseif ($dependency === $asset) {
              throw new RuntimeException("Asset [$asset] is dependent on itself.");
          } elseif ($isCircular($asset, $dependency, $assets)) {
              throw new RuntimeException("Assets [$asset] and [$dependency] have a circular dependency.");
          }
  
          return true;
      }
code: protected function dependencyIsValid(
          string $asset,
          string $dependency,
          array $original,
          array $assets
      ): bool {
          // Determine if asset and dependency is circular.
          $isCircular = function ($asset, $dependency, $assets) {
              return isset($assets[$dependency]) && \in_array($asset, $assets[$dependency]['dependencies']);
          };
  
          if (! isset($original[$dependency])) {
              return false;
          } elseif ($dependency === $asset) {
              throw new RuntimeException("Asset [$asset] is dependent on itself.");
          } elseif ($isCircular($asset, $dependency, $assets)) {
              throw new RuntimeException("Assets [$asset] and [$dependency] have a circular dependency.");
          }
  
          return true;
      }
code_tokens: protected function dependencyIsValid ( string $ asset , string $ dependency , array $ original , array $ assets ) : bool { // Determine if asset and dependency is circular. $ isCircular = function ( $ asset , $ dependency , $ assets ) { return isset ( $ assets [ $ dependency ] ) && \ in_array ( $ asset , $ assets [ $ dependency ] [ 'dependencies' ] ) ; } ; if ( ! isset ( $ original [ $ dependency ] ) ) { return false ; } elseif ( $ dependency === $ asset ) { throw new RuntimeException ( "Asset [$asset] is dependent on itself." ) ; } elseif ( $ isCircular ( $ asset , $ dependency , $ assets ) ) { throw new RuntimeException ( "Assets [$asset] and [$dependency] have a circular dependency." ) ; } return true ; }
docstring: 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 \RuntimeException
  
  @return bool
docstring_tokens: Verify that an asset s dependency is valid .