_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q237100 | ConfigurationManager.delete | train | public function delete($configurationIdentifier)
{
/**
* Checks if the value is defined in the configuration elements.
*/
if (!array_key_exists($configurationIdentifier, $this->configurationElements)) {
throw new ConfigurationParameterNotFoundException();
}
... | php | {
"resource": ""
} |
q237101 | ConfigurationManager.loadConfiguration | train | private function loadConfiguration(
$configurationNamespace,
$configurationKey
) {
$configurationEntity = $this
->configurationRepository
->find([
'namespace' => $configurationNamespace,
'key' => $configurationKey,
]);
... | php | {
"resource": ""
} |
q237102 | ConfigurationManager.flushConfiguration | train | private function flushConfiguration(ConfigurationInterface $configuration)
{
$this
->configurationObjectManager
->persist($configuration);
$this
->configurationObjectManager
->flush($configuration);
return $this;
} | php | {
"resource": ""
} |
q237103 | ConfigurationManager.deleteConfiguration | train | private function deleteConfiguration(ConfigurationInterface $configuration)
{
$this
->configurationObjectManager
->remove($configuration);
$this
->configurationObjectManager
->flush($configuration);
return $this;
} | php | {
"resource": ""
} |
q237104 | ConfigurationManager.createConfigurationInstance | train | private function createConfigurationInstance(
$configurationIdentifier,
$configurationNamespace,
$configurationKey,
$configurationValue
) {
/**
* Value is not found on database. We can just check if the value is
* defined in the configuration elements, and w... | php | {
"resource": ""
} |
q237105 | ConfigurationManager.flushConfigurationToCache | train | private function flushConfigurationToCache(
ConfigurationInterface $configuration,
$configurationIdentifier
) {
$configurationValue = $this->unserializeValue(
$configuration->getValue(),
$configuration->getType()
);
$this
->cache
... | php | {
"resource": ""
} |
q237106 | ConfigurationManager.splitConfigurationKey | train | private function splitConfigurationKey($configurationIdentifier)
{
$configurationIdentifier = explode('.', $configurationIdentifier, 2);
if (count($configurationIdentifier) === 1) {
array_unshift($configurationIdentifier, '');
}
return $configurationIdentifier;
} | php | {
"resource": ""
} |
q237107 | ConfigurationManager.unserializeValue | train | private function unserializeValue($configurationValue, $configurationType)
{
switch ($configurationType) {
case ElcodiConfigurationTypes::TYPE_BOOLEAN:
$configurationValue = (boolean) $configurationValue;
break;
case ElcodiConfigurationTypes::TYPE_AR... | php | {
"resource": ""
} |
q237108 | ConfigurationManager.serializeValue | train | private function serializeValue($configurationValue, $configurationType)
{
switch ($configurationType) {
case ElcodiConfigurationTypes::TYPE_ARRAY:
$configurationValue = json_encode($configurationValue);
break;
}
return $configurationValue;
} | php | {
"resource": ""
} |
q237109 | DateDiffToDecimalTime.transform | train | public function transform($content, $options = [])
{
if (!$content instanceof \DateInterval) {
return 0;
}
$decTime = 0;
$decTime += ($content->d ? $content->d * 60 * 24 : 0);
$decTime += ($content->h ? $content->h * 60 : 0);
$decTime += $content->i;
... | php | {
"resource": ""
} |
q237110 | DumpAutoloadTask.prepareInput | train | protected function prepareInput()
{
$arguments = [
'--optimize' => (bool) $this->file->get(self::SETTING_OPTIMIZE),
'--no-dev' => true,
];
$input = new ArrayInput($arguments);
$input->setInteractive(false);
return $input;
} | php | {
"resource": ""
} |
q237111 | ReflectionBasedAbstractFactory.resolveParameterWithoutConfigService | train | private function resolveParameterWithoutConfigService(ContainerInterface $container, $requestedName)
{
/**
* @param ReflectionParameter $parameter
* @return mixed
* @throws ServiceNotFoundException If type-hinted parameter cannot be
* resolved to a service in the contai... | php | {
"resource": ""
} |
q237112 | ReflectionBasedAbstractFactory.resolveParameterWithConfigService | train | private function resolveParameterWithConfigService(ContainerInterface $container, $requestedName)
{
/**
* @param ReflectionParameter $parameter
* @return mixed
* @throws ServiceNotFoundException If type-hinted parameter cannot be
* resolved to a service in the container... | php | {
"resource": ""
} |
q237113 | ReflectionBasedAbstractFactory.resolveParameter | train | private function resolveParameter(ReflectionParameter $parameter, ContainerInterface $container, $requestedName)
{
if ($parameter->isArray()) {
return [];
}
if (! $parameter->getClass()) {
if (! $parameter->isDefaultValueAvailable()) {
throw new Servi... | php | {
"resource": ""
} |
q237114 | MandangoExtension.load | train | public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('mandango.xml');
$processor = new Processor();
$configuration = new Configuration($container->getParameter('ker... | php | {
"resource": ""
} |
q237115 | FormElement.& | train | public function &setContent($content)
{
// Set element type by analyzing the element
switch (true) {
case ($content instanceof FormGroup):
$this->type = 'group';
break;
case ($content instanceof ControlsCollectionInterface):
$... | php | {
"resource": ""
} |
q237116 | Response.download | train | public function download($file = null, $type = null, $file_name = null)
{
if (!empty($file) && @file_exists($file)) {
if (is_null($file_name)) {
$file_name_parts = explode('/', $file);
$file_name = end( $file_name_parts );
}
$this->addHeade... | php | {
"resource": ""
} |
q237117 | VanillaHooks.UserModel_BeforeDeleteUser_Handler | train | public function UserModel_BeforeDeleteUser_Handler($Sender) {
$UserID = GetValue('UserID', $Sender->EventArguments);
$Options = GetValue('Options', $Sender->EventArguments, array());
$Options = is_array($Options) ? $Options : array();
$Content =& $Sender->EventArguments['Content'];
... | php | {
"resource": ""
} |
q237118 | VanillaHooks.UserModel_GetCategoryViewPermission_Create | train | public function UserModel_GetCategoryViewPermission_Create($Sender) {
static $PermissionModel = NULL;
$UserID = ArrayValue(0, $Sender->EventArguments, '');
$CategoryID = ArrayValue(1, $Sender->EventArguments, '');
$Permission = GetValue(2, $Sender->EventArguments, 'Vanilla.Discussions.View');
if... | php | {
"resource": ""
} |
q237119 | VanillaHooks.Base_Render_Before | train | public function Base_Render_Before($Sender) {
$Session = Gdn::Session();
if ($Sender->Menu)
$Sender->Menu->AddLink('Discussions', T('Discussions'), '/discussions', FALSE, array('Standard' => TRUE));
} | php | {
"resource": ""
} |
q237120 | VanillaHooks.ProfileController_AddProfileTabs_Handler | train | public function ProfileController_AddProfileTabs_Handler($Sender) {
if (is_object($Sender->User) && $Sender->User->UserID > 0) {
$UserID = $Sender->User->UserID;
// Add the discussion tab
$DiscussionsLabel = Sprite('SpDiscussions').' '.T('Discussions');
$CommentsLabel = Sprite(... | php | {
"resource": ""
} |
q237121 | VanillaHooks.ProfileController_AfterPreferencesDefined_Handler | train | public function ProfileController_AfterPreferencesDefined_Handler($Sender) {
$Sender->Preferences['Notifications']['Email.DiscussionComment'] = T('Notify me when people comment on my discussions.');
$Sender->Preferences['Notifications']['Email.BookmarkComment'] = T('Notify me when people comment on my bookm... | php | {
"resource": ""
} |
q237122 | VanillaHooks.ProfileController_Comments_Create | train | public function ProfileController_Comments_Create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '') {
$Sender->EditMode(FALSE);
$View = $Sender->View;
// Tell the ProfileController what tab to load
$Sender->GetUserInfo($UserReference, $Username, $UserID);
$Sender->_SetBreadcrumbs... | php | {
"resource": ""
} |
q237123 | VanillaHooks.ProfileController_Discussions_Create | train | public function ProfileController_Discussions_Create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '') {
$Sender->EditMode(FALSE);
// Tell the ProfileController what tab to load
$Sender->GetUserInfo($UserReference, $Username, $UserID);
$Sender->_SetBreadcrumbs(T('Discussions'), ... | php | {
"resource": ""
} |
q237124 | VanillaHooks.Base_GetAppSettingsMenuItems_Handler | train | public function Base_GetAppSettingsMenuItems_Handler($Sender) {
$Menu = &$Sender->EventArguments['SideMenu'];
$Menu->AddLink('Moderation', T('Flood Control'), 'vanilla/settings/floodcontrol', 'Garden.Settings.Manage');
$Menu->AddLink('Forum', T('Categories'), 'vanilla/settings/managecategories', 'Gard... | php | {
"resource": ""
} |
q237125 | VanillaHooks.Setup | train | public function Setup() {
$Database = Gdn::Database();
$Config = Gdn::Factory(Gdn::AliasConfig);
$Drop = Gdn::Config('Vanilla.Version') === FALSE ? TRUE : FALSE;
$Explicit = TRUE;
// Call structure.php to update database
$Validation = new Gdn_Validation(); // Needed by structu... | php | {
"resource": ""
} |
q237126 | InstanceFactoryTrait.getInstance | train | protected function getInstance(/*# string */ $id, array $args)
{
// get id & scope info
list($rawId, $scopedId, $scope) = $this->realScopeInfo($id);
// get from the pool
if (isset($this->pool[$scopedId])) {
return $this->pool[$scopedId];
}
// create inst... | php | {
"resource": ""
} |
q237127 | InstanceFactoryTrait.realScopeInfo | train | protected function realScopeInfo(/*# string */ $id)/*# : array */
{
list($rawId, $scope) = $this->scopedInfo($id);
// special treatment if $scope is a '#service_id'
if (isset($this->loop[$scope])) {
$scope .= '_' . $this->loop[$scope];
}
return [$rawId, $this->s... | php | {
"resource": ""
} |
q237128 | InstanceFactoryTrait.createInstance | train | protected function createInstance(/*# string */ $rawId, array $args)
{
// conver 'service_id' to '#service_id'
$serviceId = ObjectResolver::getServiceId($rawId);
if (isset($this->loop[$serviceId])) {
throw new LogicException(
Message::get(Message::DI_LOOP_DETECTE... | php | {
"resource": ""
} |
q237129 | InstanceFactoryTrait.initContainer | train | protected function initContainer()
{
$initNode = $this->getResolver()->getSectionId('', 'init');
if ($this->getResolver()->has($initNode)) {
$this->getFactory()->executeMethodBatch(
$this->getResolver()->get($initNode)
);
}
return $this;
} | php | {
"resource": ""
} |
q237130 | SapiEmitter.emit | train | public function emit(ResponseInterface $response)
{
$filename = $linenum = null;
if (headers_sent($filename, $linenum)) {
throw new RuntimeException(sprintf(
'Unable to emit response; headers already sent in "%s" '
. 'on line "%s".',
$filen... | php | {
"resource": ""
} |
q237131 | SapiEmitter.emitStatusLine | train | protected function emitStatusLine(ResponseInterface $response)
{
$reasonPhrase = $response->getReasonPhrase();
header(sprintf(
'HTTP/%s %d%s',
$response->getProtocolVersion(),
$response->getStatusCode(),
($reasonPhrase ? ' ' . $reasonPhrase : '')
... | php | {
"resource": ""
} |
q237132 | SapiEmitter.emitHeaders | train | protected function emitHeaders(ResponseInterface $response)
{
$normalize = function ($headerName) {
$name = str_replace('-', ' ', $headerName);
$filtered = str_replace(' ', '-', ucwords($name));
return $filtered;
};
foreach ($response->getHeaders() as... | php | {
"resource": ""
} |
q237133 | SapiEmitter.emitBody | train | protected function emitBody(ResponseInterface $response)
{
while (ob_get_level()) {
ob_end_flush();
}
$body = $response->getBody();
if ($body->getSize()) {
echo $body;
}
return $this;
} | php | {
"resource": ""
} |
q237134 | Provider.findWithPermission | train | public function findWithPermission($permission)
{
return array_filter(
$this->findAll(),
function ($role) use ($permission) {
return $role->has($permission);
}
);
} | php | {
"resource": ""
} |
q237135 | Provider.findWithoutPermission | train | public function findWithoutPermission($permission)
{
return array_filter(
$this->findAll(),
function ($role) use ($permission) {
return $role->hasnt($permission);
}
);
} | php | {
"resource": ""
} |
q237136 | Pdo.load | train | public function load(Container $object)
{
$pks = [];
$values = $this->parameters;
$identifier = $this->identifier;
foreach ($this->primaryKey as $key) {
if (isset($object->$key)) {
$pks[$key] = sprintf('%s.%s = ?', $identifier, $key);
$valu... | php | {
"resource": ""
} |
q237137 | Pdo.generateJoin | train | protected function generateJoin(array &$fields)
{
$annotations = $this->annotations['class'];
$props = $this->annotations['properties'];
$table = '';
foreach (['Require' => '', 'Include' => 'LEFT '] as $type => $join) {
if (isset($annotations[$type])) {
fo... | php | {
"resource": ""
} |
q237138 | Pdo.getStatement | train | protected function getStatement($sql)
{
if (!isset($this->statements[$sql])) {
$this->statements[$sql] = $this->adapter->prepare($sql);
}
return $this->statements[$sql];
} | php | {
"resource": ""
} |
q237139 | twAdmin.routeExists | train | public static function routeExists($route, sfContext $context)
{
try {
if ($route{0} == '@') {
$context->getRouting()->generate(substr($route, 1));
}
return true;
} catch (Exception $e) {
return false;
}
} | php | {
"resource": ""
} |
q237140 | Raw.query | train | public function query($pQuery, array $pParams = array())
{
$this->_stm = Agl::app()->getDb()->getConnection()->prepare($pQuery);
if (! $this->_stm->execute($pParams)) {
$error = $this->_stm->errorInfo();
throw new Exception("The query failed with message '" . $error[2] . "'"... | php | {
"resource": ""
} |
q237141 | Sid.extractConstants | train | private static function extractConstants()
{
$oClass = new \ReflectionClass(get_called_class());
$constants = $oClass->getConstants();
unset(
$constants['IS_IMPLICIT_ABSTRACT'],
$constants['IS_EXPLICIT_ABSTRACT'],
$constants['IS_FINAL']
);
... | php | {
"resource": ""
} |
q237142 | Sid.updateHiddenValue | train | protected static function updateHiddenValue($list, $name)
{
$sid = $list[$name];
unset($list[$name]);
preg_match("/" . self::$hiddenSidNamePattern . "/", $name, $match);
$list[$match[1]] = $sid;
return $list;
} | php | {
"resource": ""
} |
q237143 | Sid.getList | train | public static function getList(bool $full = false)
{
$class = get_called_class();
if (empty(self::$list[$class])) {
self::$list[$class] = self::loadList();
}
$list = self::$list[$class];
foreach ($list as $name => $sid) {
if (static::... | php | {
"resource": ""
} |
q237144 | Sid.getNameById | train | public static function getNameById($sid)
{
$list = self::getList(true);
$key = array_search($sid, $list);
if ($key === false)
throw new SidItemNotFound('Sid not exists');
return $key;
} | php | {
"resource": ""
} |
q237145 | Sid.getTitle | train | public static function getTitle($id, $lang, $context = 'default')
{
$name = self::getNameById($id);
$class = self::getClassWithoutNamespace();
return call_user_func(self::getCallback($lang), $name, $class, $context);
} | php | {
"resource": ""
} |
q237146 | TimeAgoBehavior.getTimeAgo | train | public function getTimeAgo($field = null, $options = []){
$attribute = $this->attribute;
if ($field !== null) {
$attribute = $field;
}
$year = $options['year'] ?? 'full:{day} {month} {year}';
$month = $options['month'] ?? 'full:{day} {month}';
if ($this->o... | php | {
"resource": ""
} |
q237147 | Criteria.bindSort | train | public static function bindSort(\Criteria $criteria, $sort) {
$direction = $sort['direction'];
switch($direction) {
case self::SORT_DIRECTION_DESC:
$criteria->addDescendingOrderByColumn($sort['column']);
break;
case self::SORT_DIRECTION_ASC:
... | php | {
"resource": ""
} |
q237148 | AccessController.areAllowed | train | public function areAllowed(array $actions, ClassMetadata $metadata, $document = null, ChangeSet $changeSet = null)
{
if (!$metadata->hasProperty('permissions')) {
return new AllowedResult(false);
}
//first check the generic 'guest' role
$result = $this->checkRolesAgainst... | php | {
"resource": ""
} |
q237149 | HtmlDocumentLinkUrlFinder.looksLikeConcatenatedJsString | train | private function looksLikeConcatenatedJsString(string $url): bool
{
$patternBody = "^'\s+\+\s+.*\s+\+\s+'$";
$pattern = '/'.$patternBody.'/i';
return preg_match($pattern, $url) > 0;
} | php | {
"resource": ""
} |
q237150 | Csv.fputcsv | train | protected function fputcsv($filePointer, $dataArray, $delimiter = ",", $enclosure = "\"")
{
// Build the string
$string = "";
// No leading delimiter
$writeDelimiter = false;
foreach ($dataArray as $dataElement) {
// Replaces a double quote with two double quotes
$dataElement... | php | {
"resource": ""
} |
q237151 | Csv.writeDataInIO | train | protected function writeDataInIO($fp)
{
// Écriture des données
if ($this->useAssociativeArray) {
foreach ($this->data as $donnee) {
foreach ($donnee as &$champ) {
$champ = (is_string($champ)) ? iconv("UTF-8", "Windows-1252//TRANSLIT", $champ) : $champ;
}
$this-... | php | {
"resource": ""
} |
q237152 | Application.sendErrorDocument | train | private function sendErrorDocument(
ResponseInterface $response): ResponseInterface
{
if ($this->errorDocument && preg_match(
"/^(4|5){1}[0-2]{1}[0-9]{1}$/", $response->getStatusCode())
) {
$this->errorDocument = str_replace(
"{status}", $r... | php | {
"resource": ""
} |
q237153 | Router.setPrefix | train | public function setPrefix(string $prefix) : RouterInterface {
$prefix = trim($prefix, '/');
$this->prefix = $prefix.(strlen($prefix) ? '/' : '');
return $this;
} | php | {
"resource": ""
} |
q237154 | Router.add | train | public function add($method, $url = null, $handler = null) : RouterInterface
{
$temp = [ 'method' => [ 'GET', 'POST' ], 'url' => '', 'handler' => null ];
foreach (func_get_args() as $arg) {
if (is_callable($arg)) {
$temp['handler'] = $arg;
} else if (in_array(... | php | {
"resource": ""
} |
q237155 | Server.userHasAccess | train | public function userHasAccess(User $user)
{
if ($this->getWhitelisted() === false) {
return true;
}
$criteria = Criteria::create()
->where(Criteria::expr()->eq('user', $user))
->setMaxResults(1);
$serverUsers = $this->users->matching($cri... | php | {
"resource": ""
} |
q237156 | ProfileType.buildUserForm | train | protected function buildUserForm(FormBuilderInterface $builder, array $options)
{
$now = new \DateTime();
$builder
->add('username', null, array('label' => 'form.label_username', 'translation_domain' => 'SonataUserBundle'))
->add('email', 'email', array('label' => 'form.labe... | php | {
"resource": ""
} |
q237157 | Validator.set | train | public function set($name, $rule = null)
{
if (!is_array($name)) {
$name = [$name => $rule];
}
$this->_handlers = $name + $this->_handlers;
} | php | {
"resource": ""
} |
q237158 | Validator.has | train | public function has($name)
{
$checker = $this->_classes['checker'];
return isset($this->_handlers[$name]) || $checker::has($name);
} | php | {
"resource": ""
} |
q237159 | Validator.get | train | public function get($name)
{
if (isset($this->_handlers[$name])) {
return $this->_handlers[$name];
}
$checker = $this->_classes['checker'];
if ($checker::has($name)) {
return $checker::get($name);
}
throw new InvalidArgumentException("Unexisting ... | php | {
"resource": ""
} |
q237160 | Validator.rule | train | public function rule($field, $rules = [])
{
$defaults = [
'message' => null,
'required' => true,
'skipEmpty' => false,
'format' => 'any',
'not' => false,
'on' => null
];
$rules = $rules ? (array) $rules : [];
f... | php | {
"resource": ""
} |
q237161 | Validator.validates | train | public function validates($data, $options = [])
{
$events = (array) (isset($options['events']) ? $options['events'] : null);
$this->_errors = [];
$error = $this->_error;
foreach ($this->_rules as $field => $rules) {
$values = static::values($data, explode('.', $field));... | php | {
"resource": ""
} |
q237162 | Validator.is | train | public function is($name, $value, $options = [], &$params = [])
{
$not = false;
if (strncmp($name, 'not:', 4) === 0) {
$name = substr($name, 4);
$not = true;
}
$handlers = $this->get($name);
$handlers = is_array($handlers) ? $handlers : [$handlers];
... | php | {
"resource": ""
} |
q237163 | Validator.values | train | public static function values($data, $path = [], $base = null)
{
if (!$path) {
$base = $base ?: 0;
return [$base => $data];
}
$field = array_shift($path);
if ($field === '*') {
$values = [];
foreach ($data as $key => $value) {
... | php | {
"resource": ""
} |
q237164 | Wisdom.addLoader | train | public function addLoader(Loader $loader)
{
$loader->setLocator($this->locator);
$this->resolver->addLoader($loader);
} | php | {
"resource": ""
} |
q237165 | Wisdom.get | train | public function get($file, $values = null, array &$imported = array())
{
if ((null !== $values) && (false === is_array($values))) {
if (false === ($values instanceof ArrayAccess)) {
throw new InvalidArgumentException(
'The value of $values is not an array or a... | php | {
"resource": ""
} |
q237166 | Wisdom.import | train | public function import(array $data, $values = null, array &$imported = array())
{
if (false === isset($data['imports'])) {
return $data;
}
$imports = $data['imports'];
unset($data['imports']);
foreach ($imports as $resource) {
$data = array_replace_... | php | {
"resource": ""
} |
q237167 | Wisdom.setValues | train | public function setValues($values)
{
if ((null !== $values) && (false === is_array($values))) {
if (false === ($values instanceof ArrayAccess)) {
throw new InvalidArgumentException(
'The value of $values is not an array or an instance of ArrayAccess.'
... | php | {
"resource": ""
} |
q237168 | Wisdom.mergeValues | train | private function mergeValues($a, $b)
{
$x = array();
$y = array();
if (is_array($a)) {
$x = $a;
}
foreach ($b as $key => $value) {
$x[$key] = $value;
}
return $x;
} | php | {
"resource": ""
} |
q237169 | Subscriptions.suspend | train | public function suspend($code = null)
{
if (! $code) {
$code = $this->data->code;
}
$response = $this->client->put('/{code}/suspend', [$code]);
if (! $response->hasErrors()) {
$this->event->dispatch('SUBSCRIPTION.SUSPENDED', new SubscriptionsEvent($this->dat... | php | {
"resource": ""
} |
q237170 | Subscriptions.setNextInvoiceDate | train | public function setNextInvoiceDate($date)
{
$date = DateTime::createFromFormat('Y-m-d', $date);
$this->next_invoice_date = new stdClass();
$this->next_invoice_date->day = $date->format('d');
$this->next_invoice_date->month = $date->format('m');
$this->next_invoice_date->year... | php | {
"resource": ""
} |
q237171 | Subscriptions.setNewCustomer | train | public function setNewCustomer(Customers $customer)
{
$this->client->addQueryString('new_customer', true);
$this->data->customer = $customer->jsonSerialize();
return $this;
} | php | {
"resource": ""
} |
q237172 | Configuration.getRepositoryFactory | train | public function getRepositoryFactory(): RepositoryFactoryInterface
{
if (null !== $this->repositoryFactory) {
return $this->repositoryFactory;
}
$factory = new DefaultRepositoryFactory();
$factory->setDefaultRepositoryClassName($this->getDefaultRepositoryClassName());
... | php | {
"resource": ""
} |
q237173 | iauUtctai.Utctai | train | public static function Utctai($utc1, $utc2, &$tai1, &$tai2) {
$big1;
$iy;
$im;
$id;
$j;
$iyt;
$imt;
$idt;
$u1;
$u2;
$fd;
$dat0;
$dat12;
$w;
$dat24;
$dlod;
$dleap;
$z1;
$z2;
$a2;
/* Put the two parts of the UTC into big-first order. */
... | php | {
"resource": ""
} |
q237174 | RouteFactory.simpleRoute | train | protected function simpleRoute($name, $data)
{
if (is_string($data)) {
return $this->map->get($name, $data);
}
return $this->createRoute($name, $data);
} | php | {
"resource": ""
} |
q237175 | RouteFactory.setRouteProperties | train | protected function setRouteProperties(Route $route, array $data)
{
$methods = get_class_methods(Route::class);
$methods = array_diff($methods, ["allows", "path"]);
foreach($data as $method => $args) {
if (in_array($method, $methods)) {
$route->$method($args);
... | php | {
"resource": ""
} |
q237176 | ModifierBase.apply | train | public function apply(ModelCriteria $query)
{
if (!empty($this->modifiers)) {
foreach ($this->modifiers as $modifier) {
if ($this->hasAllRequiredData($modifier)) {
$modifier['property'] = str_replace('/', '.', $modifier['property']);
# Chec... | php | {
"resource": ""
} |
q237177 | Text.get | train | public static function get ($message1, $message2 = null, $n = null)
{
$in = self::getInstance ();
return $in->getText ($message1, $message2, $n);
} | php | {
"resource": ""
} |
q237178 | ExpenseCollection.fromXml | train | public static function fromXml(\DOMNodeList $xml)
{
$items = array();
foreach ($xml as $xmlTag) {
$items[] = Expense::fromXml($xmlTag);
}
return new static($items);
} | php | {
"resource": ""
} |
q237179 | UriQueryFactory.make | train | public static function make(array $server = null)
{
if (empty($server)) {
$server = $_SERVER;
}
if (isset($server['REQUEST_URI'])) {
return parse_url($server['REQUEST_URI'], PHP_URL_QUERY);
}
} | php | {
"resource": ""
} |
q237180 | RoutingSubscriber.onKernelRequest | train | public function onKernelRequest(GetResponseEvent $event)
{
if (null === $module = $event->getRequest()->get('module')) {
return;
}
if (!$module instanceof ModuleInterface) {
$module = $this->getModularRouter()->getModuleByRequest($event->getRequest());
}
... | php | {
"resource": ""
} |
q237181 | AbstractConnector.createConnection | train | public function createConnection(array $config)
{
if (! isset($config['host'])) {
throw new InvalidArgumentException("No host provided.");
}
$this->setHost($config['host']);
// We check the configuration for request headers. Some API's require
// certain headers... | php | {
"resource": ""
} |
q237182 | AbstractConnector.prepare | train | public function prepare(array $query)
{
$client = new Client;
$this->client = $client;
$this->request = $client->createRequest(
$this->prepareMethod($query),
$this->prepareRequestUrl($query),
[
'headers' => $this->prepareHeaders($query),
... | php | {
"resource": ""
} |
q237183 | AbstractConnector.prepareRequestUrl | train | protected function prepareRequestUrl(array $query)
{
$path = isset($query['from']['path']) ? $query['from']['path'] : null;
$wheres = isset($query['wheres']) ? $query['wheres'] : null;
$baseUrl = $this->host.$path;
// Here we validate that there are any wheres in the
// re... | php | {
"resource": ""
} |
q237184 | AbstractConnector.prepareBody | train | protected function prepareBody(array $query)
{
$method = isset($query['from']['method']) ? $query['from']['method'] : null;
if ($method === 'POST') {
// The query grammar already parsed the body for us.
// We return the value of the query and guzzle does the rest.
... | php | {
"resource": ""
} |
q237185 | AbstractConnector.parseResponse | train | protected function parseResponse(Response $response)
{
$contentType = explode(';', $response->getHeader('content-type'))[0];
switch ($contentType) {
case 'application/json':
case 'application/vnd.api+json':
return $response->json();
case 'applica... | php | {
"resource": ""
} |
q237186 | GuardRestrictIP.attachToEvent | train | function attachToEvent(iEvent $event)
{
if ( \Poirot\isCommandLine() )
// Restriction IP Only Work With Http Sapi
return $this;
$self = $this;
$event->on(EventHeapOfSapi::EVENT_APP_MATCH_REQUEST, function() use ($self) {
$self->_assertAccess();
}... | php | {
"resource": ""
} |
q237187 | GuardRestrictIP.setBlockList | train | function setBlockList($list)
{
if ($list instanceof \Traversable)
$list = \Poirot\Std\cast($list)->toArray();
if (! is_array($list) )
throw new \InvalidArgumentException(sprintf(
'List must instanceof Traversable or array; given (%s).'
, \Poir... | php | {
"resource": ""
} |
q237188 | Meta.setViewport | train | public function setViewport($width = 'device-width', $initial_scale = '1', $user_scalable = '', $minimum_scale = '', $maximum_scale = '')
{
$tag = [
'name' => 'viewport',
'content' => 'width=' . $width . ', initial-scale=' . $initial_scale
];
if ($user_scalable) {
... | php | {
"resource": ""
} |
q237189 | MySqlDataStore.createConnection | train | public function createConnection($parameters)
{
$connection = new \PDO(
'mysql:host=' . $parameters['host'] . ';dbname=' . $parameters['database'],
$parameters['username'],
$parameters['password']
);
if (isset($parameters['charset'])) {
$conne... | php | {
"resource": ""
} |
q237190 | Notify.fetch | train | protected static function fetch()
{
$command = array(
'LINUX' => new Commands\Linux(),
'MAC' => new Commands\Mac(),
'WIN' => new Commands\Windows()
);
$instance = 'No valid desktop notifier found.';
if ($command['WIN']->isAvailable()) {
... | php | {
"resource": ""
} |
q237191 | WrappedCommandTrait.getComposer | train | public function getComposer($required = true, $disablePlugins = false)
{
if (null === $this->composer) {
if ($this->composerFactory) {
$this->composer = call_user_func($this->composerFactory, $required, $disablePlugins);
}
if ($required && !$this->compose... | php | {
"resource": ""
} |
q237192 | AbstractModelCollection.getErrors | train | public function getErrors($attribute = null)
{
$itemErrors = [];
foreach ($this->getItems() as $item) {
if ($item->hasErrors($attribute)) {
$itemErrors[$this->getItemId($item)] = $item->getErrors($attribute);
}
}
return array_merge(
... | php | {
"resource": ""
} |
q237193 | Rpc.isNameAvailable | train | public function isNameAvailable( $name, $fields = array() )
{
$fields = (object) $fields;
return ! $this->getMapper()
->isNameExists(
$name .
( empty( $fields->type ) ? '' : '.' . $fields->type )
)... | php | {
"resource": ""
} |
q237194 | JobFactory.createBuilder | train | public function createBuilder($type = 'job', array $initOptions = array(), array $execOptions = array())
{
$name = $type instanceof JobTypeInterface || $type instanceof ResolvedJob
? $type->getName()
: $type;
return $this->createNamedBuilder($name, $type, $initOptions, $exec... | php | {
"resource": ""
} |
q237195 | JobFactory.resolveType | train | public function resolveType(JobTypeInterface $type)
{
$parentType = $type->getParent();
if ($parentType instanceof JobTypeInterface) {
$parentType = $this->resolveType($parentType);
} elseif (null !== $parentType) {
$parentType = $this->registry->getType($parentType)... | php | {
"resource": ""
} |
q237196 | Command.set | train | public static function set($file, $command, $database)
{
$database = $database ? 'true' : 'false';
//
$txt = "<?php\n\nnamespace Vinala\App\Support\Lumos;\n\n";
$txt .= "use Vinala\Kernel\Console\Command\Commands;\n\n";
$txt .= self::docs("$file Command");
$txt .= "... | php | {
"resource": ""
} |
q237197 | MenuItem.alias | train | public function alias($alias = null)
{
if ($alias === null) {
return $this->_alias;
}
$this->_alias = $alias;
return $this;
} | php | {
"resource": ""
} |
q237198 | MenuItem.name | train | public function name($name = null)
{
if ($name === null) {
return $name;
}
$this->_name = $name;
return $this;
} | php | {
"resource": ""
} |
q237199 | MenuItem.shortName | train | public function shortName($name = null)
{
if ($name === null) {
return $this->_nameShort;
}
$this->_nameShort = $name;
return $this;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.