@param string[] $fixtures An array of fixtures with class names as keys

@throws RuntimeException
557072
private function validateDependencies(array $fixtures, FixtureInterface $fixture) : void
    {
        if (! $fixture instanceof DependentFixtureInterface) {
            return;
        }

        $dependenciesClasses = $fixture->getDependencies();

        foreach ($dependenciesClasses as $class) {
            if (! array_key_exists($class, $fixtures)) {
                throw new RuntimeException(sprintf('Fixture "%s" was declared as a dependency for fixture "%s", but it was not included in any of the loaded fixture groups.', $class, get_class($fixture)));
            }
        }
    }
909385
private function importTable(string $tableName, array $columns, array $items)
    {
        if (empty($tableName) || empty($columns) || empty($items)) {
            throw new \RuntimeException(
                'Invalid import data',
                1535487373
            );
        }

        $this->connection->truncate($tableName);

        $columnNames = array_keys($columns);
        $columnTypes = array_values($columns);
        foreach ($items as $item) {
            $this->connection->insert(
                $tableName,
                array_combine($columnNames, $item),
                $columns
            );
        }
    }
891134
public function attach(EventManagerInterface $events)
    {
        foreach ($this->eventMap as $eventName => $items) {
            if (!is_array($items)) {
                $errMsg = 'Handlers config not array';
                throw new Exception\RuntimeException($errMsg);
            }

            foreach ($items as $item) {
                if (!is_array($item)) {
                    $errMsg = 'Handler not array';
                    throw new Exception\RuntimeException($errMsg);
                }

                if (!array_key_exists('handler', $item)) {
                    $errMsg = 'Handler not found';
                    throw new Exception\RuntimeException($errMsg);
                }
                $handler = $item['handler'];

                $priority = 1;
                if (array_key_exists('priority', $item)) {
                    $priority = (integer)$priority;
                }

                $this->listeners[] = $events->attach($eventName, $handler, $priority);
            }
        }
    }
964515
private function validateReferences(array $arguments)
    {
        foreach ($arguments as $argument) {
            if (is_array($argument)) {
                $this->validateReferences($argument);
            } elseif ($argument instanceof Reference) {
                $targetDefinition = $this->getDefinition((string) $argument);

                if (null !== $targetDefinition && $targetDefinition->isAbstract()) {
                    throw new RuntimeException(sprintf(
                        'The definition "%s" has a reference to an abstract definition "%s". '
                       .'Abstract definitions cannot be the target of references.',
                       $this->currentId,
                       $argument
                    ));
                }
            }
        }
    }
507949
public function addChildren(array $children)
    {
        if ($this->isVoid) {
            throw new Exception\RuntimeException(
                'Void elements can\'t have child elements.'
            );
        }

        foreach ($children as $child) {
            $this->addChild($child);
        }

        return $this;
    }
805481
public static function set(array &$array, ...$keys): void
    {
        if (\count($keys) < 2) {
            throw new \InvalidArgumentException('Method `Collection::set()` is required minimum one key and value');
        }

        $value = array_pop($keys);
        while (\count($keys) > 1) {
            $key = array_shift($keys);
            if (!isset($array[$key]) || !\is_array($array[$key])) {
                $array[$key] = [];
            }
            $array = &$array[$key];
        }
        $array[array_shift($keys)] = $value;
    }
417955
public function setClassNames(array $classNames): void
    {
        $this->classNames = count($classNames) > 0 ? array_combine($classNames, array_fill(0, count($classNames), true)) : [];
    }
502701
public function populateObjects(DataObject $object, $data, $fixtures)
    {
        // Populate Objects:
        
        foreach ($data as $name => $value) {
            
            // Detect Object:
            
            if ($this->isObject($object, $name)) {
                
                // Trim Name:
                
                $name = ltrim($name, '->');
                
                // Populate Object:
                
                if ($subObject = $object->$name) {
                    
                    foreach ($value as $k => $v) {
                        $subObject->$k = $v;
                    }
                    
                    $subObject->write();
                    
                }
                
            }
            
        }
    }
65629
public function setTables($tables) {
		foreach($tables as $key=>$value) {
			if (is_numeric($key)) {
				$this->tables[] = $value;
			}
			else {
				$this->tables[] = $key;
				$this->columns[$key] = $value;
			}
		}
		$this->cacheTables = true;
	}
553614
public function load(array $paths)
    {
        $finder = new Finder();
        $finder->in($paths);
        $finder->name('*Fixture.php');

        foreach ($finder as $file) {
            $declaredClasses = get_declared_classes();
            require_once $file;
            $declaredClassesDiff = array_diff(get_declared_classes(), $declaredClasses);
            $fixtureClass = array_pop($declaredClassesDiff);

            if (!$fixtureClass) {
                throw new \InvalidArgumentException(sprintf(
                    'Could not determine class from included file "%s". Class detection will only work once per request.',
                    $file
                ));
            }

            $refl = new \ReflectionClass($fixtureClass);

            if ($refl->isAbstract()) {
                continue;
            }

            if (false === $refl->isSubclassOf(DocumentFixtureInterface::class)) {
                continue;
            }

            $fixture = new $fixtureClass();

            if ($fixture instanceof ContainerAwareInterface) {
                $fixture->setContainer($this->container);
            }

            $fixtures[] = $fixture;
        }

        usort($fixtures, function(DocumentFixtureInterface $fixture1, DocumentFixtureInterface $fixture2) {
            return $fixture1->getOrder() > $fixture2->getOrder();
        });

        return $fixtures;
    }
1329437
public function applyFixtures(TableNode $fixtures) {
    $fixtures = $fixtures->getColumn(0);
    $dataSet = new CompositeDataSet();
    foreach ($fixtures as $fixture) {
      $dataSet->addDataSet($this->fixtures->createMySQLXMLDataSet($fixture));
    }
    $this->fixtures->applyDataSet($dataSet);
  }
414832
public function load(array $fixturesFiles, array $parameters = [], array $objects = [], PurgeMode $purgeMode = null): array
    {
        if (null === $purgeMode) {
            $purgeMode = $this->defaultPurgeMode;
        }

        if ($purgeMode != PurgeMode::createNoPurgeMode()) {
            $this->logger->info(
                sprintf(
                    'Purging database with purge mode "%s".',
                    (string) $purgeMode
                )
            );

            $purger = $this->purgerFactory->create($purgeMode);
            $purger->purge();
        }

        return $this->loader->load($fixturesFiles, $parameters, $objects, $purgeMode);
    }
637230
public function setFixtures($table, $fixtures, $generator = null, $baseIndex = 0)
    {
        $loading = $this->currentSession->into($table);
        if ($generator) {
            $loading = $loading->with($generator);
        }
        return $loading->load($fixtures, $baseIndex);
    }
665862
private function processFixture(SplFileInfo $fixture, array &$tests): void
    {
        $key = (string) sha1_file($fixture->getPathname());
        if ($this->cache->has($key)) {
            $records = $this->cache->get($key);

            foreach ($records as $ua => $data) {
                $ua = addcslashes($ua, "\n");
                if (!isset($tests[$ua])) {
                    $tests[$ua] = [
                        'device' => [
                            'deviceName'    => null,
                            'marketingName' => null,
                            'manufacturer'  => null,
                            'brand'         => null,
                            'display'       => [
                                'width'  => null,
                                'height' => null,
                                'touch'  => null,
                                'type'   => null,
                                'size'   => null,
                            ],
                            'dualOrientation' => null,
                            'type'            => null,
                            'simCount'        => null,
                            'market'          => [
                                'regions'   => null,
                                'countries' => null,
                                'vendors'   => null,
                            ],
                            'connections' => null,
                            'ismobile'    => null,
                        ],
                        'browser' => [
                            'name'         => null,
                            'modus'        => null,
                            'version'      => null,
                            'manufacturer' => null,
                            'bits'         => null,
                            'type'         => null,
                            'isbot'        => null,
                        ],
                        'platform' => [
                            'name'          => null,
                            'marketingName' => null,
                            'version'       => null,
                            'manufacturer'  => null,
                            'bits'          => null,
                        ],
                        'engine' => [
                            'name'         => null,
                            'version'      => null,
                            'manufacturer' => null,
                        ],
                    ];
                }

                $tests[$ua] = array_replace_recursive($tests[$ua], $data);
            }
        } else {
            $provider = Yaml::parse($fixture->getContents());

            $records = [];

            foreach ($provider['test_cases'] as $data) {
                $ua = $data['user_agent_string'];
                if (!empty($ua)) {
                    if (isset($tests[addcslashes($ua, "\n")])) {
                        $browser  = $tests[$ua]['browser'];
                        $platform = $tests[$ua]['platform'];
                        $device   = $tests[$ua]['device'];
                        $engine   = $tests[$ua]['engine'];
                    } else {
                        $browser = [
                            'name'         => null,
                            'modus'        => null,
                            'version'      => null,
                            'manufacturer' => null,
                            'bits'         => null,
                            'type'         => null,
                            'isbot'        => null,
                        ];

                        $platform = [
                            'name'          => null,
                            'marketingName' => null,
                            'version'       => null,
                            'manufacturer'  => null,
                            'bits'          => null,
                        ];

                        $device = [
                            'deviceName'       => null,
                            'marketingName'    => null,
                            'manufacturer'     => null,
                            'brand'            => null,
                            'pointingMethod'   => null,
                            'resolutionWidth'  => null,
                            'resolutionHeight' => null,
                            'dualOrientation'  => null,
                            'type'             => null,
                            'ismobile'         => null,
                        ];

                        $engine = [
                            'name'         => null,
                            'version'      => null,
                            'manufacturer' => null,
                        ];
                    }

                    switch ($fixture->getFilename()) {
                        case 'test_device.yaml':
                            $device = [
                                'name'     => $data['model'],
                                'brand'    => $data['brand'],
                                'type'     => null,
                                'ismobile' => null,
                            ];

                            $records[$ua]['device'] = $device;

                            break;
                        case 'test_os.yaml':
                        case 'additional_os_tests.yaml':
                            $platform = [
                                'name'    => $data['family'],
                                'version' => $data['major'] . (!empty($data['minor']) ? '.' . $data['minor'] : ''),
                            ];

                            $records[$ua]['platform'] = $platform;

                            break;
                        case 'test_ua.yaml':
                        case 'firefox_user_agent_strings.yaml':
                        case 'opera_mini_user_agent_strings.yaml':
                        case 'pgts_browser_list.yaml':
                            $browser = [
                                'name'    => $data['family'],
                                'version' => $data['major'] . (!empty($data['minor']) ? '.' . $data['minor'] : ''),
                            ];

                            $records[$ua]['browser'] = $browser;

                            break;
                    }

                    $expected = [
                        'browser'  => $browser,
                        'platform' => $platform,
                        'device'   => $device,
                        'engine'   => $engine,
                    ];

                    $tests[addcslashes($ua, "\n")] = $expected;
                }
            }

            $this->cache->set($key, $records);
        }
    }
749422
public static function setNames(array $names)
    {
        if(static::$isInited)
        {
            throw new \RuntimeException('addName failed, ChannelManager was inited');
        }
        foreach($names as $key => $args)
        {
            static::$channels[$key] = $args;
        }
    }
884197
public function execute(array $variables = null)
    {
        if (null === $variables) {
            $variables = $_SERVER;
        }

        $arguments = $this->arguments($variables);
        if (count($arguments) < 1) {
            throw new RuntimeException('No arguments provided.');
        }

        switch ($arguments[0]) {
            case '-h':
            case '--help':
                $this->executeUsage();

                return;

            case '-v':
            case '--version':
                $this->executeVersion();

                return;
        }

        $this->executeLaunch($arguments);
    }
759159
public function setEventClasses($events)
    {
        foreach ($events as $iface => $cls) {
            $this->setEventClass($iface, $cls);
        }
    }