DataSift\Storyplayer\Cli\Feature_TestUsersSupport::loadTestFile PHP Метод

loadTestFile() приватный Метод

private loadTestFile ( $st, $output, $filename, $isReadOnly )
    private function loadTestFile($st, $output, $filename, $isReadOnly)
    {
        // special case - file does not exist
        if (!file_exists($filename)) {
            $output->logCliWarning("test users file '{$filename}' not found");
            // special case
            if ($isReadOnly) {
                $output->logCliWarning("--read-only-users used; Storyplayer will NOT create this file on exit");
                return;
            }
            // general case
            $output->logCliWarning("Storyplayer will create this file when it exits");
            $st->setTestUsersFilename($filename);
            return;
        }
        // special case - file is empty
        if (filesize($filename) == 0) {
            $output->logCliWarning("test users file '{$filename}' is empty");
            $st->setTestUsersFilename($filename);
            return;
        }
        // if we get here, we want to try and load the file
        try {
            usingUsers()->loadUsersFromFile($filename);
            $st->setTestUsersFilename($filename);
        } catch (E5xx_ActionFailed $e) {
            $output->logCliError("could not load test users file '{$filename}'");
            $output->logCliError($e->getMessage());
            exit(1);
        } catch (Exception $e) {
            $output->logCliErrorWithException("could not load test users file '{$filename}'", $e);
            exit(1);
        }
    }