repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
dancryer/PHPCI
PHPCI/Plugin/Util/Executor.php
Executor.executePlugin
public function executePlugin($plugin, $options) { // Any plugin name without a namespace separator is a PHPCI built in plugin // if not we assume it's a fully name-spaced class name that implements the plugin interface. // If not the factory will throw an exception. if (strpos($plug...
php
public function executePlugin($plugin, $options) { // Any plugin name without a namespace separator is a PHPCI built in plugin // if not we assume it's a fully name-spaced class name that implements the plugin interface. // If not the factory will throw an exception. if (strpos($plug...
[ "public", "function", "executePlugin", "(", "$", "plugin", ",", "$", "options", ")", "{", "// Any plugin name without a namespace separator is a PHPCI built in plugin", "// if not we assume it's a fully name-spaced class name that implements the plugin interface.", "// If not the factory w...
Executes a given plugin, with options and returns the result.
[ "Executes", "a", "given", "plugin", "with", "options", "and", "returns", "the", "result", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/Executor.php#L170-L196
dancryer/PHPCI
PHPCI/Plugin/Util/Executor.php
Executor.setPluginStatus
protected function setPluginStatus($stage, $plugin, $status) { $summary = $this->getBuildSummary(); if (!isset($summary[$stage][$plugin])) { $summary[$stage][$plugin] = array(); } $summary[$stage][$plugin]['status'] = $status; if ($status === Build::STATUS_RUNN...
php
protected function setPluginStatus($stage, $plugin, $status) { $summary = $this->getBuildSummary(); if (!isset($summary[$stage][$plugin])) { $summary[$stage][$plugin] = array(); } $summary[$stage][$plugin]['status'] = $status; if ($status === Build::STATUS_RUNN...
[ "protected", "function", "setPluginStatus", "(", "$", "stage", ",", "$", "plugin", ",", "$", "status", ")", "{", "$", "summary", "=", "$", "this", "->", "getBuildSummary", "(", ")", ";", "if", "(", "!", "isset", "(", "$", "summary", "[", "$", "stage"...
Change the status of a plugin for a given stage. @param string $stage The builder stage. @param string $plugin The plugin name. @param int $status The new status.
[ "Change", "the", "status", "of", "a", "plugin", "for", "a", "given", "stage", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/Executor.php#L205-L222
dancryer/PHPCI
PHPCI/Plugin/Util/Executor.php
Executor.getBuildSummary
private function getBuildSummary() { $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); $metas = $this->store->getMeta('plugin-summary', $build->getProjectId(), $build->getId()); return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : array(); }
php
private function getBuildSummary() { $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); $metas = $this->store->getMeta('plugin-summary', $build->getProjectId(), $build->getId()); return isset($metas[0]['meta_value']) ? $metas[0]['meta_value'] : array(); }
[ "private", "function", "getBuildSummary", "(", ")", "{", "$", "build", "=", "$", "this", "->", "pluginFactory", "->", "getResourceFor", "(", "'PHPCI\\Model\\Build'", ")", ";", "$", "metas", "=", "$", "this", "->", "store", "->", "getMeta", "(", "'plugin-summ...
Fetch the summary data of the current build. @return array
[ "Fetch", "the", "summary", "data", "of", "the", "current", "build", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/Executor.php#L229-L234
dancryer/PHPCI
PHPCI/Plugin/Util/Executor.php
Executor.setBuildSummary
private function setBuildSummary($summary) { $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); $this->store->setMeta($build->getProjectId(), $build->getId(), 'plugin-summary', json_encode($summary)); }
php
private function setBuildSummary($summary) { $build = $this->pluginFactory->getResourceFor('PHPCI\Model\Build'); $this->store->setMeta($build->getProjectId(), $build->getId(), 'plugin-summary', json_encode($summary)); }
[ "private", "function", "setBuildSummary", "(", "$", "summary", ")", "{", "$", "build", "=", "$", "this", "->", "pluginFactory", "->", "getResourceFor", "(", "'PHPCI\\Model\\Build'", ")", ";", "$", "this", "->", "store", "->", "setMeta", "(", "$", "build", ...
Sets the summary data of the current build. @param array summary
[ "Sets", "the", "summary", "data", "of", "the", "current", "build", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/Executor.php#L241-L245
dancryer/PHPCI
PHPCI/Store/BuildMetaStore.php
BuildMetaStore.getErrorsForUpgrade
public function getErrorsForUpgrade($limit) { $query = 'SELECT * FROM build_meta WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\') ORDER BY id ASC LIMIT :limit'; $stmt = Database::getConnection('read')->prepare($query); $stmt->...
php
public function getErrorsForUpgrade($limit) { $query = 'SELECT * FROM build_meta WHERE meta_key IN (\'phpmd-data\', \'phpcs-data\', \'phpdoccheck-data\') ORDER BY id ASC LIMIT :limit'; $stmt = Database::getConnection('read')->prepare($query); $stmt->...
[ "public", "function", "getErrorsForUpgrade", "(", "$", "limit", ")", "{", "$", "query", "=", "'SELECT * FROM build_meta\n WHERE meta_key IN (\\'phpmd-data\\', \\'phpcs-data\\', \\'phpdoccheck-data\\')\n ORDER BY id ASC LIMIT :limit'", ";", "$", "stmt...
Only used by an upgrade migration to move errors from build_meta to build_error @param $start @param $limit @return array
[ "Only", "used", "by", "an", "upgrade", "migration", "to", "move", "errors", "from", "build_meta", "to", "build_error" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildMetaStore.php#L28-L50
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.init
public function init() { $this->userStore = b8\Store\Factory::getStore('User'); $this->userService = new UserService($this->userStore); }
php
public function init() { $this->userStore = b8\Store\Factory::getStore('User'); $this->userService = new UserService($this->userStore); }
[ "public", "function", "init", "(", ")", "{", "$", "this", "->", "userStore", "=", "b8", "\\", "Store", "\\", "Factory", "::", "getStore", "(", "'User'", ")", ";", "$", "this", "->", "userService", "=", "new", "UserService", "(", "$", "this", "->", "u...
Initialise the controller, set up stores and services.
[ "Initialise", "the", "controller", "set", "up", "stores", "and", "services", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L40-L44
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.index
public function index() { $users = $this->userStore->getWhere(array(), 1000, 0, array(), array('email' => 'ASC')); $this->view->users = $users; $this->layout->title = Lang::get('manage_users'); return $this->view->render(); }
php
public function index() { $users = $this->userStore->getWhere(array(), 1000, 0, array(), array('email' => 'ASC')); $this->view->users = $users; $this->layout->title = Lang::get('manage_users'); return $this->view->render(); }
[ "public", "function", "index", "(", ")", "{", "$", "users", "=", "$", "this", "->", "userStore", "->", "getWhere", "(", "array", "(", ")", ",", "1000", ",", "0", ",", "array", "(", ")", ",", "array", "(", "'email'", "=>", "'ASC'", ")", ")", ";", ...
View user list.
[ "View", "user", "list", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L49-L57
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.profile
public function profile() { $user = $_SESSION['phpci_user']; if ($this->request->getMethod() == 'POST') { $name = $this->getParam('name', null); $email = $this->getParam('email', null); $password = $this->getParam('password', null); $currentLang = La...
php
public function profile() { $user = $_SESSION['phpci_user']; if ($this->request->getMethod() == 'POST') { $name = $this->getParam('name', null); $email = $this->getParam('email', null); $password = $this->getParam('password', null); $currentLang = La...
[ "public", "function", "profile", "(", ")", "{", "$", "user", "=", "$", "_SESSION", "[", "'phpci_user'", "]", ";", "if", "(", "$", "this", "->", "request", "->", "getMethod", "(", ")", "==", "'POST'", ")", "{", "$", "name", "=", "$", "this", "->", ...
Allows the user to edit their profile. @return string
[ "Allows", "the", "user", "to", "edit", "their", "profile", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L63-L139
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.add
public function add() { $this->requireAdmin(); $this->layout->title = Lang::get('add_user'); $method = $this->request->getMethod(); if ($method == 'POST') { $values = $this->getParams(); } else { $values = array(); } $form = $this...
php
public function add() { $this->requireAdmin(); $this->layout->title = Lang::get('add_user'); $method = $this->request->getMethod(); if ($method == 'POST') { $values = $this->getParams(); } else { $values = array(); } $form = $this...
[ "public", "function", "add", "(", ")", "{", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "this", "->", "layout", "->", "title", "=", "Lang", "::", "get", "(", "'add_user'", ")", ";", "$", "method", "=", "$", "this", "->", "request", "->",...
Add a user - handles both form and processing.
[ "Add", "a", "user", "-", "handles", "both", "form", "and", "processing", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L144-L180
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.edit
public function edit($userId) { $this->requireAdmin(); $method = $this->request->getMethod(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->layout->title = $...
php
public function edit($userId) { $this->requireAdmin(); $method = $this->request->getMethod(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->layout->title = $...
[ "public", "function", "edit", "(", "$", "userId", ")", "{", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "method", "=", "$", "this", "->", "request", "->", "getMethod", "(", ")", ";", "$", "user", "=", "$", "this", "->", "userStore", "->"...
Edit a user - handles both form and processing.
[ "Edit", "a", "user", "-", "handles", "both", "form", "and", "processing", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L185-L221
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.userForm
protected function userForm($values, $type = 'add') { $form = new Form(); $form->setMethod('POST'); $form->setAction(PHPCI_URL.'user/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Email('email'); $field->setRequired(true); ...
php
protected function userForm($values, $type = 'add') { $form = new Form(); $form->setMethod('POST'); $form->setAction(PHPCI_URL.'user/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $field = new Form\Element\Email('email'); $field->setRequired(true); ...
[ "protected", "function", "userForm", "(", "$", "values", ",", "$", "type", "=", "'add'", ")", "{", "$", "form", "=", "new", "Form", "(", ")", ";", "$", "form", "->", "setMethod", "(", "'POST'", ")", ";", "$", "form", "->", "setAction", "(", "PHPCI_...
Create user add / edit form.
[ "Create", "user", "add", "/", "edit", "form", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L226-L275
dancryer/PHPCI
PHPCI/Controller/UserController.php
UserController.delete
public function delete($userId) { $this->requireAdmin(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->userService->deleteUser($user); $response = new b8\...
php
public function delete($userId) { $this->requireAdmin(); $user = $this->userStore->getById($userId); if (empty($user)) { throw new NotFoundException(Lang::get('user_n_not_found', $userId)); } $this->userService->deleteUser($user); $response = new b8\...
[ "public", "function", "delete", "(", "$", "userId", ")", "{", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "user", "=", "$", "this", "->", "userStore", "->", "getById", "(", "$", "userId", ")", ";", "if", "(", "empty", "(", "$", "user", ...
Delete a user.
[ "Delete", "a", "user", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/UserController.php#L280-L295
dancryer/PHPCI
PHPCI/Plugin/PhpCsFixer.php
PhpCsFixer.execute
public function execute() { $curdir = getcwd(); chdir($this->workingdir); $phpcsfixer = $this->phpci->findBinary('php-cs-fixer'); $cmd = $phpcsfixer . ' fix . %s %s %s'; $success = $this->phpci->executeCommand($cmd, $this->verbose, $this->diff, $this->level); chdir...
php
public function execute() { $curdir = getcwd(); chdir($this->workingdir); $phpcsfixer = $this->phpci->findBinary('php-cs-fixer'); $cmd = $phpcsfixer . ' fix . %s %s %s'; $success = $this->phpci->executeCommand($cmd, $this->verbose, $this->diff, $this->level); chdir...
[ "public", "function", "execute", "(", ")", "{", "$", "curdir", "=", "getcwd", "(", ")", ";", "chdir", "(", "$", "this", "->", "workingdir", ")", ";", "$", "phpcsfixer", "=", "$", "this", "->", "phpci", "->", "findBinary", "(", "'php-cs-fixer'", ")", ...
Run PHP CS Fixer. @return bool
[ "Run", "PHP", "CS", "Fixer", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/PhpCsFixer.php#L65-L78
dancryer/PHPCI
PHPCI/Plugin/PhpCsFixer.php
PhpCsFixer.buildArgs
public function buildArgs($options) { if (isset($options['verbose']) && $options['verbose']) { $this->verbose = ' --verbose'; } if (isset($options['diff']) && $options['diff']) { $this->diff = ' --diff'; } if (isset($options['level']) && in_array($op...
php
public function buildArgs($options) { if (isset($options['verbose']) && $options['verbose']) { $this->verbose = ' --verbose'; } if (isset($options['diff']) && $options['diff']) { $this->diff = ' --diff'; } if (isset($options['level']) && in_array($op...
[ "public", "function", "buildArgs", "(", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'verbose'", "]", ")", "&&", "$", "options", "[", "'verbose'", "]", ")", "{", "$", "this", "->", "verbose", "=", "' --verbose'", ";", "}",...
Build an args string for PHPCS Fixer. @param $options
[ "Build", "an", "args", "string", "for", "PHPCS", "Fixer", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/PhpCsFixer.php#L84-L102
dancryer/PHPCI
PHPCI/Plugin/Phar.php
Phar.getDirectory
public function getDirectory() { if (!isset($this->directory)) { $this->setDirectory($this->getPHPCI()->buildPath); } return $this->directory; }
php
public function getDirectory() { if (!isset($this->directory)) { $this->setDirectory($this->getPHPCI()->buildPath); } return $this->directory; }
[ "public", "function", "getDirectory", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "directory", ")", ")", "{", "$", "this", "->", "setDirectory", "(", "$", "this", "->", "getPHPCI", "(", ")", "->", "buildPath", ")", ";", "}", "re...
Directory Getter @return string Configurated or Default Value
[ "Directory", "Getter" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phar.php#L127-L133
dancryer/PHPCI
PHPCI/Plugin/Phar.php
Phar.getStubContent
public function getStubContent() { $content = ''; $filename = $this->getStub(); if ($filename) { $content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub()); } return $content; }
php
public function getStubContent() { $content = ''; $filename = $this->getStub(); if ($filename) { $content = file_get_contents($this->getPHPCI()->buildPath . DIRECTORY_SEPARATOR . $this->getStub()); } return $content; }
[ "public", "function", "getStubContent", "(", ")", "{", "$", "content", "=", "''", ";", "$", "filename", "=", "$", "this", "->", "getStub", "(", ")", ";", "if", "(", "$", "filename", ")", "{", "$", "content", "=", "file_get_contents", "(", "$", "this"...
Get stub content for the Phar file. @return string
[ "Get", "stub", "content", "for", "the", "Phar", "file", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phar.php#L211-L219
dancryer/PHPCI
PHPCI/Plugin/Phar.php
Phar.execute
public function execute() { $success = false; try { $file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename(); $phar = new PHPPhar($file, 0, $this->getFilename()); $phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp()); ...
php
public function execute() { $success = false; try { $file = $this->getDirectory() . DIRECTORY_SEPARATOR . $this->getFilename(); $phar = new PHPPhar($file, 0, $this->getFilename()); $phar->buildFromDirectory($this->getPHPCI()->buildPath, $this->getRegExp()); ...
[ "public", "function", "execute", "(", ")", "{", "$", "success", "=", "false", ";", "try", "{", "$", "file", "=", "$", "this", "->", "getDirectory", "(", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "this", "->", "getFilename", "(", ")", ";", "$", "phar...
Run the phar plugin. @return bool
[ "Run", "the", "phar", "plugin", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phar.php#L225-L246
dancryer/PHPCI
PHPCI/Migrations/20150203105015_fix_column_types.php
FixColumnTypes.up
public function up() { // Update the build log column to MEDIUMTEXT: $build = $this->table('build'); $build->changeColumn('log', 'text', array( 'null' => true, 'limit' => MysqlAdapter::TEXT_MEDIUM, )); // Update the build meta value column to MEDIUMTE...
php
public function up() { // Update the build log column to MEDIUMTEXT: $build = $this->table('build'); $build->changeColumn('log', 'text', array( 'null' => true, 'limit' => MysqlAdapter::TEXT_MEDIUM, )); // Update the build meta value column to MEDIUMTE...
[ "public", "function", "up", "(", ")", "{", "// Update the build log column to MEDIUMTEXT:", "$", "build", "=", "$", "this", "->", "table", "(", "'build'", ")", ";", "$", "build", "->", "changeColumn", "(", "'log'", ",", "'text'", ",", "array", "(", "'null'",...
Migrate Up.
[ "Migrate", "Up", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Migrations/20150203105015_fix_column_types.php#L11-L26
dancryer/PHPCI
PHPCI/Helper/BaseCommandExecutor.php
BaseCommandExecutor.executeCommand
public function executeCommand($args = array()) { $this->lastOutput = array(); $command = call_user_func_array('sprintf', $args); $this->logger->logDebug($command); if ($this->quiet) { $this->logger->log('Executing: ' . $command); } $status = 0; ...
php
public function executeCommand($args = array()) { $this->lastOutput = array(); $command = call_user_func_array('sprintf', $args); $this->logger->logDebug($command); if ($this->quiet) { $this->logger->log('Executing: ' . $command); } $status = 0; ...
[ "public", "function", "executeCommand", "(", "$", "args", "=", "array", "(", ")", ")", "{", "$", "this", "->", "lastOutput", "=", "array", "(", ")", ";", "$", "command", "=", "call_user_func_array", "(", "'sprintf'", ",", "$", "args", ")", ";", "$", ...
Executes shell commands. @param array $args @return bool Indicates success
[ "Executes", "shell", "commands", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/BaseCommandExecutor.php#L74-L146
dancryer/PHPCI
PHPCI/Helper/BaseCommandExecutor.php
BaseCommandExecutor.findBinary
public function findBinary($binary, $quiet = false) { $composerBin = $this->getComposerBinDir(realpath($this->buildPath)); if (is_string($binary)) { $binary = array($binary); } foreach ($binary as $bin) { $this->logger->log(Lang::get('looking_for_binary', $b...
php
public function findBinary($binary, $quiet = false) { $composerBin = $this->getComposerBinDir(realpath($this->buildPath)); if (is_string($binary)) { $binary = array($binary); } foreach ($binary as $bin) { $this->logger->log(Lang::get('looking_for_binary', $b...
[ "public", "function", "findBinary", "(", "$", "binary", ",", "$", "quiet", "=", "false", ")", "{", "$", "composerBin", "=", "$", "this", "->", "getComposerBinDir", "(", "realpath", "(", "$", "this", "->", "buildPath", ")", ")", ";", "if", "(", "is_stri...
Find a binary required by a plugin. @param string $binary @param bool $quiet @return null|string
[ "Find", "a", "binary", "required", "by", "a", "plugin", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/BaseCommandExecutor.php#L170-L207
dancryer/PHPCI
PHPCI/Helper/BaseCommandExecutor.php
BaseCommandExecutor.getComposerBinDir
public function getComposerBinDir($path) { if (is_dir($path)) { $composer = $path.'/composer.json'; if (is_file($composer)) { $json = json_decode(file_get_contents($composer)); if (isset($json->config->{"bin-dir"})) { return $path....
php
public function getComposerBinDir($path) { if (is_dir($path)) { $composer = $path.'/composer.json'; if (is_file($composer)) { $json = json_decode(file_get_contents($composer)); if (isset($json->config->{"bin-dir"})) { return $path....
[ "public", "function", "getComposerBinDir", "(", "$", "path", ")", "{", "if", "(", "is_dir", "(", "$", "path", ")", ")", "{", "$", "composer", "=", "$", "path", ".", "'/composer.json'", ";", "if", "(", "is_file", "(", "$", "composer", ")", ")", "{", ...
Try to load the composer.json file in the building project If the bin-dir is configured, return the full path to it @param string $path Current build path @return string|null
[ "Try", "to", "load", "the", "composer", ".", "json", "file", "in", "the", "building", "project", "If", "the", "bin", "-", "dir", "is", "configured", "return", "the", "full", "path", "to", "it" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/BaseCommandExecutor.php#L222-L237
dancryer/PHPCI
PHPCI/Logging/LoggedBuildContextTidier.php
LoggedBuildContextTidier.tidyLoggedBuildContext
protected function tidyLoggedBuildContext(array $logRecord) { if (isset($logRecord['context']['build'])) { $build = $logRecord['context']['build']; if ($build instanceof Build) { $logRecord['context']['buildID'] = $build->getId(); unset($logRecord['con...
php
protected function tidyLoggedBuildContext(array $logRecord) { if (isset($logRecord['context']['build'])) { $build = $logRecord['context']['build']; if ($build instanceof Build) { $logRecord['context']['buildID'] = $build->getId(); unset($logRecord['con...
[ "protected", "function", "tidyLoggedBuildContext", "(", "array", "$", "logRecord", ")", "{", "if", "(", "isset", "(", "$", "logRecord", "[", "'context'", "]", "[", "'build'", "]", ")", ")", "{", "$", "build", "=", "$", "logRecord", "[", "'context'", "]",...
Removes the build object from the logged record and adds the ID as this is more useful to display. @param array $logRecord @return array
[ "Removes", "the", "build", "object", "from", "the", "logged", "record", "and", "adds", "the", "ID", "as", "this", "is", "more", "useful", "to", "display", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/LoggedBuildContextTidier.php#L35-L45
dancryer/PHPCI
PHPCI/Model/Build/GitlabBuild.php
GitlabBuild.getCommitLink
public function getCommitLink() { $domain = $this->getProject()->getAccessInformation("domain"); return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/commit/' . $this->getCommitId(); }
php
public function getCommitLink() { $domain = $this->getProject()->getAccessInformation("domain"); return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/commit/' . $this->getCommitId(); }
[ "public", "function", "getCommitLink", "(", ")", "{", "$", "domain", "=", "$", "this", "->", "getProject", "(", ")", "->", "getAccessInformation", "(", "\"domain\"", ")", ";", "return", "'http://'", ".", "$", "domain", ".", "'/'", ".", "$", "this", "->",...
Get link to commit from another source (i.e. Github)
[ "Get", "link", "to", "commit", "from", "another", "source", "(", "i", ".", "e", ".", "Github", ")" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GitlabBuild.php#L26-L30
dancryer/PHPCI
PHPCI/Model/Build/GitlabBuild.php
GitlabBuild.getBranchLink
public function getBranchLink() { $domain = $this->getProject()->getAccessInformation("domain"); return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/tree/' . $this->getBranch(); }
php
public function getBranchLink() { $domain = $this->getProject()->getAccessInformation("domain"); return 'http://' . $domain . '/' . $this->getProject()->getReference() . '/tree/' . $this->getBranch(); }
[ "public", "function", "getBranchLink", "(", ")", "{", "$", "domain", "=", "$", "this", "->", "getProject", "(", ")", "->", "getAccessInformation", "(", "\"domain\"", ")", ";", "return", "'http://'", ".", "$", "domain", ".", "'/'", ".", "$", "this", "->",...
Get link to branch from another source (i.e. Github)
[ "Get", "link", "to", "branch", "from", "another", "source", "(", "i", ".", "e", ".", "Github", ")" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GitlabBuild.php#L35-L39
dancryer/PHPCI
PHPCI/Model/Build/GitlabBuild.php
GitlabBuild.getFileLinkTemplate
public function getFileLinkTemplate() { return sprintf( 'http://%s/%s/blob/%s/{FILE}#L{LINE}', $this->getProject()->getAccessInformation("domain"), $this->getProject()->getReference(), $this->getCommitId() ); }
php
public function getFileLinkTemplate() { return sprintf( 'http://%s/%s/blob/%s/{FILE}#L{LINE}', $this->getProject()->getAccessInformation("domain"), $this->getProject()->getReference(), $this->getCommitId() ); }
[ "public", "function", "getFileLinkTemplate", "(", ")", "{", "return", "sprintf", "(", "'http://%s/%s/blob/%s/{FILE}#L{LINE}'", ",", "$", "this", "->", "getProject", "(", ")", "->", "getAccessInformation", "(", "\"domain\"", ")", ",", "$", "this", "->", "getProject...
Get link to specific file (and line) in a the repo's branch
[ "Get", "link", "to", "specific", "file", "(", "and", "line", ")", "in", "a", "the", "repo", "s", "branch" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GitlabBuild.php#L44-L52
dancryer/PHPCI
PHPCI/Model/Build/GitlabBuild.php
GitlabBuild.getCloneUrl
protected function getCloneUrl() { $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { $user = $this->getProject()->getAccessInformation("user"); $domain = $this->getProject()->getAccessInformation("domain"); $port = $this->getProject()->get...
php
protected function getCloneUrl() { $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { $user = $this->getProject()->getAccessInformation("user"); $domain = $this->getProject()->getAccessInformation("domain"); $port = $this->getProject()->get...
[ "protected", "function", "getCloneUrl", "(", ")", "{", "$", "key", "=", "trim", "(", "$", "this", "->", "getProject", "(", ")", "->", "getSshPrivateKey", "(", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "key", ")", ")", "{", "$", "user", "=...
Get the URL to be used to clone this remote repository.
[ "Get", "the", "URL", "to", "be", "used", "to", "clone", "this", "remote", "repository", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GitlabBuild.php#L57-L76
dancryer/PHPCI
PHPCI/Command/RunCommand.php
RunCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->output = $output; // For verbose mode we want to output all informational and above // messages to the symphony output interface. if ($input->hasOption('verbose') && $input->getOption('verbose')) { ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->output = $output; // For verbose mode we want to output all informational and above // messages to the symphony output interface. if ($input->hasOption('verbose') && $input->getOption('verbose')) { ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "output", "=", "$", "output", ";", "// For verbose mode we want to output all informational and above", "// messages to the symphon...
Pulls all pending builds from the database and runs them.
[ "Pulls", "all", "pending", "builds", "from", "the", "database", "and", "runs", "them", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/RunCommand.php#L75-L143
dancryer/PHPCI
PHPCI/Store/BuildStore.php
BuildStore.getLastBuildByStatus
public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS) { $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':pid', $projectId); ...
php
public function getLastBuildByStatus($projectId = null, $status = Build::STATUS_SUCCESS) { $query = 'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':pid', $projectId); ...
[ "public", "function", "getLastBuildByStatus", "(", "$", "projectId", "=", "null", ",", "$", "status", "=", "Build", "::", "STATUS_SUCCESS", ")", "{", "$", "query", "=", "'SELECT * FROM build WHERE project_id = :pid AND status = :status ORDER BY id DESC LIMIT 1'", ";", "$"...
Return the latest build for a specific project, of a specific build status. @param null $projectId @param int $status @return array|Build
[ "Return", "the", "latest", "build", "for", "a", "specific", "project", "of", "a", "specific", "build", "status", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildStore.php#L66-L80
dancryer/PHPCI
PHPCI/Store/BuildStore.php
BuildStore.getByProjectAndCommit
public function getByProjectAndCommit($projectId, $commitId) { $query = 'SELECT * FROM `build` WHERE `project_id` = :project_id AND `commit_id` = :commit_id'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':project_id', $projectId); $stmt->bindValue(':com...
php
public function getByProjectAndCommit($projectId, $commitId) { $query = 'SELECT * FROM `build` WHERE `project_id` = :project_id AND `commit_id` = :commit_id'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':project_id', $projectId); $stmt->bindValue(':com...
[ "public", "function", "getByProjectAndCommit", "(", "$", "projectId", ",", "$", "commitId", ")", "{", "$", "query", "=", "'SELECT * FROM `build` WHERE `project_id` = :project_id AND `commit_id` = :commit_id'", ";", "$", "stmt", "=", "Database", "::", "getConnection", "(",...
Return an array of builds for a given project and commit ID. @param $projectId @param $commitId @return array
[ "Return", "an", "array", "of", "builds", "for", "a", "given", "project", "and", "commit", "ID", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildStore.php#L88-L108
dancryer/PHPCI
PHPCI/Store/BuildStore.php
BuildStore.getBuildBranches
public function getBuildBranches($projectId) { $query = 'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':project_id', $projectId); if ($stmt->execute()) { $res = $stmt->...
php
public function getBuildBranches($projectId) { $query = 'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bindValue(':project_id', $projectId); if ($stmt->execute()) { $res = $stmt->...
[ "public", "function", "getBuildBranches", "(", "$", "projectId", ")", "{", "$", "query", "=", "'SELECT DISTINCT `branch` FROM `build` WHERE `project_id` = :project_id'", ";", "$", "stmt", "=", "Database", "::", "getConnection", "(", "'read'", ")", "->", "prepare", "("...
Returns all registered branches for project @param $projectId @return array @throws \Exception
[ "Returns", "all", "registered", "branches", "for", "project" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildStore.php#L117-L129
dancryer/PHPCI
PHPCI/Store/BuildStore.php
BuildStore.getMeta
public function getMeta($key, $projectId, $buildId = null, $branch = null, $numResults = 1) { $query = 'SELECT bm.build_id, bm.meta_key, bm.meta_value FROM build_meta AS bm LEFT JOIN build b ON b.id = bm.build_id WHERE bm.meta_key = :key ...
php
public function getMeta($key, $projectId, $buildId = null, $branch = null, $numResults = 1) { $query = 'SELECT bm.build_id, bm.meta_key, bm.meta_value FROM build_meta AS bm LEFT JOIN build b ON b.id = bm.build_id WHERE bm.meta_key = :key ...
[ "public", "function", "getMeta", "(", "$", "key", ",", "$", "projectId", ",", "$", "buildId", "=", "null", ",", "$", "branch", "=", "null", ",", "$", "numResults", "=", "1", ")", "{", "$", "query", "=", "'SELECT bm.build_id, bm.meta_key, bm.meta_value\n ...
Return build metadata by key, project and optionally build id. @param $key @param $projectId @param null $buildId @param null $branch @param int $numResults @return array|null
[ "Return", "build", "metadata", "by", "key", "project", "and", "optionally", "build", "id", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildStore.php#L140-L190
dancryer/PHPCI
PHPCI/Store/BuildStore.php
BuildStore.setMeta
public function setMeta($projectId, $buildId, $key, $value) { $cols = '`project_id`, `build_id`, `meta_key`, `meta_value`'; $query = 'REPLACE INTO build_meta ('.$cols.') VALUES (:projectId, :buildId, :key, :value)'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bi...
php
public function setMeta($projectId, $buildId, $key, $value) { $cols = '`project_id`, `build_id`, `meta_key`, `meta_value`'; $query = 'REPLACE INTO build_meta ('.$cols.') VALUES (:projectId, :buildId, :key, :value)'; $stmt = Database::getConnection('read')->prepare($query); $stmt->bi...
[ "public", "function", "setMeta", "(", "$", "projectId", ",", "$", "buildId", ",", "$", "key", ",", "$", "value", ")", "{", "$", "cols", "=", "'`project_id`, `build_id`, `meta_key`, `meta_value`'", ";", "$", "query", "=", "'REPLACE INTO build_meta ('", ".", "$", ...
Set a metadata value for a given project and build ID. @param $projectId @param $buildId @param $key @param $value @return bool
[ "Set", "a", "metadata", "value", "for", "a", "given", "project", "and", "build", "ID", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Store/BuildStore.php#L200-L216
dancryer/PHPCI
PHPCI/Helper/Email.php
Email.send
public function send() { $smtpServer = $this->config->get('phpci.email_settings.smtp_address'); if (empty($smtpServer)) { return $this->sendViaMail(); } else { return $this->sendViaSwiftMailer(); } }
php
public function send() { $smtpServer = $this->config->get('phpci.email_settings.smtp_address'); if (empty($smtpServer)) { return $this->sendViaMail(); } else { return $this->sendViaSwiftMailer(); } }
[ "public", "function", "send", "(", ")", "{", "$", "smtpServer", "=", "$", "this", "->", "config", "->", "get", "(", "'phpci.email_settings.smtp_address'", ")", ";", "if", "(", "empty", "(", "$", "smtpServer", ")", ")", "{", "return", "$", "this", "->", ...
Send the email. @return bool|int
[ "Send", "the", "email", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Email.php#L104-L113
dancryer/PHPCI
PHPCI/Helper/Email.php
Email.sendViaMail
protected function sendViaMail() { $headers = ''; if ($this->isHtml) { $headers = 'Content-Type: text/html' . PHP_EOL; } $headers .= 'From: ' . $this->getFrom() . PHP_EOL; $emailTo = array(); foreach ($this->emailTo as $email => $name) { $th...
php
protected function sendViaMail() { $headers = ''; if ($this->isHtml) { $headers = 'Content-Type: text/html' . PHP_EOL; } $headers .= 'From: ' . $this->getFrom() . PHP_EOL; $emailTo = array(); foreach ($this->emailTo as $email => $name) { $th...
[ "protected", "function", "sendViaMail", "(", ")", "{", "$", "headers", "=", "''", ";", "if", "(", "$", "this", "->", "isHtml", ")", "{", "$", "headers", "=", "'Content-Type: text/html'", ".", "PHP_EOL", ";", "}", "$", "headers", ".=", "'From: '", ".", ...
Sends the email via the built in PHP mail() function. @return bool
[ "Sends", "the", "email", "via", "the", "built", "in", "PHP", "mail", "()", "function", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Email.php#L119-L143
dancryer/PHPCI
PHPCI/Helper/Email.php
Email.sendViaSwiftMailer
protected function sendViaSwiftMailer() { $factory = new MailerFactory($this->config->get('phpci')); $mailer = $factory->getSwiftMailerFromConfig(); $message = \Swift_Message::newInstance($this->subject) ->setFrom($this->getFrom()) ->setTo($this->emailTo) ...
php
protected function sendViaSwiftMailer() { $factory = new MailerFactory($this->config->get('phpci')); $mailer = $factory->getSwiftMailerFromConfig(); $message = \Swift_Message::newInstance($this->subject) ->setFrom($this->getFrom()) ->setTo($this->emailTo) ...
[ "protected", "function", "sendViaSwiftMailer", "(", ")", "{", "$", "factory", "=", "new", "MailerFactory", "(", "$", "this", "->", "config", "->", "get", "(", "'phpci'", ")", ")", ";", "$", "mailer", "=", "$", "factory", "->", "getSwiftMailerFromConfig", "...
Sends the email using SwiftMailer. @return int
[ "Sends", "the", "email", "using", "SwiftMailer", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Email.php#L149-L168
dancryer/PHPCI
PHPCI/Helper/Email.php
Email.getFrom
protected function getFrom() { $email = $this->config->get('phpci.email_settings.from_address', self::DEFAULT_FROM); if (empty($email)) { $email = self::DEFAULT_FROM; } return $email; }
php
protected function getFrom() { $email = $this->config->get('phpci.email_settings.from_address', self::DEFAULT_FROM); if (empty($email)) { $email = self::DEFAULT_FROM; } return $email; }
[ "protected", "function", "getFrom", "(", ")", "{", "$", "email", "=", "$", "this", "->", "config", "->", "get", "(", "'phpci.email_settings.from_address'", ",", "self", "::", "DEFAULT_FROM", ")", ";", "if", "(", "empty", "(", "$", "email", ")", ")", "{",...
Get the from address to use for the email. @return mixed|string
[ "Get", "the", "from", "address", "to", "use", "for", "the", "email", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Email.php#L174-L183
dancryer/PHPCI
PHPCI/Helper/Github.php
Github.makeRequest
public function makeRequest($url, $params) { $http = new HttpClient('https://api.github.com'); $res = $http->get($url, $params); return $res['body']; }
php
public function makeRequest($url, $params) { $http = new HttpClient('https://api.github.com'); $res = $http->get($url, $params); return $res['body']; }
[ "public", "function", "makeRequest", "(", "$", "url", ",", "$", "params", ")", "{", "$", "http", "=", "new", "HttpClient", "(", "'https://api.github.com'", ")", ";", "$", "res", "=", "$", "http", "->", "get", "(", "$", "url", ",", "$", "params", ")",...
Make a request to the Github API. @param $url @param $params @return mixed
[ "Make", "a", "request", "to", "the", "Github", "API", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Github.php#L28-L34
dancryer/PHPCI
PHPCI/Helper/Github.php
Github.makeRecursiveRequest
public function makeRecursiveRequest($url, $params, $results = array()) { $http = new HttpClient('https://api.github.com'); $res = $http->get($url, $params); foreach ($res['body'] as $item) { $results[] = $item; } foreach ($res['headers'] as $header) { ...
php
public function makeRecursiveRequest($url, $params, $results = array()) { $http = new HttpClient('https://api.github.com'); $res = $http->get($url, $params); foreach ($res['body'] as $item) { $results[] = $item; } foreach ($res['headers'] as $header) { ...
[ "public", "function", "makeRecursiveRequest", "(", "$", "url", ",", "$", "params", ",", "$", "results", "=", "array", "(", ")", ")", "{", "$", "http", "=", "new", "HttpClient", "(", "'https://api.github.com'", ")", ";", "$", "res", "=", "$", "http", "-...
Make all GitHub requests following the Link HTTP headers. @param string $url @param mixed $params @param array $results @return array
[ "Make", "all", "GitHub", "requests", "following", "the", "Link", "HTTP", "headers", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Github.php#L45-L66
dancryer/PHPCI
PHPCI/Helper/Github.php
Github.getRepositories
public function getRepositories() { $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { return null; } $cache = Cache::getCache(Cache::TYPE_APC); $rtn = $cache->get('phpci_github_repos'); if (!$rtn) { $orgs = $this->mak...
php
public function getRepositories() { $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { return null; } $cache = Cache::getCache(Cache::TYPE_APC); $rtn = $cache->get('phpci_github_repos'); if (!$rtn) { $orgs = $this->mak...
[ "public", "function", "getRepositories", "(", ")", "{", "$", "token", "=", "Config", "::", "getInstance", "(", ")", "->", "get", "(", "'phpci.github.token'", ")", ";", "if", "(", "!", "$", "token", ")", "{", "return", "null", ";", "}", "$", "cache", ...
Get an array of repositories from Github's API.
[ "Get", "an", "array", "of", "repositories", "from", "Github", "s", "API", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Github.php#L71-L104
dancryer/PHPCI
PHPCI/Helper/Github.php
Github.createPullRequestComment
public function createPullRequestComment($repo, $pullId, $commitId, $file, $line, $comment) { $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { return null; } $url = '/repos/' . strtolower($repo) . '/pulls/' . $pullId . '/comments'; $par...
php
public function createPullRequestComment($repo, $pullId, $commitId, $file, $line, $comment) { $token = Config::getInstance()->get('phpci.github.token'); if (!$token) { return null; } $url = '/repos/' . strtolower($repo) . '/pulls/' . $pullId . '/comments'; $par...
[ "public", "function", "createPullRequestComment", "(", "$", "repo", ",", "$", "pullId", ",", "$", "commitId", ",", "$", "file", ",", "$", "line", ",", "$", "comment", ")", "{", "$", "token", "=", "Config", "::", "getInstance", "(", ")", "->", "get", ...
Create a comment on a specific file (and commit) in a Github Pull Request. @param $repo @param $pullId @param $commitId @param $file @param $line @param $comment @return null
[ "Create", "a", "comment", "on", "a", "specific", "file", "(", "and", "commit", ")", "in", "a", "Github", "Pull", "Request", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/Github.php#L116-L140
dancryer/PHPCI
PHPCI/Helper/MailerFactory.php
MailerFactory.getSwiftMailerFromConfig
public function getSwiftMailerFromConfig() { $encryptionType = $this->getMailConfig('smtp_encryption'); // Workaround issue where smtp_encryption could == 1 in the past by // checking it is a valid transport if ($encryptionType && !in_array($encryptionType, stream_get_transports()))...
php
public function getSwiftMailerFromConfig() { $encryptionType = $this->getMailConfig('smtp_encryption'); // Workaround issue where smtp_encryption could == 1 in the past by // checking it is a valid transport if ($encryptionType && !in_array($encryptionType, stream_get_transports()))...
[ "public", "function", "getSwiftMailerFromConfig", "(", ")", "{", "$", "encryptionType", "=", "$", "this", "->", "getMailConfig", "(", "'smtp_encryption'", ")", ";", "// Workaround issue where smtp_encryption could == 1 in the past by", "// checking it is a valid transport", "if...
Returns an instance of Swift_Mailer based on the config.s @return \Swift_Mailer
[ "Returns", "an", "instance", "of", "Swift_Mailer", "based", "on", "the", "config", ".", "s" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/MailerFactory.php#L40-L60
dancryer/PHPCI
PHPCI/Helper/MailerFactory.php
MailerFactory.getMailConfig
public function getMailConfig($configName) { if (isset($this->emailConfig[$configName]) && $this->emailConfig[$configName] != "") { return $this->emailConfig[$configName]; } else { // Check defaults switch ($configName) { case 'smtp_address': ...
php
public function getMailConfig($configName) { if (isset($this->emailConfig[$configName]) && $this->emailConfig[$configName] != "") { return $this->emailConfig[$configName]; } else { // Check defaults switch ($configName) { case 'smtp_address': ...
[ "public", "function", "getMailConfig", "(", "$", "configName", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "emailConfig", "[", "$", "configName", "]", ")", "&&", "$", "this", "->", "emailConfig", "[", "$", "configName", "]", "!=", "\"\"", ")"...
Return a specific configuration value by key. @param $configName @return null|string
[ "Return", "a", "specific", "configuration", "value", "by", "key", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/MailerFactory.php#L67-L87
dancryer/PHPCI
PHPCI/Migrations/20171027132159_error_hash.php
ErrorHash.change
public function change() { $errors = $this->table('build_error'); $errors->addColumn('hash', 'string', ['limit' => 32, 'null' => true, 'default' => null]); $errors->addColumn('is_new', 'boolean'); $errors->save(); }
php
public function change() { $errors = $this->table('build_error'); $errors->addColumn('hash', 'string', ['limit' => 32, 'null' => true, 'default' => null]); $errors->addColumn('is_new', 'boolean'); $errors->save(); }
[ "public", "function", "change", "(", ")", "{", "$", "errors", "=", "$", "this", "->", "table", "(", "'build_error'", ")", ";", "$", "errors", "->", "addColumn", "(", "'hash'", ",", "'string'", ",", "[", "'limit'", "=>", "32", ",", "'null'", "=>", "tr...
Change Method. Write your reversible migrations using this method. More information on writing migrations is available here: http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class The following commands can be used in this method and Phinx will automatically reverse them when rolling back: crea...
[ "Change", "Method", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Migrations/20171027132159_error_hash.php#L29-L35
dancryer/PHPCI
PHPCI/Helper/AnsiConverter.php
AnsiConverter.getInstance
private static function getInstance() { if (self::$converter === null) { self::$converter = new AnsiToHtmlConverter(null, false); } return self::$converter; }
php
private static function getInstance() { if (self::$converter === null) { self::$converter = new AnsiToHtmlConverter(null, false); } return self::$converter; }
[ "private", "static", "function", "getInstance", "(", ")", "{", "if", "(", "self", "::", "$", "converter", "===", "null", ")", "{", "self", "::", "$", "converter", "=", "new", "AnsiToHtmlConverter", "(", "null", ",", "false", ")", ";", "}", "return", "s...
Initialize the singleton. @return AnsiToHtmlConverter
[ "Initialize", "the", "singleton", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/AnsiConverter.php#L28-L35
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.createWorkingCopy
public function createWorkingCopy(Builder $builder, $buildPath) { if ($this->canRunSsh()) { $success = $this->cloneBySsh($builder, $buildPath); } else { $success = $this->cloneByHttp($builder, $buildPath); } if (!$success) { $builder->logFailure('...
php
public function createWorkingCopy(Builder $builder, $buildPath) { if ($this->canRunSsh()) { $success = $this->cloneBySsh($builder, $buildPath); } else { $success = $this->cloneByHttp($builder, $buildPath); } if (!$success) { $builder->logFailure('...
[ "public", "function", "createWorkingCopy", "(", "Builder", "$", "builder", ",", "$", "buildPath", ")", "{", "if", "(", "$", "this", "->", "canRunSsh", "(", ")", ")", "{", "$", "success", "=", "$", "this", "->", "cloneBySsh", "(", "$", "builder", ",", ...
Create a working copy by cloning, copying, or similar.
[ "Create", "a", "working", "copy", "by", "cloning", "copying", "or", "similar", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L34-L48
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.cloneByHttp
protected function cloneByHttp(Builder $builder, $cloneTo) { $cmd = 'git clone --recursive '; $depth = $builder->getConfig('clone_depth'); if (!is_null($depth)) { $cmd .= ' --depth ' . intval($depth) . ' '; } $cmd .= ' -b "%s" "%s" "%s"'; $success = $bu...
php
protected function cloneByHttp(Builder $builder, $cloneTo) { $cmd = 'git clone --recursive '; $depth = $builder->getConfig('clone_depth'); if (!is_null($depth)) { $cmd .= ' --depth ' . intval($depth) . ' '; } $cmd .= ' -b "%s" "%s" "%s"'; $success = $bu...
[ "protected", "function", "cloneByHttp", "(", "Builder", "$", "builder", ",", "$", "cloneTo", ")", "{", "$", "cmd", "=", "'git clone --recursive '", ";", "$", "depth", "=", "$", "builder", "->", "getConfig", "(", "'clone_depth'", ")", ";", "if", "(", "!", ...
Use an HTTP-based git clone.
[ "Use", "an", "HTTP", "-", "based", "git", "clone", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L53-L71
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.cloneBySsh
protected function cloneBySsh(Builder $builder, $cloneTo) { // Do the git clone: $cmd = 'git clone --recursive '; $depth = $builder->getConfig('clone_depth'); if (!is_null($depth)) { $cmd .= ' --depth ' . intval($depth) . ' '; } $cmd .= ' -b "%s" "%s" "...
php
protected function cloneBySsh(Builder $builder, $cloneTo) { // Do the git clone: $cmd = 'git clone --recursive '; $depth = $builder->getConfig('clone_depth'); if (!is_null($depth)) { $cmd .= ' --depth ' . intval($depth) . ' '; } $cmd .= ' -b "%s" "%s" "...
[ "protected", "function", "cloneBySsh", "(", "Builder", "$", "builder", ",", "$", "cloneTo", ")", "{", "// Do the git clone:", "$", "cmd", "=", "'git clone --recursive '", ";", "$", "depth", "=", "$", "builder", "->", "getConfig", "(", "'clone_depth'", ")", ";"...
Use an SSH-based git clone.
[ "Use", "an", "SSH", "-", "based", "git", "clone", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L76-L94
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.postCloneSetup
protected function postCloneSetup(Builder $builder, $cloneTo) { $success = true; $commit = $this->getCommitId(); $chdir = IS_WIN ? 'cd /d "%s"' : 'cd "%s"'; if (!empty($commit) && $commit != 'Manual') { $cmd = $chdir . ' && git checkout %s --quiet'; $success...
php
protected function postCloneSetup(Builder $builder, $cloneTo) { $success = true; $commit = $this->getCommitId(); $chdir = IS_WIN ? 'cd /d "%s"' : 'cd "%s"'; if (!empty($commit) && $commit != 'Manual') { $cmd = $chdir . ' && git checkout %s --quiet'; $success...
[ "protected", "function", "postCloneSetup", "(", "Builder", "$", "builder", ",", "$", "cloneTo", ")", "{", "$", "success", "=", "true", ";", "$", "commit", "=", "$", "this", "->", "getCommitId", "(", ")", ";", "$", "chdir", "=", "IS_WIN", "?", "'cd /d \...
Handle any post-clone tasks, like switching branches. @param Builder $builder @param $cloneTo @return bool
[ "Handle", "any", "post", "-", "clone", "tasks", "like", "switching", "branches", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L130-L148
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.writeSshKey
protected function writeSshKey($cloneTo) { $keyPath = dirname($cloneTo . '/temp'); $keyFile = $keyPath . '.key'; // Write the contents of this project's git key to the file: file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); chmod($keyFile, 0600); ...
php
protected function writeSshKey($cloneTo) { $keyPath = dirname($cloneTo . '/temp'); $keyFile = $keyPath . '.key'; // Write the contents of this project's git key to the file: file_put_contents($keyFile, $this->getProject()->getSshPrivateKey()); chmod($keyFile, 0600); ...
[ "protected", "function", "writeSshKey", "(", "$", "cloneTo", ")", "{", "$", "keyPath", "=", "dirname", "(", "$", "cloneTo", ".", "'/temp'", ")", ";", "$", "keyFile", "=", "$", "keyPath", ".", "'.key'", ";", "// Write the contents of this project's git key to the...
Create an SSH key file on disk for this build. @param $cloneTo @return string
[ "Create", "an", "SSH", "key", "file", "on", "disk", "for", "this", "build", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L155-L166
dancryer/PHPCI
PHPCI/Model/Build/RemoteGitBuild.php
RemoteGitBuild.writeSshWrapper
protected function writeSshWrapper($cloneTo, $keyFile) { $path = dirname($cloneTo . '/temp'); $wrapperFile = $path . '.sh'; $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; // Write out the wrapper script for this build...
php
protected function writeSshWrapper($cloneTo, $keyFile) { $path = dirname($cloneTo . '/temp'); $wrapperFile = $path . '.sh'; $sshFlags = '-o CheckHostIP=no -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -o PasswordAuthentication=no'; // Write out the wrapper script for this build...
[ "protected", "function", "writeSshWrapper", "(", "$", "cloneTo", ",", "$", "keyFile", ")", "{", "$", "path", "=", "dirname", "(", "$", "cloneTo", ".", "'/temp'", ")", ";", "$", "wrapperFile", "=", "$", "path", ".", "'.sh'", ";", "$", "sshFlags", "=", ...
Create an SSH wrapper script for Git to use, to disable host key checking, etc. @param $cloneTo @param $keyFile @return string
[ "Create", "an", "SSH", "wrapper", "script", "for", "Git", "to", "use", "to", "disable", "host", "key", "checking", "etc", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/RemoteGitBuild.php#L174-L192
dancryer/PHPCI
PHPCI/Command/DaemonCommand.php
DaemonCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->pidFilePath = $input->getOption('pid-file'); $this->logFilePath = $input->getOption('log-file'); $state = $input->getArgument('state'); switch ($state) { case 'start': $t...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->pidFilePath = $input->getOption('pid-file'); $this->logFilePath = $input->getOption('log-file'); $state = $input->getArgument('state'); switch ($state) { case 'start': $t...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "pidFilePath", "=", "$", "input", "->", "getOption", "(", "'pid-file'", ")", ";", "$", "this", "->", "logFilePath", ...
Loops through running.
[ "Loops", "through", "running", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/DaemonCommand.php#L83-L104
dancryer/PHPCI
PHPCI/Command/DaemonCommand.php
DaemonCommand.getRunningPid
protected function getRunningPid() { if (!file_exists($this->pidFilePath)) { return; } $pid = intval(trim(file_get_contents($this->pidFilePath))); if($this->processControl->isRunning($pid, true)) { return $pid; } // Not found, remove the sta...
php
protected function getRunningPid() { if (!file_exists($this->pidFilePath)) { return; } $pid = intval(trim(file_get_contents($this->pidFilePath))); if($this->processControl->isRunning($pid, true)) { return $pid; } // Not found, remove the sta...
[ "protected", "function", "getRunningPid", "(", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "pidFilePath", ")", ")", "{", "return", ";", "}", "$", "pid", "=", "intval", "(", "trim", "(", "file_get_contents", "(", "$", "this", "->", ...
Check if there is a running daemon @return int|null
[ "Check", "if", "there", "is", "a", "running", "daemon" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/DaemonCommand.php#L187-L201
dancryer/PHPCI
PHPCI/Plugin/PhpCodeSniffer.php
PhpCodeSniffer.execute
public function execute() { list($ignore, $standard, $suffixes) = $this->getFlags(); $phpcs = $this->phpci->findBinary('phpcs'); $this->phpci->logExecOutput(false); $cmd = $phpcs . ' --report=json %s %s %s %s %s "%s"'; $this->phpci->executeCommand( $cmd, ...
php
public function execute() { list($ignore, $standard, $suffixes) = $this->getFlags(); $phpcs = $this->phpci->findBinary('phpcs'); $this->phpci->logExecOutput(false); $cmd = $phpcs . ' --report=json %s %s %s %s %s "%s"'; $this->phpci->executeCommand( $cmd, ...
[ "public", "function", "execute", "(", ")", "{", "list", "(", "$", "ignore", ",", "$", "standard", ",", "$", "suffixes", ")", "=", "$", "this", "->", "getFlags", "(", ")", ";", "$", "phpcs", "=", "$", "this", "->", "phpci", "->", "findBinary", "(", ...
Runs PHP Code Sniffer in a specified directory, to a specified standard.
[ "Runs", "PHP", "Code", "Sniffer", "in", "a", "specified", "directory", "to", "a", "specified", "standard", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/PhpCodeSniffer.php#L147-L184
dancryer/PHPCI
PHPCI/Plugin/PhpCodeSniffer.php
PhpCodeSniffer.getFlags
protected function getFlags() { $ignore = ''; if (count($this->ignore)) { $ignore = ' --ignore=' . implode(',', $this->ignore); } if (strpos($this->standard, '/') !== false) { $standard = ' --standard='.$this->directory.$this->standard; } else { ...
php
protected function getFlags() { $ignore = ''; if (count($this->ignore)) { $ignore = ' --ignore=' . implode(',', $this->ignore); } if (strpos($this->standard, '/') !== false) { $standard = ' --standard='.$this->directory.$this->standard; } else { ...
[ "protected", "function", "getFlags", "(", ")", "{", "$", "ignore", "=", "''", ";", "if", "(", "count", "(", "$", "this", "->", "ignore", ")", ")", "{", "$", "ignore", "=", "' --ignore='", ".", "implode", "(", "','", ",", "$", "this", "->", "ignore"...
Process options and produce an arguments string for PHPCS. @return array
[ "Process", "options", "and", "produce", "an", "arguments", "string", "for", "PHPCS", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/PhpCodeSniffer.php#L190-L209
dancryer/PHPCI
PHPCI/Plugin/PhpCodeSniffer.php
PhpCodeSniffer.processReport
protected function processReport($output) { $data = json_decode(trim($output), true); if (!is_array($data)) { $this->phpci->log($output); throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report')); } $errors = $data['totals']['errors']; ...
php
protected function processReport($output) { $data = json_decode(trim($output), true); if (!is_array($data)) { $this->phpci->log($output); throw new \Exception(PHPCI\Helper\Lang::get('could_not_process_report')); } $errors = $data['totals']['errors']; ...
[ "protected", "function", "processReport", "(", "$", "output", ")", "{", "$", "data", "=", "json_decode", "(", "trim", "(", "$", "output", ")", ",", "true", ")", ";", "if", "(", "!", "is_array", "(", "$", "data", ")", ")", "{", "$", "this", "->", ...
Process the PHPCS output report. @param $output @return array @throws \Exception
[ "Process", "the", "PHPCS", "output", "report", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/PhpCodeSniffer.php#L217-L245
dancryer/PHPCI
PHPCI/Plugin/Phing.php
Phing.execute
public function execute() { $phingExecutable = $this->phpci->findBinary('phing'); $cmd[] = $phingExecutable . ' -f ' . $this->getBuildFilePath(); if ($this->getPropertyFile()) { $cmd[] = '-propertyfile ' . $this->getPropertyFile(); } $cmd[] = $this->propertiesT...
php
public function execute() { $phingExecutable = $this->phpci->findBinary('phing'); $cmd[] = $phingExecutable . ' -f ' . $this->getBuildFilePath(); if ($this->getPropertyFile()) { $cmd[] = '-propertyfile ' . $this->getPropertyFile(); } $cmd[] = $this->propertiesT...
[ "public", "function", "execute", "(", ")", "{", "$", "phingExecutable", "=", "$", "this", "->", "phpci", "->", "findBinary", "(", "'phing'", ")", ";", "$", "cmd", "[", "]", "=", "$", "phingExecutable", ".", "' -f '", ".", "$", "this", "->", "getBuildFi...
Executes Phing and runs a specified targets
[ "Executes", "Phing", "and", "runs", "a", "specified", "targets" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phing.php#L80-L97
dancryer/PHPCI
PHPCI/Plugin/Phing.php
Phing.setBuildFile
public function setBuildFile($buildFile) { if (!file_exists($this->getDirectory() . $buildFile)) { throw new \Exception(Lang::get('build_file_missing')); } $this->buildFile = $buildFile; }
php
public function setBuildFile($buildFile) { if (!file_exists($this->getDirectory() . $buildFile)) { throw new \Exception(Lang::get('build_file_missing')); } $this->buildFile = $buildFile; }
[ "public", "function", "setBuildFile", "(", "$", "buildFile", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "getDirectory", "(", ")", ".", "$", "buildFile", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "Lang", "::", "get", ...
@param mixed $buildFile @return $this @throws \Exception
[ "@param", "mixed", "$buildFile" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phing.php#L180-L187
dancryer/PHPCI
PHPCI/Plugin/Phing.php
Phing.setPropertyFile
public function setPropertyFile($propertyFile) { if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) { throw new \Exception(Lang::get('property_file_missing')); } $this->propertyFile = $propertyFile; }
php
public function setPropertyFile($propertyFile) { if (!file_exists($this->getDirectory() . DIRECTORY_SEPARATOR . $propertyFile)) { throw new \Exception(Lang::get('property_file_missing')); } $this->propertyFile = $propertyFile; }
[ "public", "function", "setPropertyFile", "(", "$", "propertyFile", ")", "{", "if", "(", "!", "file_exists", "(", "$", "this", "->", "getDirectory", "(", ")", ".", "DIRECTORY_SEPARATOR", ".", "$", "propertyFile", ")", ")", "{", "throw", "new", "\\", "Except...
@param string $propertyFile @return $this @throws \Exception
[ "@param", "string", "$propertyFile" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Phing.php#L256-L263
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.parse
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. $this->lines = array_map('rtrim', explode("\n", $this->tapString)); $this->lineNumber = 0; $this->testCount = false; ...
php
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. $this->lines = array_map('rtrim', explode("\n", $this->tapString)); $this->lineNumber = 0; $this->testCount = false; ...
[ "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.", "$", "this", "->", "lines", "=", "array_map", "(", "'rtrim'", ",", "explode", "(", "\"\\n\"", ","...
Parse a given TAP format string and return an array of tests and their status.
[ "Parse", "a", "given", "TAP", "format", "string", "and", "return", "an", "array", "of", "tests", "and", "their", "status", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L67-L94
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.findTapLog
protected function findTapLog() { // Look for the beginning of the TAP output do { $header = $this->nextLine(); } while ($header !== false && substr($header, 0, 12) !== 'TAP version '); // if ($header === false) { throw new Exception('No TAP log found...
php
protected function findTapLog() { // Look for the beginning of the TAP output do { $header = $this->nextLine(); } while ($header !== false && substr($header, 0, 12) !== 'TAP version '); // if ($header === false) { throw new Exception('No TAP log found...
[ "protected", "function", "findTapLog", "(", ")", "{", "// Look for the beginning of the TAP output", "do", "{", "$", "header", "=", "$", "this", "->", "nextLine", "(", ")", ";", "}", "while", "(", "$", "header", "!==", "false", "&&", "substr", "(", "$", "h...
Looks for the start of the TAP log in the string. @return string The TAP header line. @throws Exception if no TAP log is found or versions mismatch.
[ "Looks", "for", "the", "start", "of", "the", "TAP", "log", "in", "the", "string", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L102-L117
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.nextLine
protected function nextLine() { if ($this->lineNumber < count($this->lines)) { return $this->lines[$this->lineNumber++]; } return false; }
php
protected function nextLine() { if ($this->lineNumber < count($this->lines)) { return $this->lines[$this->lineNumber++]; } return false; }
[ "protected", "function", "nextLine", "(", ")", "{", "if", "(", "$", "this", "->", "lineNumber", "<", "count", "(", "$", "this", "->", "lines", ")", ")", "{", "return", "$", "this", "->", "lines", "[", "$", "this", "->", "lineNumber", "++", "]", ";"...
Fetch the next line. @return string|false The next line or false if the end has been reached.
[ "Fetch", "the", "next", "line", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L123-L129
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.yamlLine
protected function yamlLine($line) { if (preg_match(self::TEST_YAML_START, $line, $matches)) { $diagnostic = $this->processYamlBlock($matches[1]); $test = array_pop($this->results); if (isset($test['message'], $diagnostic['message'])) { $test['messag...
php
protected function yamlLine($line) { if (preg_match(self::TEST_YAML_START, $line, $matches)) { $diagnostic = $this->processYamlBlock($matches[1]); $test = array_pop($this->results); if (isset($test['message'], $diagnostic['message'])) { $test['messag...
[ "protected", "function", "yamlLine", "(", "$", "line", ")", "{", "if", "(", "preg_match", "(", "self", "::", "TEST_YAML_START", ",", "$", "line", ",", "$", "matches", ")", ")", "{", "$", "diagnostic", "=", "$", "this", "->", "processYamlBlock", "(", "$...
@param string $line @return boolean
[ "@param", "string", "$line" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L174-L189
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.parseLine
protected function parseLine($line) { if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) { return; } if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) { $this->testCount = intval($matches[1]); retu...
php
protected function parseLine($line) { if (preg_match(self::TEST_DIAGNOSTIC, $line) || preg_match(self::TEST_COVERAGE, $line) || !$line) { return; } if (preg_match(self::TEST_COUNTS_PATTERN, $line, $matches)) { $this->testCount = intval($matches[1]); retu...
[ "protected", "function", "parseLine", "(", "$", "line", ")", "{", "if", "(", "preg_match", "(", "self", "::", "TEST_DIAGNOSTIC", ",", "$", "line", ")", "||", "preg_match", "(", "self", "::", "TEST_COVERAGE", ",", "$", "line", ")", "||", "!", "$", "line...
Parse a single line. @param string $line @throws Exception
[ "Parse", "a", "single", "line", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L197-L222
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.processYamlBlock
protected function processYamlBlock($indent) { $startLine = $this->lineNumber + 1; $endLine = $indent . '...'; $yamlLines = array(); do { $line = $this->nextLine(); if ($line === false) { throw new Exception(Lang::get('tap_error_endless_yam...
php
protected function processYamlBlock($indent) { $startLine = $this->lineNumber + 1; $endLine = $indent . '...'; $yamlLines = array(); do { $line = $this->nextLine(); if ($line === false) { throw new Exception(Lang::get('tap_error_endless_yam...
[ "protected", "function", "processYamlBlock", "(", "$", "indent", ")", "{", "$", "startLine", "=", "$", "this", "->", "lineNumber", "+", "1", ";", "$", "endLine", "=", "$", "indent", ".", "'...'", ";", "$", "yamlLines", "=", "array", "(", ")", ";", "d...
Process an indented Yaml block. @param string $indent The block indentation to ignore. @return array The processed Yaml content.
[ "Process", "an", "indented", "Yaml", "block", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L261-L280
dancryer/PHPCI
PHPCI/Plugin/Util/TapParser.php
TapParser.processDirective
protected function processDirective($test, $directive, $reason) { $test['severity'] = strtolower($directive) === 'skip' ? 'skipped' : 'todo'; if (!empty($reason)) { if (!empty($test['message'])) { $test['message'] .= ', '.$test['severity'].': '; } ...
php
protected function processDirective($test, $directive, $reason) { $test['severity'] = strtolower($directive) === 'skip' ? 'skipped' : 'todo'; if (!empty($reason)) { if (!empty($test['message'])) { $test['message'] .= ', '.$test['severity'].': '; } ...
[ "protected", "function", "processDirective", "(", "$", "test", ",", "$", "directive", ",", "$", "reason", ")", "{", "$", "test", "[", "'severity'", "]", "=", "strtolower", "(", "$", "directive", ")", "===", "'skip'", "?", "'skipped'", ":", "'todo'", ";",...
Process a TAP directive @param array $test @param string $directive @param string $reason @return array
[ "Process", "a", "TAP", "directive" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Util/TapParser.php#L289-L301
dancryer/PHPCI
PHPCI/Helper/BuildInterpolator.php
BuildInterpolator.setupInterpolationVars
public function setupInterpolationVars(Build $build, $buildPath, $phpCiUrl) { $this->interpolation_vars = array(); $this->interpolation_vars['%PHPCI%'] = 1; $this->interpolation_vars['%COMMIT%'] = $build->getCommitId(); $this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->get...
php
public function setupInterpolationVars(Build $build, $buildPath, $phpCiUrl) { $this->interpolation_vars = array(); $this->interpolation_vars['%PHPCI%'] = 1; $this->interpolation_vars['%COMMIT%'] = $build->getCommitId(); $this->interpolation_vars['%SHORT_COMMIT%'] = substr($build->get...
[ "public", "function", "setupInterpolationVars", "(", "Build", "$", "build", ",", "$", "buildPath", ",", "$", "phpCiUrl", ")", "{", "$", "this", "->", "interpolation_vars", "=", "array", "(", ")", ";", "$", "this", "->", "interpolation_vars", "[", "'%PHPCI%'"...
Sets the variables that will be used for interpolation. @param Build $build @param string $buildPath @param string $phpCiUrl
[ "Sets", "the", "variables", "that", "will", "be", "used", "for", "interpolation", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/BuildInterpolator.php#L34-L74
dancryer/PHPCI
PHPCI/Helper/BuildInterpolator.php
BuildInterpolator.interpolate
public function interpolate($input) { $keys = array_keys($this->interpolation_vars); $values = array_values($this->interpolation_vars); return str_replace($keys, $values, $input); }
php
public function interpolate($input) { $keys = array_keys($this->interpolation_vars); $values = array_values($this->interpolation_vars); return str_replace($keys, $values, $input); }
[ "public", "function", "interpolate", "(", "$", "input", ")", "{", "$", "keys", "=", "array_keys", "(", "$", "this", "->", "interpolation_vars", ")", ";", "$", "values", "=", "array_values", "(", "$", "this", "->", "interpolation_vars", ")", ";", "return", ...
Replace every occurrence of the interpolation vars in the given string Example: "This is build %PHPCI_BUILD%" => "This is build 182" @param string $input @return string
[ "Replace", "every", "occurrence", "of", "the", "interpolation", "vars", "in", "the", "given", "string", "Example", ":", "This", "is", "build", "%PHPCI_BUILD%", "=", ">", "This", "is", "build", "182" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Helper/BuildInterpolator.php#L82-L87
dancryer/PHPCI
PHPCI/Logging/Handler.php
Handler.register
public static function register(LoggerInterface $logger = null) { $handler = new static($logger); set_error_handler(array($handler, 'handleError')); register_shutdown_function(array($handler, 'handleFatalError')); set_exception_handler(array($handler, 'handleException')); }
php
public static function register(LoggerInterface $logger = null) { $handler = new static($logger); set_error_handler(array($handler, 'handleError')); register_shutdown_function(array($handler, 'handleFatalError')); set_exception_handler(array($handler, 'handleException')); }
[ "public", "static", "function", "register", "(", "LoggerInterface", "$", "logger", "=", "null", ")", "{", "$", "handler", "=", "new", "static", "(", "$", "logger", ")", ";", "set_error_handler", "(", "array", "(", "$", "handler", ",", "'handleError'", ")",...
Register a new log handler. @param LoggerInterface $logger
[ "Register", "a", "new", "log", "handler", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/Handler.php#L52-L60
dancryer/PHPCI
PHPCI/Logging/Handler.php
Handler.handleError
public function handleError($level, $message, $file, $line) { if (error_reporting() & $level) { $exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level; throw new \ErrorException( sprintf('%s: %s in %s line %d', $exception_level, $message, $f...
php
public function handleError($level, $message, $file, $line) { if (error_reporting() & $level) { $exception_level = isset($this->levels[$level]) ? $this->levels[$level] : $level; throw new \ErrorException( sprintf('%s: %s in %s line %d', $exception_level, $message, $f...
[ "public", "function", "handleError", "(", "$", "level", ",", "$", "message", ",", "$", "file", ",", "$", "line", ")", "{", "if", "(", "error_reporting", "(", ")", "&", "$", "level", ")", "{", "$", "exception_level", "=", "isset", "(", "$", "this", ...
@param integer $level @param string $message @param string $file @param integer $line @throws \ErrorException
[ "@param", "integer", "$level", "@param", "string", "$message", "@param", "string", "$file", "@param", "integer", "$line" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/Handler.php#L70-L83
dancryer/PHPCI
PHPCI/Logging/Handler.php
Handler.log
protected function log(\Exception $exception) { if (null !== $this->logger) { $message = sprintf( '%s: %s (uncaught exception) at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $...
php
protected function log(\Exception $exception) { if (null !== $this->logger) { $message = sprintf( '%s: %s (uncaught exception) at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $...
[ "protected", "function", "log", "(", "\\", "Exception", "$", "exception", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "logger", ")", "{", "$", "message", "=", "sprintf", "(", "'%s: %s (uncaught exception) at %s line %s'", ",", "get_class", "(", "$...
Write to the build log. @param \Exception $exception
[ "Write", "to", "the", "build", "log", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/Handler.php#L139-L152
dancryer/PHPCI
PHPCI/Model/Build.php
Build.storeMeta
public function storeMeta($key, $value) { $value = json_encode($value); Factory::getStore('Build')->setMeta($this->getProjectId(), $this->getId(), $key, $value); }
php
public function storeMeta($key, $value) { $value = json_encode($value); Factory::getStore('Build')->setMeta($this->getProjectId(), $this->getId(), $key, $value); }
[ "public", "function", "storeMeta", "(", "$", "key", ",", "$", "value", ")", "{", "$", "value", "=", "json_encode", "(", "$", "value", ")", ";", "Factory", "::", "getStore", "(", "'Build'", ")", "->", "setMeta", "(", "$", "this", "->", "getProjectId", ...
Store build metadata
[ "Store", "build", "metadata" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L78-L82
dancryer/PHPCI
PHPCI/Model/Build.php
Build.handleConfig
protected function handleConfig(Builder $builder, $buildPath) { $build_config = null; // Try getting the project build config from the database: if (empty($build_config)) { $build_config = $this->getProject()->getBuildConfig(); } // Try .phpci.yml if (is...
php
protected function handleConfig(Builder $builder, $buildPath) { $build_config = null; // Try getting the project build config from the database: if (empty($build_config)) { $build_config = $this->getProject()->getBuildConfig(); } // Try .phpci.yml if (is...
[ "protected", "function", "handleConfig", "(", "Builder", "$", "builder", ",", "$", "buildPath", ")", "{", "$", "build_config", "=", "null", ";", "// Try getting the project build config from the database:", "if", "(", "empty", "(", "$", "build_config", ")", ")", "...
@param Builder $builder @param string $buildPath @return bool
[ "@param", "Builder", "$builder", "@param", "string", "$buildPath" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L98-L129
dancryer/PHPCI
PHPCI/Model/Build.php
Build.getZeroConfigPlugins
protected function getZeroConfigPlugins(Builder $builder) { $pluginDir = PHPCI_DIR . 'PHPCI/Plugin/'; $dir = new \DirectoryIterator($pluginDir); $config = array( 'build_settings' => array( 'ignore' => array( 'vendor', ) ...
php
protected function getZeroConfigPlugins(Builder $builder) { $pluginDir = PHPCI_DIR . 'PHPCI/Plugin/'; $dir = new \DirectoryIterator($pluginDir); $config = array( 'build_settings' => array( 'ignore' => array( 'vendor', ) ...
[ "protected", "function", "getZeroConfigPlugins", "(", "Builder", "$", "builder", ")", "{", "$", "pluginDir", "=", "PHPCI_DIR", ".", "'PHPCI/Plugin/'", ";", "$", "dir", "=", "new", "\\", "DirectoryIterator", "(", "$", "pluginDir", ")", ";", "$", "config", "="...
Get an array of plugins to run if there's no phpci.yml file. @param Builder $builder @return array
[ "Get", "an", "array", "of", "plugins", "to", "run", "if", "there", "s", "no", "phpci", ".", "yml", "file", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L136-L180
dancryer/PHPCI
PHPCI/Model/Build.php
Build.getExtra
public function getExtra($key = null) { $data = json_decode($this->data['extra'], true); if (is_null($key)) { $rtn = $data; } elseif (isset($data[$key])) { $rtn = $data[$key]; } else { $rtn = null; } return $rtn; }
php
public function getExtra($key = null) { $data = json_decode($this->data['extra'], true); if (is_null($key)) { $rtn = $data; } elseif (isset($data[$key])) { $rtn = $data[$key]; } else { $rtn = null; } return $rtn; }
[ "public", "function", "getExtra", "(", "$", "key", "=", "null", ")", "{", "$", "data", "=", "json_decode", "(", "$", "this", "->", "data", "[", "'extra'", "]", ",", "true", ")", ";", "if", "(", "is_null", "(", "$", "key", ")", ")", "{", "$", "r...
Return a value from the build's "extra" JSON array. @param null $key @return mixed|null|string
[ "Return", "a", "value", "from", "the", "build", "s", "extra", "JSON", "array", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L187-L200
dancryer/PHPCI
PHPCI/Model/Build.php
Build.reportError
public function reportError( Builder $builder, $plugin, $message, $severity = BuildError::SEVERITY_NORMAL, $file = null, $lineStart = null, $lineEnd = null ) { unset($builder); $error = new BuildError(); $error->setBuild($this); ...
php
public function reportError( Builder $builder, $plugin, $message, $severity = BuildError::SEVERITY_NORMAL, $file = null, $lineStart = null, $lineEnd = null ) { unset($builder); $error = new BuildError(); $error->setBuild($this); ...
[ "public", "function", "reportError", "(", "Builder", "$", "builder", ",", "$", "plugin", ",", "$", "message", ",", "$", "severity", "=", "BuildError", "::", "SEVERITY_NORMAL", ",", "$", "file", "=", "null", ",", "$", "lineStart", "=", "null", ",", "$", ...
Allows specific build types (e.g. Github) to report violations back to their respective services. @param Builder $builder @param $plugin @param $message @param int $severity @param null $file @param null $lineStart @param null $lineEnd @return BuildError
[ "Allows", "specific", "build", "types", "(", "e", ".", "g", ".", "Github", ")", "to", "report", "violations", "back", "to", "their", "respective", "services", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L224-L247
dancryer/PHPCI
PHPCI/Model/Build.php
Build.getBuildPath
public function getBuildPath() { if (!$this->getId()) { return null; } if (empty($this->currentBuildPath)) { $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5); $this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DI...
php
public function getBuildPath() { if (!$this->getId()) { return null; } if (empty($this->currentBuildPath)) { $buildDirectory = $this->getId() . '_' . substr(md5(microtime(true)), 0, 5); $this->currentBuildPath = PHPCI_BUILD_ROOT_DIR . $buildDirectory . DI...
[ "public", "function", "getBuildPath", "(", ")", "{", "if", "(", "!", "$", "this", "->", "getId", "(", ")", ")", "{", "return", "null", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "currentBuildPath", ")", ")", "{", "$", "buildDirectory", "...
Return the path to run this build into. @return string|null
[ "Return", "the", "path", "to", "run", "this", "build", "into", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L254-L266
dancryer/PHPCI
PHPCI/Model/Build.php
Build.removeBuildDirectory
public function removeBuildDirectory() { // Get the path and remove the trailing slash as this may prompt PHP // to see this as a directory even if it's a link. $buildPath = rtrim($this->getBuildPath(), '/'); if (!$buildPath || !is_dir($buildPath)) { return; } ...
php
public function removeBuildDirectory() { // Get the path and remove the trailing slash as this may prompt PHP // to see this as a directory even if it's a link. $buildPath = rtrim($this->getBuildPath(), '/'); if (!$buildPath || !is_dir($buildPath)) { return; } ...
[ "public", "function", "removeBuildDirectory", "(", ")", "{", "// Get the path and remove the trailing slash as this may prompt PHP", "// to see this as a directory even if it's a link.", "$", "buildPath", "=", "rtrim", "(", "$", "this", "->", "getBuildPath", "(", ")", ",", "'...
Removes the build directory.
[ "Removes", "the", "build", "directory", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L271-L287
dancryer/PHPCI
PHPCI/Model/Build.php
Build.getDuration
public function getDuration() { $start = $this->getStarted(); if (empty($start)) { return 0; } $end = $this->getFinished(); if (empty($end)) { $end = new \DateTime(); } return $end->getTimestamp() - $start->getTimestamp(); }
php
public function getDuration() { $start = $this->getStarted(); if (empty($start)) { return 0; } $end = $this->getFinished(); if (empty($end)) { $end = new \DateTime(); } return $end->getTimestamp() - $start->getTimestamp(); }
[ "public", "function", "getDuration", "(", ")", "{", "$", "start", "=", "$", "this", "->", "getStarted", "(", ")", ";", "if", "(", "empty", "(", "$", "start", ")", ")", "{", "return", "0", ";", "}", "$", "end", "=", "$", "this", "->", "getFinished...
Get the number of seconds a build has been running for. @return int
[ "Get", "the", "number", "of", "seconds", "a", "build", "has", "been", "running", "for", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build.php#L293-L308
dancryer/PHPCI
PHPCI/Plugin/Xmpp.php
XMPP.getConfigFormat
protected function getConfigFormat() { $conf = $this->username; if (!empty($this->server)) { $conf .= ';'.$this->server; } $conf .= ' '.$this->password; if (!empty($this->alias)) { $conf .= ' '.$this->alias; } return $conf; }
php
protected function getConfigFormat() { $conf = $this->username; if (!empty($this->server)) { $conf .= ';'.$this->server; } $conf .= ' '.$this->password; if (!empty($this->alias)) { $conf .= ' '.$this->alias; } return $conf; }
[ "protected", "function", "getConfigFormat", "(", ")", "{", "$", "conf", "=", "$", "this", "->", "username", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "server", ")", ")", "{", "$", "conf", ".=", "';'", ".", "$", "this", "->", "server", ...
Get config format for sendxmpp config file @return string
[ "Get", "config", "format", "for", "sendxmpp", "config", "file" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Xmpp.php#L114-L128
dancryer/PHPCI
PHPCI/Plugin/Xmpp.php
XMPP.findConfigFile
public function findConfigFile() { if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) { if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) !== md5($this->getConfigFormat())) { return null; ...
php
public function findConfigFile() { if (file_exists($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) { if (md5(file_get_contents($this->phpci->buildPath . DIRECTORY_SEPARATOR . '.sendxmpprc')) !== md5($this->getConfigFormat())) { return null; ...
[ "public", "function", "findConfigFile", "(", ")", "{", "if", "(", "file_exists", "(", "$", "this", "->", "phpci", "->", "buildPath", ".", "DIRECTORY_SEPARATOR", ".", "'.sendxmpprc'", ")", ")", "{", "if", "(", "md5", "(", "file_get_contents", "(", "$", "thi...
Find config file for sendxmpp binary (default is .sendxmpprc)
[ "Find", "config", "file", "for", "sendxmpp", "binary", "(", "default", "is", ".", "sendxmpprc", ")" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Xmpp.php#L133-L145
dancryer/PHPCI
PHPCI/Plugin/Xmpp.php
XMPP.execute
public function execute() { $sendxmpp = $this->phpci->findBinary('sendxmpp'); /* * Without recipients we can't send notification */ if (count($this->recipients) == 0) { return false; } /* * Try to build conf file */ $c...
php
public function execute() { $sendxmpp = $this->phpci->findBinary('sendxmpp'); /* * Without recipients we can't send notification */ if (count($this->recipients) == 0) { return false; } /* * Try to build conf file */ $c...
[ "public", "function", "execute", "(", ")", "{", "$", "sendxmpp", "=", "$", "this", "->", "phpci", "->", "findBinary", "(", "'sendxmpp'", ")", ";", "/*\n * Without recipients we can't send notification\n */", "if", "(", "count", "(", "$", "this", "-...
Send notification message.
[ "Send", "notification", "message", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Plugin/Xmpp.php#L150-L199
dancryer/PHPCI
PHPCI/Logging/BuildLogger.php
BuildLogger.log
public function log($message, $level = LogLevel::INFO, $context = array()) { // Skip if no logger has been loaded. if (!$this->logger) { return; } if (!is_array($message)) { $message = array($message); } // The build is added to the context s...
php
public function log($message, $level = LogLevel::INFO, $context = array()) { // Skip if no logger has been loaded. if (!$this->logger) { return; } if (!is_array($message)) { $message = array($message); } // The build is added to the context s...
[ "public", "function", "log", "(", "$", "message", ",", "$", "level", "=", "LogLevel", "::", "INFO", ",", "$", "context", "=", "array", "(", ")", ")", "{", "// Skip if no logger has been loaded.", "if", "(", "!", "$", "this", "->", "logger", ")", "{", "...
Add an entry to the build log. @param string|string[] $message @param string $level @param mixed[] $context
[ "Add", "an", "entry", "to", "the", "build", "log", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/BuildLogger.php#L50-L68
dancryer/PHPCI
PHPCI/Logging/BuildLogger.php
BuildLogger.logFailure
public function logFailure($message, \Exception $exception = null) { $context = array(); // The psr3 log interface stipulates that exceptions should be passed // as the exception key in the context array. if ($exception) { $context['exception'] = $exception; } ...
php
public function logFailure($message, \Exception $exception = null) { $context = array(); // The psr3 log interface stipulates that exceptions should be passed // as the exception key in the context array. if ($exception) { $context['exception'] = $exception; } ...
[ "public", "function", "logFailure", "(", "$", "message", ",", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "$", "context", "=", "array", "(", ")", ";", "// The psr3 log interface stipulates that exceptions should be passed", "// as the exception key in th...
Add a failure-coloured message to the log. @param string $message @param \Exception $exception The exception that caused the error.
[ "Add", "a", "failure", "-", "coloured", "message", "to", "the", "log", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Logging/BuildLogger.php#L84-L99
dancryer/PHPCI
PHPCI/Command/CreateBuildCommand.php
CreateBuildCommand.configure
protected function configure() { $this ->setName('phpci:create-build') ->setDescription(Lang::get('create_build_project')) ->addArgument('projectId', InputArgument::REQUIRED, Lang::get('project_id_argument')) ->addOption('commit', null, InputOption::VALUE_OPTI...
php
protected function configure() { $this ->setName('phpci:create-build') ->setDescription(Lang::get('create_build_project')) ->addArgument('projectId', InputArgument::REQUIRED, Lang::get('project_id_argument')) ->addOption('commit', null, InputOption::VALUE_OPTI...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "'phpci:create-build'", ")", "->", "setDescription", "(", "Lang", "::", "get", "(", "'create_build_project'", ")", ")", "->", "addArgument", "(", "'projectId'", ",", "Input...
{@inheritDoc}
[ "{" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/CreateBuildCommand.php#L53-L61
dancryer/PHPCI
PHPCI/Command/CreateBuildCommand.php
CreateBuildCommand.execute
public function execute(InputInterface $input, OutputInterface $output) { $projectId = $input->getArgument('projectId'); $commitId = $input->getOption('commit'); $branch = $input->getOption('branch'); $project = $this->projectStore->getById($projectId); if (empty($project)) ...
php
public function execute(InputInterface $input, OutputInterface $output) { $projectId = $input->getArgument('projectId'); $commitId = $input->getOption('commit'); $branch = $input->getOption('branch'); $project = $this->projectStore->getById($projectId); if (empty($project)) ...
[ "public", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "projectId", "=", "$", "input", "->", "getArgument", "(", "'projectId'", ")", ";", "$", "commitId", "=", "$", "input", "->", "getOpt...
{@inheritDoc}
[ "{" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Command/CreateBuildCommand.php#L66-L84
dancryer/PHPCI
PHPCI/ProcessControl/UnixProcessControl.php
UnixProcessControl.isRunning
public function isRunning($pid) { $output = $exitCode = null; exec(sprintf("ps %d", $pid), $output, $exitCode); return $exitCode === 0; }
php
public function isRunning($pid) { $output = $exitCode = null; exec(sprintf("ps %d", $pid), $output, $exitCode); return $exitCode === 0; }
[ "public", "function", "isRunning", "(", "$", "pid", ")", "{", "$", "output", "=", "$", "exitCode", "=", "null", ";", "exec", "(", "sprintf", "(", "\"ps %d\"", ",", "$", "pid", ")", ",", "$", "output", ",", "$", "exitCode", ")", ";", "return", "$", ...
Check process using the "ps" command. @param int $pid @return boolean
[ "Check", "process", "using", "the", "ps", "command", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/ProcessControl/UnixProcessControl.php#L25-L30
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.sendStatusPostback
public function sendStatusPostback() { $token = \b8\Config::getInstance()->get('phpci.github.token'); if (empty($token) || empty($this->data['id'])) { return; } $project = $this->getProject(); if (empty($project)) { return; } $ur...
php
public function sendStatusPostback() { $token = \b8\Config::getInstance()->get('phpci.github.token'); if (empty($token) || empty($this->data['id'])) { return; } $project = $this->getProject(); if (empty($project)) { return; } $ur...
[ "public", "function", "sendStatusPostback", "(", ")", "{", "$", "token", "=", "\\", "b8", "\\", "Config", "::", "getInstance", "(", ")", "->", "get", "(", "'phpci.github.token'", ")", ";", "if", "(", "empty", "(", "$", "token", ")", "||", "empty", "(",...
Send status updates to any relevant third parties (i.e. Github)
[ "Send", "status", "updates", "to", "any", "relevant", "third", "parties", "(", "i", ".", "e", ".", "Github", ")" ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L44-L97
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.getCloneUrl
protected function getCloneUrl() { $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { return 'git@github.com:' . $this->getProject()->getReference() . '.git'; } else { return 'https://github.com/' . $this->getProject()->getReference() . '.git';...
php
protected function getCloneUrl() { $key = trim($this->getProject()->getSshPrivateKey()); if (!empty($key)) { return 'git@github.com:' . $this->getProject()->getReference() . '.git'; } else { return 'https://github.com/' . $this->getProject()->getReference() . '.git';...
[ "protected", "function", "getCloneUrl", "(", ")", "{", "$", "key", "=", "trim", "(", "$", "this", "->", "getProject", "(", ")", "->", "getSshPrivateKey", "(", ")", ")", ";", "if", "(", "!", "empty", "(", "$", "key", ")", ")", "{", "return", "'git@g...
Get the URL to be used to clone this remote repository.
[ "Get", "the", "URL", "to", "be", "used", "to", "clone", "this", "remote", "repository", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L102-L111
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.getCommitMessage
public function getCommitMessage() { $rtn = parent::getCommitMessage($this->data['commit_message']); $project = $this->getProject(); if (!is_null($project)) { $reference = $project->getReference(); $commitLink = '<a target="_blank" href="https://github.com/' . $refe...
php
public function getCommitMessage() { $rtn = parent::getCommitMessage($this->data['commit_message']); $project = $this->getProject(); if (!is_null($project)) { $reference = $project->getReference(); $commitLink = '<a target="_blank" href="https://github.com/' . $refe...
[ "public", "function", "getCommitMessage", "(", ")", "{", "$", "rtn", "=", "parent", "::", "getCommitMessage", "(", "$", "this", "->", "data", "[", "'commit_message'", "]", ")", ";", "$", "project", "=", "$", "this", "->", "getProject", "(", ")", ";", "...
Get a parsed version of the commit message, with links to issues and commits. @return string
[ "Get", "a", "parsed", "version", "of", "the", "commit", "message", "with", "links", "to", "issues", "and", "commits", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L117-L131
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.getFileLinkTemplate
public function getFileLinkTemplate() { $reference = $this->getProject()->getReference(); $branch = $this->getBranch(); if ($this->getExtra('build_type') == 'pull_request') { $matches = array(); preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra(...
php
public function getFileLinkTemplate() { $reference = $this->getProject()->getReference(); $branch = $this->getBranch(); if ($this->getExtra('build_type') == 'pull_request') { $matches = array(); preg_match('/[\/:]([a-zA-Z0-9_\-]+\/[a-zA-Z0-9_\-]+)/', $this->getExtra(...
[ "public", "function", "getFileLinkTemplate", "(", ")", "{", "$", "reference", "=", "$", "this", "->", "getProject", "(", ")", "->", "getReference", "(", ")", ";", "$", "branch", "=", "$", "this", "->", "getBranch", "(", ")", ";", "if", "(", "$", "thi...
Get a template to use for generating links to files. e.g. https://github.com/block8/phpci/blob/master/{FILE}#L{LINE} @return string
[ "Get", "a", "template", "to", "use", "for", "generating", "links", "to", "files", ".", "e", ".", "g", ".", "https", ":", "//", "github", ".", "com", "/", "block8", "/", "phpci", "/", "blob", "/", "master", "/", "{", "FILE", "}", "#L", "{", "LINE"...
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L138-L157
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.postCloneSetup
protected function postCloneSetup(Builder $builder, $cloneTo) { $buildType = $this->getExtra('build_type'); $success = true; try { if (!empty($buildType) && $buildType == 'pull_request') { $remoteUrl = $this->getExtra('remote_url'); $remoteBranch...
php
protected function postCloneSetup(Builder $builder, $cloneTo) { $buildType = $this->getExtra('build_type'); $success = true; try { if (!empty($buildType) && $buildType == 'pull_request') { $remoteUrl = $this->getExtra('remote_url'); $remoteBranch...
[ "protected", "function", "postCloneSetup", "(", "Builder", "$", "builder", ",", "$", "cloneTo", ")", "{", "$", "buildType", "=", "$", "this", "->", "getExtra", "(", "'build_type'", ")", ";", "$", "success", "=", "true", ";", "try", "{", "if", "(", "!",...
Handle any post-clone tasks, like applying a pull request patch on top of the branch. @param Builder $builder @param $cloneTo @return bool
[ "Handle", "any", "post", "-", "clone", "tasks", "like", "applying", "a", "pull", "request", "patch", "on", "top", "of", "the", "branch", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L165-L192
dancryer/PHPCI
PHPCI/Model/Build/GithubBuild.php
GithubBuild.getDiffLineNumber
protected function getDiffLineNumber(Builder $builder, $file, $line) { $line = (integer)$line; $builder->logExecOutput(false); $prNumber = $this->getExtra('pull_request_number'); $path = $builder->buildPath; if (!empty($prNumber)) { $builder->executeCommand('cd...
php
protected function getDiffLineNumber(Builder $builder, $file, $line) { $line = (integer)$line; $builder->logExecOutput(false); $prNumber = $this->getExtra('pull_request_number'); $path = $builder->buildPath; if (!empty($prNumber)) { $builder->executeCommand('cd...
[ "protected", "function", "getDiffLineNumber", "(", "Builder", "$", "builder", ",", "$", "file", ",", "$", "line", ")", "{", "$", "line", "=", "(", "integer", ")", "$", "line", ";", "$", "builder", "->", "logExecOutput", "(", "false", ")", ";", "$", "...
Uses git diff to figure out what the diff line position is, based on the error line number. @param Builder $builder @param $file @param $line @return int|null
[ "Uses", "git", "diff", "to", "figure", "out", "what", "the", "diff", "line", "position", "is", "based", "on", "the", "error", "line", "number", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Model/Build/GithubBuild.php#L232-L257
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.view
public function view($projectId) { $branch = $this->getParam('branch', ''); $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } $per_page = 10; $page ...
php
public function view($projectId) { $branch = $this->getParam('branch', ''); $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } $per_page = 10; $page ...
[ "public", "function", "view", "(", "$", "projectId", ")", "{", "$", "branch", "=", "$", "this", "->", "getParam", "(", "'branch'", ",", "''", ")", ";", "$", "project", "=", "$", "this", "->", "projectStore", "->", "getById", "(", "$", "projectId", ")...
View a specific project.
[ "View", "a", "specific", "project", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L66-L98
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.build
public function build($projectId, $branch = '') { /* @var \PHPCI\Model\Project $project */ $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } if ($branch ...
php
public function build($projectId, $branch = '') { /* @var \PHPCI\Model\Project $project */ $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } if ($branch ...
[ "public", "function", "build", "(", "$", "projectId", ",", "$", "branch", "=", "''", ")", "{", "/* @var \\PHPCI\\Model\\Project $project */", "$", "project", "=", "$", "this", "->", "projectStore", "->", "getById", "(", "$", "projectId", ")", ";", "if", "(",...
Create a new pending build for a project.
[ "Create", "a", "new", "pending", "build", "for", "a", "project", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L103-L130
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.delete
public function delete($projectId) { $this->requireAdmin(); $project = $this->projectStore->getById($projectId); $this->projectService->deleteProject($project); $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', PHPCI_URL); return ...
php
public function delete($projectId) { $this->requireAdmin(); $project = $this->projectStore->getById($projectId); $this->projectService->deleteProject($project); $response = new b8\Http\Response\RedirectResponse(); $response->setHeader('Location', PHPCI_URL); return ...
[ "public", "function", "delete", "(", "$", "projectId", ")", "{", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "project", "=", "$", "this", "->", "projectStore", "->", "getById", "(", "$", "projectId", ")", ";", "$", "this", "->", "projectServ...
Delete a project.
[ "Delete", "a", "project", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L135-L145
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.builds
public function builds($projectId) { $branch = $this->getParam('branch', ''); $builds = $this->getLatestBuildsHtml($projectId, urldecode($branch)); $this->response->disableLayout(); $this->response->setContent($builds[0]); return $this->response; }
php
public function builds($projectId) { $branch = $this->getParam('branch', ''); $builds = $this->getLatestBuildsHtml($projectId, urldecode($branch)); $this->response->disableLayout(); $this->response->setContent($builds[0]); return $this->response; }
[ "public", "function", "builds", "(", "$", "projectId", ")", "{", "$", "branch", "=", "$", "this", "->", "getParam", "(", "'branch'", ",", "''", ")", ";", "$", "builds", "=", "$", "this", "->", "getLatestBuildsHtml", "(", "$", "projectId", ",", "urldeco...
AJAX get latest builds.
[ "AJAX", "get", "latest", "builds", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L150-L158
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.add
public function add() { $this->layout->title = Lang::get('add_project'); $this->requireAdmin(); $method = $this->request->getMethod(); $pub = null; $values = $this->getParams(); if ($method != 'POST') { $sshKey = new SshKey(); $key = $sshKey...
php
public function add() { $this->layout->title = Lang::get('add_project'); $this->requireAdmin(); $method = $this->request->getMethod(); $pub = null; $values = $this->getParams(); if ($method != 'POST') { $sshKey = new SshKey(); $key = $sshKey...
[ "public", "function", "add", "(", ")", "{", "$", "this", "->", "layout", "->", "title", "=", "Lang", "::", "get", "(", "'add_project'", ")", ";", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "method", "=", "$", "this", "->", "request", "-...
Add a new project. Handles both the form, and processing.
[ "Add", "a", "new", "project", ".", "Handles", "both", "the", "form", "and", "processing", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L191-L240
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.edit
public function edit($projectId) { $this->requireAdmin(); $method = $this->request->getMethod(); $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } $th...
php
public function edit($projectId) { $this->requireAdmin(); $method = $this->request->getMethod(); $project = $this->projectStore->getById($projectId); if (empty($project)) { throw new NotFoundException(Lang::get('project_x_not_found', $projectId)); } $th...
[ "public", "function", "edit", "(", "$", "projectId", ")", "{", "$", "this", "->", "requireAdmin", "(", ")", ";", "$", "method", "=", "$", "this", "->", "request", "->", "getMethod", "(", ")", ";", "$", "project", "=", "$", "this", "->", "projectStore...
Edit a project. Handles both the form and processing.
[ "Edit", "a", "project", ".", "Handles", "both", "the", "form", "and", "processing", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L245-L304
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.projectForm
protected function projectForm($values, $type = 'add') { $form = new Form(); $form->setMethod('POST'); $form->setAction(PHPCI_URL.'project/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $form->addField(new Form\Element\Hidden('pubkey')); $options = array...
php
protected function projectForm($values, $type = 'add') { $form = new Form(); $form->setMethod('POST'); $form->setAction(PHPCI_URL.'project/' . $type); $form->addField(new Form\Element\Csrf('csrf')); $form->addField(new Form\Element\Hidden('pubkey')); $options = array...
[ "protected", "function", "projectForm", "(", "$", "values", ",", "$", "type", "=", "'add'", ")", "{", "$", "form", "=", "new", "Form", "(", ")", ";", "$", "form", "->", "setMethod", "(", "'POST'", ")", ";", "$", "form", "->", "setAction", "(", "PHP...
Create add / edit project form.
[ "Create", "add", "/", "edit", "project", "form", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L309-L399
dancryer/PHPCI
PHPCI/Controller/ProjectController.php
ProjectController.githubRepositories
protected function githubRepositories() { $github = new Github(); $response = new b8\Http\Response\JsonResponse(); $response->setContent($github->getRepositories()); return $response; }
php
protected function githubRepositories() { $github = new Github(); $response = new b8\Http\Response\JsonResponse(); $response->setContent($github->getRepositories()); return $response; }
[ "protected", "function", "githubRepositories", "(", ")", "{", "$", "github", "=", "new", "Github", "(", ")", ";", "$", "response", "=", "new", "b8", "\\", "Http", "\\", "Response", "\\", "JsonResponse", "(", ")", ";", "$", "response", "->", "setContent",...
Get an array of repositories from Github's API.
[ "Get", "an", "array", "of", "repositories", "from", "Github", "s", "API", "." ]
train
https://github.com/dancryer/PHPCI/blob/71ab3875ac822c8f138e4dddd045cc992229811e/PHPCI/Controller/ProjectController.php#L404-L411