original_string: protected function createFixtures(array $fixtures)
      {
          // normalize fixture configurations
          $config = [];  // configuration provided in test case
          $aliases = [];  // class name => alias or class name
  
          foreach ($fixtures as $name => $fixture) {
              if (!is_array($fixture)) {
                  $class = ltrim($fixture, '\\');
                  $fixtures[$name] = ['class' => $class];
                  $aliases[$class] = is_int($name) ? $class : $name;
              } elseif (isset($fixture['class'])) {
                  $class = ltrim($fixture['class'], '\\');
                  $config[$class] = $fixture;
                  $aliases[$class] = $name;
              } else {
                  throw new InvalidConfigException("You must specify 'class' for the fixture '$name'.");
              }
          }
  
          // create fixture instances
          $instances = [];
          $stack = array_reverse($fixtures);
  
          while (($fixture = array_pop($stack)) !== null) {
              if ($fixture instanceof Fixture) {
                  $class = get_class($fixture);
                  $name = isset($aliases[$class]) ? $aliases[$class] : $class;
                  unset($instances[$name]);  // unset so that the fixture is added to the last in the next line
                  $instances[$name] = $fixture;
              } else {
                  $class = ltrim($fixture['class'], '\\');
                  $name = isset($aliases[$class]) ? $aliases[$class] : $class;
                  if (!isset($instances[$name])) {
                      $instances[$name] = false;
  
                      $stack[] = $fixture = app()->make($fixture['class']);
                      foreach ($fixture->depends as $dep) {
                          // need to use the configuration provided in test case
                          $stack[] = isset($config[$dep]) ? $config[$dep] : ['class' => $dep];
                      }
                  } elseif ($instances[$name] === false) {
                      throw new InvalidConfigException("A circular dependency is detected for fixture '$class'.");
                  }
              }
          }
  
          return $instances;
      }
code: protected function createFixtures(array $fixtures)
      {
          // normalize fixture configurations
          $config = [];  // configuration provided in test case
          $aliases = [];  // class name => alias or class name
  
          foreach ($fixtures as $name => $fixture) {
              if (!is_array($fixture)) {
                  $class = ltrim($fixture, '\\');
                  $fixtures[$name] = ['class' => $class];
                  $aliases[$class] = is_int($name) ? $class : $name;
              } elseif (isset($fixture['class'])) {
                  $class = ltrim($fixture['class'], '\\');
                  $config[$class] = $fixture;
                  $aliases[$class] = $name;
              } else {
                  throw new InvalidConfigException("You must specify 'class' for the fixture '$name'.");
              }
          }
  
          // create fixture instances
          $instances = [];
          $stack = array_reverse($fixtures);
  
          while (($fixture = array_pop($stack)) !== null) {
              if ($fixture instanceof Fixture) {
                  $class = get_class($fixture);
                  $name = isset($aliases[$class]) ? $aliases[$class] : $class;
                  unset($instances[$name]);  // unset so that the fixture is added to the last in the next line
                  $instances[$name] = $fixture;
              } else {
                  $class = ltrim($fixture['class'], '\\');
                  $name = isset($aliases[$class]) ? $aliases[$class] : $class;
                  if (!isset($instances[$name])) {
                      $instances[$name] = false;
  
                      $stack[] = $fixture = app()->make($fixture['class']);
                      foreach ($fixture->depends as $dep) {
                          // need to use the configuration provided in test case
                          $stack[] = isset($config[$dep]) ? $config[$dep] : ['class' => $dep];
                      }
                  } elseif ($instances[$name] === false) {
                      throw new InvalidConfigException("A circular dependency is detected for fixture '$class'.");
                  }
              }
          }
  
          return $instances;
      }
code_tokens: protected function createFixtures ( array $ fixtures ) { // normalize fixture configurations $ config = [ ] ; // configuration provided in test case $ aliases = [ ] ; // class name => alias or class name foreach ( $ fixtures as $ name => $ fixture ) { if ( ! is_array ( $ fixture ) ) { $ class = ltrim ( $ fixture , '\\' ) ; $ fixtures [ $ name ] = [ 'class' => $ class ] ; $ aliases [ $ class ] = is_int ( $ name ) ? $ class : $ name ; } elseif ( isset ( $ fixture [ 'class' ] ) ) { $ class = ltrim ( $ fixture [ 'class' ] , '\\' ) ; $ config [ $ class ] = $ fixture ; $ aliases [ $ class ] = $ name ; } else { throw new InvalidConfigException ( "You must specify 'class' for the fixture '$name'." ) ; } } // create fixture instances $ instances = [ ] ; $ stack = array_reverse ( $ fixtures ) ; while ( ( $ fixture = array_pop ( $ stack ) ) !== null ) { if ( $ fixture instanceof Fixture ) { $ class = get_class ( $ fixture ) ; $ name = isset ( $ aliases [ $ class ] ) ? $ aliases [ $ class ] : $ class ; unset ( $ instances [ $ name ] ) ; // unset so that the fixture is added to the last in the next line $ instances [ $ name ] = $ fixture ; } else { $ class = ltrim ( $ fixture [ 'class' ] , '\\' ) ; $ name = isset ( $ aliases [ $ class ] ) ? $ aliases [ $ class ] : $ class ; if ( ! isset ( $ instances [ $ name ] ) ) { $ instances [ $ name ] = false ; $ stack [ ] = $ fixture = app ( ) -> make ( $ fixture [ 'class' ] ) ; foreach ( $ fixture -> depends as $ dep ) { // need to use the configuration provided in test case $ stack [ ] = isset ( $ config [ $ dep ] ) ? $ config [ $ dep ] : [ 'class' => $ dep ] ; } } elseif ( $ instances [ $ name ] === false ) { throw new InvalidConfigException ( "A circular dependency is detected for fixture '$class'." ) ; } } } return $ instances ; }
docstring: Creates the specified fixture instances.
  All dependent fixtures will also be created.
  
  @param array $fixtures the fixtures to be created. You may provide fixture names or fixture configurations.
  If this parameter is not provided, the fixtures specified in [[globalFixtures()]] and [[fixtures()]] will be created.
  
  @throws InvalidConfigException if fixtures are not properly configured or if a circular dependency among
  the fixtures is detected
  
  @return Fixture[] the created fixture instances
docstring_tokens: Creates the specified fixture instances . All dependent fixtures will also be created .