当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper\Lang类代码示例

本文整理汇总了PHP中PHPCI\Helper\Lang的典型用法代码示例。如果您正苦于以下问题:PHP Lang类的具体用法?PHP Lang怎么用?PHP Lang使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Lang类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * Parse a given TAP format string and return an array of tests and their status.
  */
 public function parse()
 {
     // Split up the TAP string into an array of lines, then
     // trim all of the lines so there's no leading or trailing whitespace.
     $lines = explode("\n", $this->tapString);
     $lines = array_map(function ($line) {
         return trim($line);
     }, $lines);
     // Check TAP version:
     $versionLine = array_shift($lines);
     if ($versionLine != 'TAP version 13') {
         throw new \Exception(Lang::get('tap_version'));
     }
     if (isset($lines[count($lines) - 1]) && preg_match(self::TEST_COVERAGE_PATTERN, $lines[count($lines) - 1])) {
         array_pop($lines);
         if ($lines[count($lines) - 1] == "") {
             array_pop($lines);
         }
     }
     $matches = array();
     $totalTests = 0;
     if (preg_match(self::TEST_COUNTS_PATTERN, $lines[0], $matches)) {
         array_shift($lines);
         $totalTests = (int) $matches[2];
     }
     if (isset($lines[count($lines) - 1]) && preg_match(self::TEST_COUNTS_PATTERN, $lines[count($lines) - 1], $matches)) {
         array_pop($lines);
         $totalTests = (int) $matches[2];
     }
     $rtn = $this->processTestLines($lines);
     if ($totalTests != count($rtn)) {
         throw new \Exception(Lang::get('tap_error'));
     }
     return $rtn;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:38,代码来源:TapParser.php

示例2: execute

 /**
  * Run the Atoum plugin.
  * @return bool
  */
 public function execute()
 {
     $cmd = $this->executable;
     if ($this->args !== null) {
         $cmd .= " {$this->args}";
     }
     if ($this->config !== null) {
         $cmd .= " -c '{$this->config}'";
     }
     if ($this->directory !== null) {
         $dirPath = $this->phpci->buildPath . DIRECTORY_SEPARATOR . $this->directory;
         $cmd .= " -d '{$dirPath}'";
     }
     chdir($this->phpci->buildPath);
     $output = '';
     $status = true;
     exec($cmd, $output);
     if (count(preg_grep("/Success \\(/", $output)) == 0) {
         $status = false;
         $this->phpci->log($output);
     }
     if (count($output) == 0) {
         $status = false;
         $this->phpci->log(Lang::get('no_tests_performed'));
     }
     return $status;
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:31,代码来源:Atoum.php

示例3: execute

 /**
  * Runs PHP Copy/Paste Detector in a specified directory.
  */
 public function execute()
 {
     $ignore = '';
     if (count($this->phpci->ignore)) {
         $map = function ($item) {
             return ' --exclude ' . (substr($item, -1) == '/' ? substr($item, 0, -1) : $item);
         };
         $ignore = array_map($map, $this->phpci->ignore);
         $ignore = implode('', $ignore);
     }
     $phploc = $this->phpci->findBinary('phploc');
     if (!$phploc) {
         $this->phpci->logFailure(PHPCI\Helper\Lang::get('could_not_find', 'phploc'));
         return false;
     }
     $success = $this->phpci->executeCommand($phploc . ' %s "%s"', $ignore, $this->directory);
     $output = $this->phpci->getLastOutput();
     if (preg_match_all('/\\((LOC|CLOC|NCLOC|LLOC)\\)\\s+([0-9]+)/', $output, $matches)) {
         $data = array();
         foreach ($matches[1] as $k => $v) {
             $data[$v] = (int) $matches[2][$k];
         }
         $this->build->storeMeta('phploc', $data);
     }
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:29,代码来源:PhpLoc.php

示例4: testLang_UseDefaultFormat

 public function testLang_UseDefaultFormat()
 {
     $dateTime = $this->prophesize('DateTime');
     $dateTime->format(DateTime::ISO8601)->willReturn("ISODATE");
     $dateTime->format(DateTime::RFC2822)->willReturn("RFCDATE");
     $this->assertEquals('<time datetime="ISODATE" data-format="lll">RFCDATE</time>', Lang::formatDateTime($dateTime->reveal()));
 }
开发者ID:stefanius,项目名称:phpci-box,代码行数:7,代码来源:LangTest.php

示例5: execute

 /**
  * Runs Pdepend with the given criteria as arguments
  */
 public function execute()
 {
     if (!is_writable($this->location)) {
         throw new \Exception(sprintf('The location %s is not writable.', $this->location));
     }
     $pdepend = $this->phpci->findBinary('pdepend');
     if (!$pdepend) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'pdepend'));
         return false;
     }
     $cmd = $pdepend . ' --summary-xml="%s" --jdepend-chart="%s" --overview-pyramid="%s" %s "%s"';
     $this->removeBuildArtifacts();
     // If we need to ignore directories
     if (count($this->phpci->ignore)) {
         $ignore = ' --ignore=' . implode(',', $this->phpci->ignore);
     } else {
         $ignore = '';
     }
     $success = $this->phpci->executeCommand($cmd, $this->location . DIRECTORY_SEPARATOR . $this->summary, $this->location . DIRECTORY_SEPARATOR . $this->chart, $this->location . DIRECTORY_SEPARATOR . $this->pyramid, $ignore, $this->directory);
     $config = $this->phpci->getSystemConfig('phpci');
     if ($success) {
         $this->phpci->logSuccess(sprintf("Pdepend successful. You can use %s\n, ![Chart](%s \"Pdepend Chart\")\n\n                    and ![Pyramid](%s \"Pdepend Pyramid\")\n\n                    for inclusion in the readme.md file", $config['url'] . '/build/pdepend/' . $this->summary, $config['url'] . '/build/pdepend/' . $this->chart, $config['url'] . '/build/pdepend/' . $this->pyramid));
     }
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:28,代码来源:Pdepend.php

示例6: execute

 /**
  * Runs PHP Spec tests.
  */
 public function execute()
 {
     $curdir = getcwd();
     chdir($this->phpci->buildPath);
     $phpspec = $this->phpci->findBinary(array('phpspec', 'phpspec.php'));
     if (!$phpspec) {
         $this->phpci->logFailure(PHPCI\Helper\Lang::get('could_not_find', 'phpspec'));
         return false;
     }
     $success = $this->phpci->executeCommand($phpspec . ' --format=junit --no-code-generation run');
     $output = $this->phpci->getLastOutput();
     chdir($curdir);
     /*
      * process xml output
      *
      * <testsuites time=FLOAT tests=INT failures=INT errors=INT>
      *   <testsuite name=STRING time=FLOAT tests=INT failures=INT errors=INT skipped=INT>
      *     <testcase name=STRING time=FLOAT classname=STRING status=STRING/>
      *   </testsuite>
      * </testsuites
      */
     $xml = new \SimpleXMLElement($output);
     $attr = $xml->attributes();
     $data = array('time' => (double) $attr['time'], 'tests' => (int) $attr['tests'], 'failures' => (int) $attr['failures'], 'errors' => (int) $attr['errors'], 'suites' => array());
     /**
      * @var \SimpleXMLElement $group
      */
     foreach ($xml->xpath('testsuite') as $group) {
         $attr = $group->attributes();
         $suite = array('name' => (string) $attr['name'], 'time' => (double) $attr['time'], 'tests' => (int) $attr['tests'], 'failures' => (int) $attr['failures'], 'errors' => (int) $attr['errors'], 'skipped' => (int) $attr['skipped'], 'cases' => array());
         /**
          * @var \SimpleXMLElement $child
          */
         foreach ($group->xpath('testcase') as $child) {
             $attr = $child->attributes();
             $case = array('name' => (string) $attr['name'], 'classname' => (string) $attr['classname'], 'time' => (double) $attr['time'], 'status' => (string) $attr['status']);
             if ($case['status'] == 'failed') {
                 $error = array();
                 /*
                  * ok, sad, we had an error
                  *
                  * there should be one - foreach makes this easier
                  */
                 foreach ($child->xpath('failure') as $failure) {
                     $attr = $failure->attributes();
                     $error['type'] = (string) $attr['type'];
                     $error['message'] = (string) $attr['message'];
                 }
                 foreach ($child->xpath('system-err') as $system_err) {
                     $error['raw'] = (string) $system_err;
                 }
                 $case['error'] = $error;
             }
             $suite['cases'][] = $case;
         }
         $data['suites'][] = $suite;
     }
     $this->build->storeMeta('phpspec', $data);
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:63,代码来源:PhpSpec.php

示例7: execute

 /**
  *
  * Moves the static analysis log files into doc root before the build is destroyed
  *
  * @return bool
  * @throws \Exception
  */
 public function execute()
 {
     $srcDir = $this->build->getBuildPath() . '/build/logs/report';
     $destDir = APPLICATION_PATH . 'public/reports';
     $result = exec(sprintf(IS_WIN ? 'rmdir /S /Q "%s"' : 'rm -Rf "%s"', $destDir), $output, $exitStatus);
     // Non-zero status is an error scenario
     if ($exitStatus !== 0) {
         // Wipe failed - exception here
         throw new \Exception(Lang::get('failed_to_wipe', $destDir));
     }
     $moveResult = false;
     if (!is_dir($destDir)) {
         $moveResult = rename($srcDir, $destDir);
     }
     switch ($moveResult) {
         case true:
             $logMessage = "Coverage reports deployed at ";
             $logMessage .= "{$this->reportUrl}";
             $this->phpci->logSuccess($logMessage);
             break;
         default:
             $logMessage = "Oopsies";
             $this->phpci->logFailure($logMessage);
             break;
     }
     return true;
 }
开发者ID:vanqard,项目名称:PHPCI,代码行数:34,代码来源:DeployStaticAnalysis.php

示例8: createBuild

 /**
  * @param Project $project
  * @param string|null $commitId
  * @param string|null $branch
  * @param string|null $committerEmail
  * @param string|null $commitMessage
  * @param string|null $extra
  * @return \PHPCI\Model\Build
  */
 public function createBuild(Project $project, $commitId = null, $branch = null, $committerEmail = null, $commitMessage = null, $extra = null)
 {
     $build = new Build();
     $build->setCreated(new \DateTime());
     $build->setProject($project);
     $build->setStatus(0);
     if (!is_null($commitId)) {
         $build->setCommitId($commitId);
     } else {
         $build->setCommitId('Manual');
         $build->setCommitMessage(Lang::get('manual_build'));
     }
     if (!is_null($branch)) {
         $build->setBranch($branch);
     } else {
         $build->setBranch($project->getBranch());
     }
     if (!is_null($committerEmail)) {
         $build->setCommitterEmail($committerEmail);
     }
     if (!is_null($commitMessage)) {
         $build->setCommitMessage($commitMessage);
     }
     if (!is_null($extra)) {
         $build->setExtra(json_encode($extra));
     }
     return $this->buildStore->save($build);
 }
开发者ID:nelsonyang0710,项目名称:PHPCI,代码行数:37,代码来源:BuildService.php

示例9: execute

 /**
  * Connects to MySQL and runs a specified set of queries.
  */
 public function execute()
 {
     $addresses = $this->getEmailAddresses();
     // Without some email addresses in the yml file then we
     // can't do anything.
     if (count($addresses) == 0) {
         return false;
     }
     $subjectTemplate = "PHPCI - %s - %s";
     $projectName = $this->phpci->getBuildProjectTitle();
     $logText = $this->build->getLog();
     if ($this->build->isSuccessful()) {
         $sendFailures = $this->sendSeparateEmails($addresses, sprintf($subjectTemplate, $projectName, Lang::get('passing_build')), sprintf(Lang::get('log_output') . "<br><pre>%s</pre>", $logText));
     } else {
         $view = new View('Email/failed');
         $view->build = $this->build;
         $view->project = $this->build->getProject();
         $emailHtml = $view->render();
         $sendFailures = $this->sendSeparateEmails($addresses, sprintf($subjectTemplate, $projectName, Lang::get('failing_build')), $emailHtml);
     }
     // This is a success if we've not failed to send anything.
     $this->phpci->log(Lang::get('n_emails_sent', count($addresses) - count($sendFailures)));
     $this->phpci->log(Lang::get('n_emails_failed', count($sendFailures)));
     return count($sendFailures) == 0;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:28,代码来源:Email.php

示例10: __construct

 /**
  * Set up the plugin, configure options, etc.
  * @param Builder $phpci
  * @param Build $build
  * @param array $options
  * @throws \Exception
  */
 public function __construct(Builder $phpci, Build $build, array $options = array())
 {
     $this->phpci = $phpci;
     $this->build = $build;
     $this->userAgent = "PHPCI/1.0 (+http://www.phptesting.org/)";
     $this->cookie = "phpcicookie";
     if (is_array($options) && isset($options['authToken']) && isset($options['room'])) {
         $this->authToken = $options['authToken'];
         $this->room = $options['room'];
         if (isset($options['message'])) {
             $this->message = $options['message'];
         } else {
             $this->message = Lang::get('x_built_at_x');
         }
         if (isset($options['color'])) {
             $this->color = $options['color'];
         } else {
             $this->color = 'yellow';
         }
         if (isset($options['notify'])) {
             $this->notify = $options['notify'];
         } else {
             $this->notify = false;
         }
     } else {
         throw new \Exception(Lang::get('hipchat_settings'));
     }
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:35,代码来源:HipchatNotify.php

示例11: execute

 /**
  * Generates Model and Store classes by reading database meta data.
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if (!$this->verifyInstalled($output)) {
         return;
     }
     $output->write(Lang::get('updating_phpci'));
     shell_exec(PHPCI_DIR . 'vendor/bin/phinx migrate -c "' . PHPCI_DIR . 'phinx.php"');
     $output->writeln('<info>' . Lang::get('ok') . '</info>');
 }
开发者ID:ntoniazzi,项目名称:PHPCI,代码行数:12,代码来源:UpdateCommand.php

示例12: wipeExistingDirectory

 /**
  * Wipe the destination directory if it already exists.
  * @throws \Exception
  */
 protected function wipeExistingDirectory()
 {
     if ($this->wipe === true && $this->directory != '/' && is_dir($this->directory)) {
         $cmd = 'rm -Rf "%s*"';
         $success = $this->phpci->executeCommand($cmd, $this->directory);
         if (!$success) {
             throw new \Exception(Lang::get('failed_to_wipe', $this->directory));
         }
     }
 }
开发者ID:zeus911,项目名称:PHPCI,代码行数:14,代码来源:CopyBuild.php

示例13: index

 /**
  * Display PHPCI dashboard:
  */
 public function index()
 {
     $this->layout->title = Lang::get('dashboard');
     $builds = $this->buildStore->getLatestBuilds(null, 10);
     foreach ($builds as &$build) {
         $build = BuildFactory::getBuild($build);
     }
     $this->view->builds = $builds;
     $this->view->groups = $this->getGroupInfo();
     return $this->view->render();
 }
开发者ID:DavidGarciaCat,项目名称:PHPCI,代码行数:14,代码来源:HomeController.php

示例14: index

 /**
  * List all enabled plugins, installed and recommend packages.
  * @return string
  */
 public function index()
 {
     $this->requireAdmin();
     $json = $this->getComposerJson();
     $this->view->installedPackages = $json['require'];
     $pluginInfo = new PluginInformationCollection();
     $pluginInfo->add(FilesPluginInformation::newFromDir(PHPCI_DIR . "PHPCI/Plugin/"));
     $pluginInfo->add(ComposerPluginInformation::buildFromYaml(PHPCI_DIR . "vendor/composer/installed.json"));
     $this->view->plugins = $pluginInfo->getInstalledPlugins();
     $this->layout->title = Lang::get('plugins');
     return $this->view->render();
 }
开发者ID:DavidGarciaCat,项目名称:PHPCI,代码行数:16,代码来源:PluginController.php

示例15: execute

 /**
  * Runs Behat tests.
  */
 public function execute()
 {
     $curdir = getcwd();
     chdir($this->phpci->buildPath);
     $behat = $this->executable;
     if (!$behat) {
         $this->phpci->logFailure(Lang::get('could_not_find', 'behat'));
         return false;
     }
     $success = $this->phpci->executeCommand($behat . ' %s', $this->features);
     chdir($curdir);
     return $success;
 }
开发者ID:mrudtf,项目名称:PHPCI,代码行数:16,代码来源:Behat.php


注:本文中的PHPCI\Helper\Lang类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。