_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q12800
CApacheHTTPServerInterface.locateApacheServer
train
public function locateApacheServer() : bool { if ($this->getApacheCtl()) { $this->getApacheInfo();
php
{ "resource": "" }
q12801
CApacheHTTPServerInterface.getApacheCtl
train
public function getApacheCtl() { if ($this->apachectl === false) { $shell = new CNabuShell(); $response = array(); if ($shell->exec('whereis apachectl', null, $response) && count($response) === 1) {
php
{ "resource": "" }
q12802
CApacheHTTPServerInterface.getApacheInfo
train
public function getApacheInfo() { if ($this->apachectl !== false) { $shell = new CNabuShell(); $response = array();
php
{ "resource": "" }
q12803
CApacheHTTPServerInterface.parseApacheInfo
train
private function parseApacheInfo(array $data = null) { $this->apache_info = null; if (is_array($data) && count($data) > 0) { foreach ($data as $line) {
php
{ "resource": "" }
q12804
CApacheHTTPServerInterface.getApacheInstancesPath
train
public function getApacheInstancesPath() { if ($this->apache_config_path === false && is_array($this->apache_compiles) && array_key_exists('SERVER_CONFIG_FILE', $this->apache_compiles) ) { $config_file = $this->apache_compiles['SERVER_CONFIG_FILE']; if (is_file($config_file)) { $base_path = dirname($config_file); if (is_dir($base_path . DIRECTORY_SEPARATOR . 'other')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'other'; } elseif (is_dir($base_path . DIRECTORY_SEPARATOR . 'conf.d')) { $this->apache_config_path = $base_path . DIRECTORY_SEPARATOR . 'conf.d'; }
php
{ "resource": "" }
q12805
CApacheHTTPServerInterface.interpretApacheInfoVariable
train
private function interpretApacheInfoVariable(string $line) { $content = preg_split('/^\\s+-D\\s+/', $line, 2); if (count($content) === 2) { $parts = preg_split('/=/', $content[1], 2); if (count($parts) === 2) { $this->apache_compiles[$parts[0]]
php
{ "resource": "" }
q12806
CApacheHTTPServerInterface.getServerVersion
train
public function getServerVersion() : string { return (is_array($this->apache_info) && array_key_exists('server-version', $this->apache_info)) ?
php
{ "resource": "" }
q12807
CApacheHTTPServerInterface.createStandaloneConfiguration
train
public function createStandaloneConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $file = new CApacheStandaloneFile($this, $this->nb_server, $this->nb_site); $file->create();
php
{ "resource": "" }
q12808
CApacheHTTPServerInterface.createHostedConfiguration
train
public function createHostedConfiguration() : bool { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate(
php
{ "resource": "" }
q12809
CApacheHTTPServerInterface.createClusteredConfiguration
train
public function createClusteredConfiguration() { $retval = false; if ($this->apache_config_path) { $index_list = $this->nb_server->getSitesIndex(); $index_list->iterate(
php
{ "resource": "" }
q12810
CApacheHTTPServerInterface.createHostedIndex
train
private function createHostedIndex(CNabuSiteList $index_list) { $index = new CApacheHostedIndex($this, $index_list); $index->create();
php
{ "resource": "" }
q12811
CApacheHTTPServerInterface.createClusteredIndex
train
private function createClusteredIndex(CNabuSiteList $index_list) { $index = new CApacheClusteredIndex($this, $index_list); $index->create();
php
{ "resource": "" }
q12812
CApacheHTTPServerInterface.createHostedFile
train
private function createHostedFile(CNabuSite $nb_site) { $file = new CApacheHostedFile($this, $this->nb_server, $nb_site); $file->create(); $path = $this->nb_server->getVirtualHostsPath() . DIRECTORY_SEPARATOR . $nb_site->getBasePath() . NABU_VHOST_CONFIG_FOLDER . DIRECTORY_SEPARATOR . $this->nb_server->getKey() ; if (!is_dir($path)) {
php
{ "resource": "" }
q12813
CApacheHTTPServerInterface.createClusteredFile
train
private function createClusteredFile(CNabuSite $nb_site) { $file = new CApacheClusteredFile($this, $this->nb_server, $nb_site); $file->create(); $path = self::NABU_APACHE_ETC_PATH . DIRECTORY_SEPARATOR . $nb_site->getBasePath(); if (!is_dir($path)) { mkdir($path, 0755, true); }
php
{ "resource": "" }
q12814
CApacheHTTPServerInterface.validatePath
train
private function validatePath(string $path) : string { if (!is_dir($path) && !mkdir($path, 0755, true))
php
{ "resource": "" }
q12815
CApacheHTTPServerInterface.createSiteFolders
train
public function createSiteFolders(CNabuSite $nb_site) : bool { $vhosts_path = $this->validatePath($this->nb_server->getVirtualHostsPath()); $vlib_path = $this->validatePath($this->nb_server->getVirtualLibrariesPath()); $vcache_path = $this->validatePath($this->nb_server->getVirtualCachePath()); $nb_cluster_user = $nb_site->getClusterUser(); if ($nb_cluster_user === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $nb_cluster_user_group = $nb_cluster_user->getGroup(); if ($nb_cluster_user_group === null) { throw new ENabuCoreException(ENabuCoreException::ERROR_OBJECT_EXPECTED); } $owner_name = $nb_cluster_user->getOSNick(); $owner_group = $nb_cluster_user_group->getOSNick(); $vhosts_path = $nb_site->getVirtualHostPath($this->nb_server); if (!is_dir($vhosts_path)) { if (!mkdir($vhosts_path, 0755, true)) { throw new ENabuCoreException(ENabuCoreException::ERROR_HOST_PATH_NOT_FOUND, array($vhosts_path)); } else { chown($vhosts_path, $owner_name); chgrp($vhosts_path, $owner_group); } } $vlib_path = $nb_site->getVirtualLibrariesPath($this->nb_server); if (!is_dir($vlib_path)) {
php
{ "resource": "" }
q12816
Checkout_Controller.index
train
public function index() { // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If we have turned off login, or member logged in if (!(Checkout::config()->login_form) || Member::currentUserID()) {
php
{ "resource": "" }
q12817
Checkout_Controller.billing
train
public function billing() { $form = $this->BillingForm(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } // Pre populate form with member info if (Member::currentUserID()) { $form->loadDataFrom(Member::currentUser()); }
php
{ "resource": "" }
q12818
Checkout_Controller.delivery
train
public function delivery() { $cart = ShoppingCart::get(); // If we are using simple checkout, skip if (Checkout::config()->simple_checkout) { return $this->redirect($this->Link('finish')); } // If customer is collecting, skip if ($cart->isCollection()) { return $this->redirect($this->Link('finish')); } // If cart is not deliverable, also skip if (!$cart->isDeliverable()) { return $this->redirect($this->Link('finish')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) {
php
{ "resource": "" }
q12819
Checkout_Controller.finish
train
public function finish() { // Check the users details are set, if not, send them to the cart $billing_data = Session::get("Checkout.BillingDetailsForm.data"); $delivery_data = Session::get("Checkout.DeliveryDetailsForm.data"); if (!Checkout::config()->simple_checkout && !is_array($billing_data) && !is_array($delivery_data)) { return $this->redirect($this->Link('index')); } // Check permissions for guest checkout if (!Member::currentUserID() && !Checkout::config()->guest_checkout) { return $this->redirect($this->Link('index')); } if (Checkout::config()->simple_checkout) { $title
php
{ "resource": "" }
q12820
Checkout_Controller.LoginForm
train
public function LoginForm() { $form = CheckoutLoginForm::create($this, 'LoginForm'); $form->setAttribute("action", $this->Link("LoginForm")); $form ->Fields() ->add(HiddenField::create("BackURL")->setValue($this->Link())); $form ->Actions()
php
{ "resource": "" }
q12821
Checkout_Controller.BillingForm
train
public function BillingForm() { $form = BillingDetailsForm::create($this, 'BillingForm'); $data = Session::get("Checkout.BillingDetailsForm.data"); if (is_array($data)) { $form->loadDataFrom($data); } elseif($member = Member::currentUser()) { // Fill email, phone, etc $form->loadDataFrom($member); // Then fill with Address info
php
{ "resource": "" }
q12822
Checkout_Controller.DeliveryForm
train
public function DeliveryForm() { $form = DeliveryDetailsForm::create($this, 'DeliveryForm'); $data = Session::get("Checkout.DeliveryDetailsForm.data"); if (is_array($data)) {
php
{ "resource": "" }
q12823
AbstractMapper.getFullColumnName
train
public static function getFullColumnName($column, $table = null) { // Get target table name if ($table === null) { // Make sure, the getTableName() is defined in calling class if (method_exists(get_called_class(), 'getTableName')) { $table = static::getTableName(); } else { throw new LogicException(
php
{ "resource": "" }
q12824
AbstractMapper.getWithPrefix
train
protected static function getWithPrefix($table) { $prefix = static::$prefix; if (is_null($prefix) || empty($prefix)) { // If prefix is null,
php
{ "resource": "" }
q12825
AbstractMapper.executeSqlFromFile
train
final protected function executeSqlFromFile($file) { if (is_file($file)) { return $this->executeSqlFromString(file_get_contents($file)); } else {
php
{ "resource": "" }
q12826
AbstractMapper.valueExists
train
final protected function valueExists($column, $value) { $this->validateShortcutData(); return (bool) $this->db->select()
php
{ "resource": "" }
q12827
AbstractMapper.deleteByPks
train
final public function deleteByPks(array $ids) { foreach ($ids as $id) {
php
{ "resource": "" }
q12828
AbstractMapper.findColumnByPk
train
final public function findColumnByPk($id, $column) { $this->validateShortcutData(); return
php
{ "resource": "" }
q12829
AbstractMapper.getLastPk
train
final public function getLastPk($table = null) { if ($table === null) { $this->validateShortcutData(); $table = static::getTableName(); } return $this->db->select()
php
{ "resource": "" }
q12830
AbstractMapper.syncWithJunction
train
final public function syncWithJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) { // Remove previous ones $this->removeFromJunction($table, $masterValue, $masterColumn);
php
{ "resource": "" }
q12831
AbstractMapper.removeFromJunction
train
final public function removeFromJunction($table, $masterValue, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN) { // Support for multiple removal if (!is_array($masterValue)) { $masterValue = array($masterValue); } return $this->db->delete()
php
{ "resource": "" }
q12832
AbstractMapper.insertIntoJunction
train
final public function insertIntoJunction($table, $masterValue, array $slaves, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn = self::PARAM_JUNCTION_SLAVE_COLUMN) {
php
{ "resource": "" }
q12833
AbstractMapper.getMasterIdsFromJunction
train
final public function getMasterIdsFromJunction($table, $value, $masterColumn = self::PARAM_JUNCTION_MASTER_COLUMN, $slaveColumn
php
{ "resource": "" }
q12834
AbstractMapper.getIdsFromJunction
train
private function getIdsFromJunction($table, $column, $key, $value) { return $this->db->select($column) ->from($table)
php
{ "resource": "" }
q12835
AbstractMapper.getColumnSumWithAverages
train
final protected function getColumnSumWithAverages(array $columns, array $averages, array $constraints, $precision = 2) { $db = $this->db->select(); foreach ($columns as $column) { $db->sum($column, $column); } foreach ($averages as $average) { $db->avg($average, $average); } $db->from(static::getTableName()); if (!empty($constraints)) {
php
{ "resource": "" }
q12836
AbstractMapper.persistRecord
train
private function persistRecord(array $data, array $fillable = array(), $set) { if (!empty($fillable) && !ArrayUtils::keysExist($data, $fillable)) { throw new LogicException('Can not persist the entity due to fillable protection. Make sure all fillable keys exist in the entity'); } $this->validateShortcutData(); if (isset($data[$this->getPk()]) && $data[$this->getPk()]) { $result = $this->db->update(static::getTableName(), $data) ->whereEquals($this->getPk(), $data[$this->getPk()]) ->execute(); return $set === true ? $data : $result; } else { // Do not insert primary key if present if (array_key_exists($this->getPk(), $data)) { unset($data[$this->getPk()]);
php
{ "resource": "" }
q12837
AbstractMapper.persistMany
train
final public function persistMany(array $collection, array $fillable = array()) { foreach ($collection as $item) {
php
{ "resource": "" }
q12838
AbstractMapper.updateColumns
train
final public function updateColumns(array $data, array $allowedColumns = array()) { foreach ($data as $column => $values) { foreach ($values as $id => $value) { // Protection. Update only defined columns if (!empty($allowedColumns) && !in_array($column, $allowedColumns)) {
php
{ "resource": "" }
q12839
AbstractMapper.updateColumnsByPk
train
final public function updateColumnsByPk($pk, $data) { $this->validateShortcutData(); return $this->db->update(static::getTableName(), $data)
php
{ "resource": "" }
q12840
AbstractMapper.isPrimaryKeyValue
train
final public function isPrimaryKeyValue($value) { $column = $this->getPk(); return (bool) $this->db->select($column) ->from(static::getTableName())
php
{ "resource": "" }
q12841
AbstractMapper.fetchOneColumn
train
final public function fetchOneColumn($column, $key, $value) { $this->validateShortcutData(); return $this->db->select($column)
php
{ "resource": "" }
q12842
AbstractMapper.fetchAllByColumn
train
final public function fetchAllByColumn($column, $value, $select = '*') { $this->validateShortcutData(); return $this->db->select($select)
php
{ "resource": "" }
q12843
AbstractMapper.fetchByColumn
train
final public function fetchByColumn($column, $value, $select = '*') { $this->validateShortcutData(); return $this->db->select($select)
php
{ "resource": "" }
q12844
AbstractMapper.deleteByColumn
train
final public function deleteByColumn($column, $value) { $this->validateShortcutData(); return $this->db->delete() ->from(static::getTableName())
php
{ "resource": "" }
q12845
AbstractMapper.countByColumn
train
final public function countByColumn($column, $value, $field = null) { $this->validateShortcutData(); $alias = 'count'; if ($field === null) { $field = $this->getPk(); } return (int) $this->db->select() ->count($field, $alias)
php
{ "resource": "" }
q12846
AbstractMapper.incrementColumnByPk
train
final public function incrementColumnByPk($pk, $column, $step = 1, $table = null) { return $this->db->increment($this->getTable($table), $column, $step)
php
{ "resource": "" }
q12847
AbstractMapper.decrementColumnByPk
train
final public function decrementColumnByPk($pk, $column, $step = 1, $table = null) { return $this->db->decrement($this->getTable($table), $column, $step)
php
{ "resource": "" }
q12848
AbstractMapper.dropTables
train
final public function dropTables(array $tables, $fkChecks = false) { // Whether FK checks are enabled if ($fkChecks == false) { $this->db->raw('SET FOREIGN_KEY_CHECKS=0') ->execute(); } foreach ($tables as $table) { if (!$this->dropTable($table)) { return false; }
php
{ "resource": "" }
q12849
AbstractMapper.dropColumn
train
public function dropColumn($column, $table = null) { return $this->db->alterTable($this->getTable($table))
php
{ "resource": "" }
q12850
AbstractMapper.renameColumn
train
public function renameColumn($old, $new, $table = null) { return $this->db->alterTable($this->getTable($table))
php
{ "resource": "" }
q12851
AbstractMapper.createIndex
train
public function createIndex($name, $target, $unique = false, $table = null) {
php
{ "resource": "" }
q12852
AbstractMapper.dropIndex
train
public function dropIndex($name, $table = null) { return
php
{ "resource": "" }
q12853
AbstractMapper.addPrimaryKey
train
public function addPrimaryKey($name, $target, $table = null) { return $this->db->alterTable($this->getTable($table))
php
{ "resource": "" }
q12854
AbstractMapper.dropPrimaryKey
train
public function dropPrimaryKey($name, $table = null) { return $this->db->alterTable($this->getTable($table))
php
{ "resource": "" }
q12855
AbstractMapper.getMaxId
train
public function getMaxId() { $column = $this->getPk(); return $this->db->select($column) ->from(static::getTableName()) ->orderBy($column)
php
{ "resource": "" }
q12856
ProjectType.installRoot
train
public static function installRoot() { $install_root = ProjectX::getProjectConfig() ->getRoot(); // Ensure a forward slash has been added to the install root. $install_root = substr($install_root, 0, 1) != '/' ? "/{$install_root}"
php
{ "resource": "" }
q12857
ProjectType.getInstallRoot
train
public function getInstallRoot($strip_slash = false) { $install_root = static::installRoot(); return $strip_slash === false
php
{ "resource": "" }
q12858
ProjectType.onDeployBuild
train
public function onDeployBuild($build_root) { $install_root = $build_root . static::installRoot();
php
{ "resource": "" }
q12859
ProjectType.setupProjectFilesystem
train
public function setupProjectFilesystem() { $this->taskFilesystemStack()
php
{ "resource": "" }
q12860
ProjectType.getProjectOptionByKey
train
public function getProjectOptionByKey($key) { $options = $this->getProjectOptions(); if (!isset($options[$key])) {
php
{ "resource": "" }
q12861
ProjectType.createSymbolicLinksOnProject
train
public function createSymbolicLinksOnProject(array $options) { $project_root = ProjectX::projectRoot(); $excludes = isset($options['excludes']) ? $options['excludes'] : []; $includes = isset($options['includes']) ? $options['includes'] : []; $target_dir = isset($options['target_dir']) ? $options['target_dir'] : null; $source_dir = isset($options['source_dir']) ? $options['source_dir'] : $project_root; $symlink_command = new SymlinkCommand(); /** @var SplFileInfo $file_info */ foreach (new \FilesystemIterator($project_root, \FilesystemIterator::SKIP_DOTS) as $file_info) {
php
{ "resource": "" }
q12862
ProjectType.canBuild
train
protected function canBuild() { $rebuild = false; if ($this->isBuilt()) { $rebuild = $this->askConfirmQuestion( 'Project has already been built, do
php
{ "resource": "" }
q12863
ProjectType.getProjectOptions
train
protected function getProjectOptions() { $config = ProjectX::getProjectConfig(); $type = $config->getType(); $options = $config->getOptions();
php
{ "resource": "" }
q12864
PaginationMaker.render
train
public function render() { // Run only in case paginator has at least one page if ($this->paginator->hasPages()) { $ulClass = $this->getOption('ulClass', 'pagination');
php
{ "resource": "" }
q12865
PaginationMaker.createPaginationItems
train
private function createPaginationItems() { // Grab overrides if present $linkClass = $this->getOption('linkClass', 'page-link'); $itemClass = $this->getOption('itemClass', 'page-item'); $itemActiveClass = $this->getOption('itemActiveClass', 'page-item active'); $previousCaption = ' « ' . $this->getOption('previousCaption', ''); $nextCaption = $this->getOption('nextCaption', '') . ' » '; // To be returned $items = array(); // First - check if first previous page available if ($this->paginator->hasPreviousPage()) { $items[] = $this->createListItem($itemClass, $this->renderLink($previousCaption, $this->paginator->getPreviousPageUrl(), $linkClass)); } foreach ($this->paginator->getPageNumbers() as $page) { if (is_numeric($page)) { $currentClass
php
{ "resource": "" }
q12866
Payment_Controller.callback
train
public function callback($request) { // If post data exists, process. Otherwise provide error if ($this->payment_handler === null) { // Redirect to error page return $this->redirect(Controller::join_links( Director::BaseURL(), $this->config()->url_segment, 'complete', 'error'
php
{ "resource": "" }
q12867
DataSourceConfig.addColumn
train
public function addColumn(BlockInterface $column, $index = null) { $this->mappingColumns = null; if (null !== $index) { array_splice($this->columns, $index, 0,
php
{ "resource": "" }
q12868
DataSourceConfig.removeColumn
train
public function removeColumn($index) { $this->mappingColumns = null;
php
{ "resource": "" }
q12869
DataSourceConfig.setSortColumns
train
public function setSortColumns(array $columns) { $this->sortColumns = []; $this->mappingSortColumns = []; foreach ($columns as $i => $column) { if (!isset($column['name'])) { throw new InvalidArgumentException('The "name" property of sort column must be present ("sort" property is optional)'); } if (isset($column['sort']) && 'asc' !== $column['sort'] && 'desc' !== $column['sort']) { throw new InvalidArgumentException('The "sort" property of sort column must have "asc" or "desc" value'); }
php
{ "resource": "" }
q12870
DataSourceConfig.getSortColumn
train
public function getSortColumn($column) { $val = null; if ($this->isSorted($column)) { $def = $this->sortColumns[$this->mappingSortColumns[$column]];
php
{ "resource": "" }
q12871
DataSourceConfig.getColumnIndex
train
public function getColumnIndex($name) { if (!\is_array($this->mappingColumns)) { $this->mappingColumns = []; /* @var BlockInterface $column */ foreach ($this->getColumns() as $i => $column) { $this->mappingColumns[$column->getName()] = $i; } }
php
{ "resource": "" }
q12872
TrainersClub.fetchExecutionToken
train
protected function fetchExecutionToken() { try { $response = $this->client->get(static::LOGIN_URL, [ 'headers' => [ 'User-Agent' => 'niantic' ] ]); } catch(ServerException $e) { sleep(1); return $this->fetchExecutionToken();
php
{ "resource": "" }
q12873
MakeObserverCommand.registerObserverServiceProvider
train
public function registerObserverServiceProvider() { if (! $this->files->exists(app_path('Providers/ObserverServiceProvider.php'))) { $this->call('make:provider', [ 'name' => 'ObserverServiceProvider', ]); $this->info('Please register your ObserverServiceProvider in config/app.php.');
php
{ "resource": "" }
q12874
FilterArray.addElementToFilteredArray
train
protected static function addElementToFilteredArray($key, $value) { if (is_null(self::$filteringCallback)) { return ($value); } if (is_string(self::$filteringCallback) && function_exists(self::$filteringCallback)) { $callback = self::$filteringCallback;
php
{ "resource": "" }
q12875
FilterArray.filterStrings
train
protected static function filterStrings(array &$subjectArray, $goDeep = null, $filterFunction = null) { $arrayWalkFunction = self::getArrayWalkFunction($goDeep); $arrayWalkFunction($subjectArray, function (&$item) use ($filterFunction)
php
{ "resource": "" }
q12876
ReadonlyOptions.init
train
static function init() { // This can be overridden if something else feels better self::$hover_text = 'This option is set readonly in ' . basename(__DIR__).'/'.basename(__FILE__); // Use javascript hack in admin option pages
php
{ "resource": "" }
q12877
ReadonlyOptions.set
train
static function set( array $options ) { if ( is_array( $options ) ) { // Force mentioned options with filters foreach ( $options as $must_use_option => $must_use_value ) { // Always return this value for the option add_filter( "pre_option_{$must_use_option}", function() use ( $must_use_value ) { return $must_use_value; }); // Always deny saving this value to the DB
php
{ "resource": "" }
q12878
AuthTicket.fromProto
train
public static function fromProto(ProtoAuthTicket $ticket) : self { return new self($ticket->getStart()->getContents(),
php
{ "resource": "" }
q12879
FlashBag.prepare
train
private function prepare() { if (!$this->storage->has(self::FLASH_KEY)) {
php
{ "resource": "" }
q12880
FlashBag.has
train
public function has($key) { $flashMessages = $this->storage->get(self::FLASH_KEY);
php
{ "resource": "" }
q12881
FlashBag.set
train
public function set($key, $message) { $this->storage->set(self::FLASH_KEY,
php
{ "resource": "" }
q12882
FlashBag.get
train
public function get($key) { if ($this->has($key)) { $flashMessages = $this->storage->get(self::FLASH_KEY); $message = $flashMessages[$key]; $this->remove($key); if ($this->translator instanceof TranslatorInterface) { $message = $this->translator->translate($message);
php
{ "resource": "" }
q12883
Factory.buildClassNameByFileName
train
final protected function buildClassNameByFileName($filename) { $className = sprintf('%s/%s', $this->getNamespace(), $filename); // Normalize it
php
{ "resource": "" }
q12884
Factory.build
train
final public function build() { $arguments = func_get_args(); $filename = array_shift($arguments); $className = $this->buildClassNameByFileName($filename);
php
{ "resource": "" }
q12885
AbstractRenderer.hasParent
train
protected function hasParent($id, array $relationships) { foreach ($relationships as $parentId => $children) { // 0 is reserved, therefore must be ignored
php
{ "resource": "" }
q12886
QueryContainer.getParam
train
private function getParam($param, $default = null) { if (isset($this->query[$param])) {
php
{ "resource": "" }
q12887
QueryContainer.isSortedByMethod
train
private function isSortedByMethod($column, $value) { return $this->isSortedBy($column) &&
php
{ "resource": "" }
q12888
QueryContainer.getColumnSortingUrl
train
public function getColumnSortingUrl($column) { $data = array( FilterInvoker::FILTER_PARAM_PAGE => $this->getCurrentPageNumber(), FilterInvoker::FILTER_PARAM_DESC => !$this->isSortedByDesc($column),
php
{ "resource": "" }
q12889
CreditCard.withToken
train
public function withToken(Token $token) { $card = $this->with('token', $token); if (null !== $card->number) { $lastDigits = strlen($card->number) <= 4 ? $card->number :
php
{ "resource": "" }
q12890
Database.asArray
train
public function asArray() { $array = []; $properties = (new \ReflectionClass($this)) ->getProperties(ReflectionProperty::IS_PUBLIC); foreach ($properties as $object) { $value = $object->getValue($this); if (!isset($value)) { continue; } $property = $object->getName(); if
php
{ "resource": "" }
q12891
PhpProjectType.importDatabaseToService
train
public function importDatabaseToService($service = null, $import_path = null, $copy_to_service = false, $localhost = false) { $destination = $this->resolveDatabaseImportDestination( $import_path,
php
{ "resource": "" }
q12892
PhpProjectType.getDatabaseInfo
train
public function getDatabaseInfo(ServiceDbInterface $instance = null, $allow_override = true) { if (!isset($instance)) { /** @var EngineType $engine */ $engine = $this->getEngineInstance(); $instance = $engine->getServiceInstanceByInterface( ServiceDbInterface::class ); if ($instance === false) { throw new \RuntimeException( 'Unable to find a service for the database instance.'
php
{ "resource": "" }
q12893
PhpProjectType.getEnvPhpVersion
train
public function getEnvPhpVersion() { /** @var EngineType $engine */ $engine = $this->getEngineInstance(); $instance = $engine->getServiceInstanceByType('php'); if (empty($instance)) { throw new \RuntimeException(
php
{ "resource": "" }
q12894
PhpProjectType.initBehat
train
public function initBehat() { $root_path = ProjectX::projectRoot(); if ($this->hasBehat() && !file_exists("$root_path/tests/Behat/features")) { $this->taskBehat() ->option('init')
php
{ "resource": "" }
q12895
PhpProjectType.setupPhpCodeSniffer
train
public function setupPhpCodeSniffer() { $root_path = ProjectX::projectRoot(); $this->taskWriteToFile("{$root_path}/phpcs.xml.dist") ->text($this->loadTemplateContents('phpcs.xml.dist')) ->place('PROJECT_ROOT', $this->getInstallRoot()) ->run();
php
{ "resource": "" }
q12896
PhpProjectType.packagePhpBuild
train
public function packagePhpBuild($build_root) { $project_root = ProjectX::projectRoot(); $stack = $this->taskFilesystemStack(); if (file_exists("{$project_root}/patches")) { $stack->mirror("{$project_root}/patches", "{$build_root}/patches"); }
php
{ "resource": "" }
q12897
PhpProjectType.updateComposer
train
public function updateComposer($lock = false) { $update = $this->taskComposerUpdate(); if ($lock) {
php
{ "resource": "" }
q12898
PhpProjectType.hasComposerPackage
train
public function hasComposerPackage($vendor, $dev = false) { $packages = !$dev ? $this->composer->getRequire()
php
{ "resource": "" }
q12899
PhpProjectType.extractArchive
train
protected function extractArchive($filename, $destination, $service = null, $localhost = false) { $mime_type = null; if (file_exists($filename) && $localhost) { $mime_type = mime_content_type($filename); } else { $engine = $this->getEngineInstance(); if ($engine instanceof DockerEngineType) { $mime_type = $engine->getFileMimeType($filename, $service); } } $command = null; switch ($mime_type) { case 'application/gzip': case 'application/x-gzip': $command = (new CommandBuilder('gunzip', $localhost)) ->command("-c {$filename} > {$destination}"); break; } if
php
{ "resource": "" }