@throws \RuntimeException

@return array
779085
public function parse() : array
    {
        $fileLines = $this->getFileLines();

        $data = [];

        $currentSection  = '';
        $currentDivision = '';

        for ($line = 0, $count = count($fileLines); $line < $count; ++$line) {
            $currentLine       = ($fileLines[$line]);
            $currentLineLength = mb_strlen($currentLine);

            if (0 === $currentLineLength) {
                continue;
            }

            if (';;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;' === mb_substr($currentLine, 0, 40)) {
                $currentDivision = trim(mb_substr($currentLine, 41));

                continue;
            }

            // We only skip comments that *start* with semicolon
            if (';' === $currentLine[0]) {
                continue;
            }

            if ('[' === $currentLine[0]) {
                $currentSection = mb_substr($currentLine, 1, ($currentLineLength - 2));

                continue;
            }

            $bits = explode('=', $currentLine);

            if (2 < count($bits)) {
                throw new \RuntimeException("Too many equals in line: {$currentLine}, in Division: {$currentDivision}");
            }

            if (2 > count($bits)) {
                $bits[1] = '';
            }

            $data[$currentSection][$bits[0]]   = $bits[1];
            $data[$currentSection]['Division'] = $currentDivision;
        }

        if ($this->shouldSort()) {
            $data = $this->sortArrayAndChildArrays($data);
        }

        $this->data = $data;

        return $data;
    }
383749
private function readRow() : ?array
    {
        $line = @ fgets($this->handle);

        if ($line === false) {
            return null;
        }

        $data = @ json_decode('[' . $line . ']');

        if (json_last_error() !== JSON_ERROR_NONE) {
            throw new \RuntimeException(json_last_error_msg());
        }

        return $data;
    }
1081409
public function getThemesConfig()
    {
        if (empty($this->config['Rcm'])
            || empty($this->config['Rcm']['themes'])
        ) {
            throw new RuntimeException(
                'No Themes found defined in configuration.  Please report the issue
                 with the themes author.'
            );
        }

        return $this->config['Rcm']['themes'];
    }
437950
public function load()
    {
        $shmid = shm_attach($this->sysvKey);
        if ($shmid === false) {
            throw new \RuntimeException(
                'Failed to attach to the shared memory'
            );
        }
        if (!shm_has_var($shmid, self::VAR_KEY)) {
            $result = [null, []];
        } else {
            $result = shm_get_var($shmid, self::VAR_KEY);
        }
        return $result;
    }
968524
public function getResults(array $options = []) : array
    {
        $this->_instance = $this->getReportInstance($options);
        if (null === $this->_instance) {
            return [];
        }

        $config = $this->getReport($options);
        if (empty($config)) {
            return [];
        }

        $this->setConfig($config);
        $this->setContainerId($config);

        $validated = $this->validate($config);

        if (! $validated['status']) {
            throw new RuntimeException("Report validation failed");
        }

        $result = $this->getQueryData($config);

        if (!empty($result)) {
            $this->_instance->getChartData($result);
            $this->setOptions(['scripts' => $this->_instance->getScripts()]);
        }

        return $result;
    }
716479
protected function getPhp()
    {
        if (is_null($this->php_path)) {
            $finder = new PhpExecutableFinder();
            if (!($this->php_path = $finder->find())) {
                throw new \RuntimeException(
                    'The php executable could not be found, add it to your PATH environment variable and try again'
                );
            }
        }

        return $this->php_path;
    }
267852
private function load()
    {
        if (! isset($this->runtime_file_content)) {
            $this->runtime_file_content = json_decode(@file_get_contents($this->getFilePath()), true);
        }

        return $this->runtime_file_content;
    }
1125598
public function run()
    {
        $this->process->run();
        if (!$this->process->isSuccessful()) {
            throw new \RuntimeException($this->process->getErrorOutput());
        }

        return $this->process->getOutput();
    }
618463
public function getContents()
    {
        if (!is_resource($this->stream)) {
            throw new \RuntimeException('Cannot read from empty resource stream');
        }

        $this->rewind();

        $contents = stream_get_contents($this->stream);

        if ($contents === false) {
            throw new \RuntimeException('Unable to read stream contents');
        }

        return $contents;
    }
214916
public function getKey()
    {
        $chunks = array(
            'fileName' => $this->fileName,
        );

        if (!empty($this->statProps)) {
            if (!isset($this->stat)) {
                $this->stat = @stat($this->fileName);
            }

            if ($this->stat === false) {
                throw new RuntimeException(sprintf('Failed to read source file "%s".', $this->fileName));
            }

            foreach ($this->statProps as $prop) {
                $chunks[$prop] = $this->stat[$prop];
            }
        }

        return json_encode($chunks);
    }
980105
public function loadConfig()
    {
        $config = [];

        $configDir = $this->getConfigDir();
        $distConfigDir = $this->getDistConfigDir();

        foreach ($this->configKeys as $configKey) {
            $fullPath = $configDir.'/'.$configKey.'.yml';
            $fullDistPath = $distConfigDir.'/'.$configKey.'.yml';
            $config[$configKey] = [];

            $userConfig = [];
            if ($this->filesystem->exists($fullPath)) {
                $userConfig = Yaml::parse(file_get_contents($fullPath));
            }

            if ($this->filesystem->exists($fullDistPath)) {
                $distConfig = Yaml::parse(file_get_contents($fullDistPath));
            } else {
                throw new \RuntimeException(sprintf(
                    'Could not find dist config at path (%s)',
                    $fullDistPath
                ));
            }

            $config[$configKey] = new Config(array_merge(
                $distConfig,
                $userConfig
            ));
        }

        $this->cachedConfig = $config;

        return $config;
    }
595953
public function asArray()
    {
        return [
            $this->type->getName() => Arrays::arrayMergeRecursiveOverrule([
                'dynamic_templates' => $this->getDynamicTemplates(),
                'properties' => $this->getProperties(),
            ], $this->fullMapping),
        ];
    }
62343
public static function &getComponents(): array
    {
        if (empty(self::$runtimeComponents)) {
            foreach (self::getAddons() as $addon) {
                self::$runtimeComponents = array_merge(self::$runtimeComponents, $addon->getComponents());
            }
        }
        
        return self::$runtimeComponents;
    }
379480
private function getStatus()
    {
        if (!($statusArray = preg_grep('/^HTTP\/(1.0|1.1)\s+(\d+)\s+(.+)/', $this->headers))) {
            throw new \RuntimeException('Could not determine HTTP status from API response');
        }

        if (!preg_match('/^HTTP\/(1.0|1.1)\s+(\d+)\s+(.+)/', $statusArray[0], $matchesArray)) {
            throw new \RuntimeException('Could not determine HTTP status from API response');
        }

        return array(
            'code' => $matchesArray[2],
            'message' => $matchesArray[3],
        );
    }
1180756
public function run(): array
    {
        try {
            $result = null;
            if ($this->match !== false && is_callable($this->match['target']) === true) {
                if (func_num_args() > 0) {
                    foreach (func_get_args() as $argument) {
                        $this->match['params'][] = $argument;
                    }
                } elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) === false) {
                    $this->match['params'][] = $_POST;
                } elseif ($_SERVER['REQUEST_METHOD'] == 'GET' && empty($_GET) === false) {
                    $this->match['params'][] = $_GET;
                } elseif ($_SERVER['REQUEST_METHOD'] == 'PUT') {
                    $_PUT = parse_str(file_get_contents("php://input"));
                    if (empty($_PUT) === false) {
                        $this->match['params'][] = $_PUT;
                    }
                } elseif ($_SERVER['REQUEST_METHOD'] == 'PATCH') {
                    $_PATCH = parse_str(file_get_contents("php://input"));
                    if (empty($_PATCH) === false) {
                        $this->match['params'][] = $_PATCH;
                    }
                }
                $result = call_user_func_array($this->match['target'], $this->match['params']);
            } else {
                throw new \InvalidArgumentException("Method not found");
            }
            return $result;
        } catch (\Throwable $e) {
            if ($e instanceof \InvalidArgumentException) {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 400',
                            true,
                            400
                        ]
                    ],
                    "response" => $e->getMessage()
                ];
            } elseif ($e instanceof \DomainException) {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 422',
                            true,
                            422
                        ]
                    ],
                    "response" => $e->getMessage()
                ];
            } else {
                return [
                    "headers" => [
                        [
                            'X-PHP-Response-Code: 500',
                            true,
                            500
                        ]
                    ],
                    "response" => $e->getMessage()
                ];
            }
        }
    }
1289670
private function parseArgs(): array
    {
        if (null === $this->options && count($this->longopts) === 0 && null === $this->userInput) {
            return $this->fixArgs($_SERVER['argv']);
        }

        if (null !== $this->userInput) {
            $this->collectOptionsFromUserInputClass();
        }

        $parseCommandLineOptions = $this->cliOptionParser;
        $parsedVars = $parseCommandLineOptions($this->options, $this->longopts);
        if (false === $parsedVars) {
            throw new \RuntimeException(
                    'Error parsing "' . join(' ', $_SERVER['argv'])
                    . '" with ' . $this->options
                    . ' and ' . join(' ', $this->longopts)
            );
        }

        return $this->fixArgs($_SERVER['argv'], $parsedVars);
    }
742998
public function getExecTasks(): array
    {
        $data = [];
        $runTimeTableTasks = $this->getRunTimeTable()->table;
        if (\count($runTimeTableTasks) <= 0) {
            return $data;
        }

        $min = date('YmdHi');

        foreach ($runTimeTableTasks as $key => $value) {
            if ($value['minute'] == $min) {
                if (time() == $value['sec'] && $value['runStatus'] == self::NORMAL) {
                    $data[] = [
                        'key'        => $key,
                        'taskClass'  => $value['taskClass'],
                        'taskMethod' => $value['taskMethod'],
                    ];
                }
            }
        }

        foreach ($data as $item) {
            $this->startTask($item['key']);
        }

        return $data;
    }