_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q236400 | ContainerHasPathCapableTrait._containerHasPath | train | protected function _containerHasPath($container, $path)
{
$originalPath = $path;
$path = $this->_normalizeArray($path);
$pathLength = count($path);
if (!$pathLength) {
throw $this->_createInvalidArgumentException($this->__('Not a valid path'), null, null, $orig... | php | {
"resource": ""
} |
q236401 | IsserTypeGuesser.guessType | train | public function guessType($class, $property)
{
$reflClass = new \ReflectionClass($class);
if ($reflClass->hasProperty($property)) {
$reflProp = $reflClass->getProperty($property);
if ($reflProp->isPublic()) {
return null;
}
}
if (!... | php | {
"resource": ""
} |
q236402 | AbstractErrorHandler.isExceptionRecoverable | train | protected function isExceptionRecoverable($e)
{
if ($e instanceof \ErrorException)
{
$ignore = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_STRICT;
return (($ignore & $e->getSeverity()) != 0);
}
return false;
} | php | {
"resource": ""
} |
q236403 | ListResourcesCommand.createResourcesFromJsonData | train | protected function createResourcesFromJsonData(array $data, ResponseInterface $response, ApiResourceInterface $owner)
{
$items = [];
$className = $this->resourceClass();
foreach ($data as $item) {
$items[] = new $className($owner->getApi(), $item, $owner);
}
ret... | php | {
"resource": ""
} |
q236404 | TypeChecker.datetime | train | public function datetime($value): bool
{
if (!is_scalar($value)) {
return false;
}
if (is_numeric($value)) {
return true;
}
return (int)strtotime($value) != 0;
} | php | {
"resource": ""
} |
q236405 | Persister.appendChangeSet | train | private function appendChangeSet(Model $model, array $obj, Closure $handler)
{
$metadata = $model->getMetadata();
$changeset = $model->getChangeSet();
$formatter = $this->getFormatter();
foreach ($this->changeSetMethods as $setKey => $methods) {
list($metaMethod, $format... | php | {
"resource": ""
} |
q236406 | Persister.createInsertObj | train | private function createInsertObj(Model $model)
{
$metadata = $model->getMetadata();
$insert = [
$this->getIdentifierKey() => $this->convertId($model->getId()),
];
if (true === $metadata->isChildEntity()) {
$insert[$this->getPolymorphicKey()] = $metadata->typ... | php | {
"resource": ""
} |
q236407 | Persister.getCreateChangeSetHandler | train | private function getCreateChangeSetHandler()
{
return function ($key, $value, $obj) {
if (null !== $value) {
$obj[$key] = $value;
}
return $obj;
};
} | php | {
"resource": ""
} |
q236408 | Persister.getUpdateChangeSetHandler | train | private function getUpdateChangeSetHandler()
{
return function ($key, $value, $obj) {
$op = '$set';
if (null === $value) {
$op = '$unset';
$value = 1;
}
$obj[$op][$key] = $value;
return $obj;
};
} | php | {
"resource": ""
} |
q236409 | DbAcl.check | train | public function check($requester, $request, $perms) {
$permission = $this->_classes['permission'];
return $permission::check($requester, $request, $perms);
} | php | {
"resource": ""
} |
q236410 | Parser.parse | train | public static function parse(array $argv, array $format)
{
$result = new Result();
if (empty($argv)) {
$result->error = 'empty argv';
return $result;
}
$result->command = array_shift($argv);
$pArgs = false;
$wait = null;
foreach ($argv ... | php | {
"resource": ""
} |
q236411 | Cache_Storage_Driver.set_contents | train | public function set_contents($contents, $handler = NULL)
{
$this->contents = $contents;
$this->set_content_handler($handler);
$this->contents = $this->handle_writing($contents);
return $this;
} | php | {
"resource": ""
} |
q236412 | Cache_Storage_Driver.set_content_handler | train | protected function set_content_handler($handler)
{
$this->handler_object = null;
$this->content_handler = (string) $handler;
return $this;
} | php | {
"resource": ""
} |
q236413 | Cache_Storage_Driver.get_content_handler | train | public function get_content_handler($handler = null)
{
if ( ! empty($this->handler_object))
{
return $this->handler_object;
}
// When not yet set, use $handler or detect the preferred handler (string = string, otherwise serialize)
if (empty($this->content_handler) && empty($handler))
{
if ( ! empty(... | php | {
"resource": ""
} |
q236414 | PhpArrayTrait._rindex | train | private function _rindex($index, array $values) : int
{
if (is_int($index) && $index < 0){
return count($values) + $index;
}
return $index;
} | php | {
"resource": ""
} |
q236415 | PhpArrayTrait._get | train | private function _get($index, $accept_reverse_index)
{
$values = $this->getValues();
if ($accept_reverse_index){
$index = $this->_rindex($index, $values);
}
return $values[$index] ?? null;
} | php | {
"resource": ""
} |
q236416 | PhpArrayTrait._first | train | private function _first(callable $callback = null)
{
$values = $this->getValues();
if ($callback){
foreach($values as $key => $value){
if ($callback($value, $key)){
return $value;
}
}
}
else{
retu... | php | {
"resource": ""
} |
q236417 | PhpArrayTrait._last | train | private function _last(callable $callback = null)
{
$values = $this->getValues();
if ($callback){
foreach(array_reverse($values) as $key => $value){
if ($callback($value, $key)){
return $value;
}
}
}
else{
... | php | {
"resource": ""
} |
q236418 | PhpArrayTrait._pop | train | private function _pop(& $item) : array
{
$values = $this->getValues();
if (empty($values)) {
$item = null;
return $values;
}
$item = array_pop($values);
return $values;
} | php | {
"resource": ""
} |
q236419 | PhpArrayTrait._indexOf | train | private function _indexOf($target, int $start = NULL )
{
$values = $this->getValues();
if ( $start === NULL ){
$start = 0;
}
$size = count($values);
for( $i=$start; $i < $size; $i++ ){
$item = $values[$i];
if ($item instanceof EqualableInte... | php | {
"resource": ""
} |
q236420 | SportDomainTrait.addObjects | train | public function addObjects($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass add to internal logic
try {
$this->doAddObjects($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['errors' => $e-... | php | {
"resource": ""
} |
q236421 | SportDomainTrait.addPositions | train | public function addPositions($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass add to internal logic
try {
$this->doAddPositions($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['errors' =>... | php | {
"resource": ""
} |
q236422 | SportDomainTrait.removeObjects | train | public function removeObjects($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass remove to internal logic
try {
$this->doRemoveObjects($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['error... | php | {
"resource": ""
} |
q236423 | SportDomainTrait.removePositions | train | public function removePositions($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass remove to internal logic
try {
$this->doRemovePositions($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['e... | php | {
"resource": ""
} |
q236424 | SportDomainTrait.updateGroups | train | public function updateGroups($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass update to internal logic
try {
$this->doUpdateGroups($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['errors'... | php | {
"resource": ""
} |
q236425 | SportDomainTrait.updateObjects | train | public function updateObjects($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass update to internal logic
try {
$this->doUpdateObjects($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['error... | php | {
"resource": ""
} |
q236426 | SportDomainTrait.updatePositions | train | public function updatePositions($id, $data) {
// find
$model = $this->get($id);
if ($model === null) {
return new NotFound(['message' => 'Sport not found.']);
}
// pass update to internal logic
try {
$this->doUpdatePositions($model, $data);
} catch (ErrorsException $e) {
return new NotValid(['e... | php | {
"resource": ""
} |
q236427 | SportDomainTrait.doAddObjects | train | protected function doAddObjects(Sport $model, $data) {
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Object';
} else {
$related = ObjectQuery::create()->findOneById($entry['id']);
$model->addObject($related);
}
}
if (count($errors) > 0) {... | php | {
"resource": ""
} |
q236428 | SportDomainTrait.doAddPositions | train | protected function doAddPositions(Sport $model, $data) {
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Position';
} else {
$related = PositionQuery::create()->findOneById($entry['id']);
$model->addPosition($related);
}
}
if (count($errors... | php | {
"resource": ""
} |
q236429 | SportDomainTrait.doAddSkills | train | protected function doAddSkills(Sport $model, $data) {
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery::create()->findOneById($entry['id']);
$model->addSkill($related);
}
}
if (count($errors) > 0) {
... | php | {
"resource": ""
} |
q236430 | SportDomainTrait.doRemoveObjects | train | protected function doRemoveObjects(Sport $model, $data) {
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Object';
} else {
$related = ObjectQuery::create()->findOneById($entry['id']);
$model->removeObject($related);
}
}
if (count($errors) ... | php | {
"resource": ""
} |
q236431 | SportDomainTrait.doRemovePositions | train | protected function doRemovePositions(Sport $model, $data) {
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Position';
} else {
$related = PositionQuery::create()->findOneById($entry['id']);
$model->removePosition($related);
}
}
if (count($... | php | {
"resource": ""
} |
q236432 | SportDomainTrait.doUpdateGroups | train | protected function doUpdateGroups(Sport $model, $data) {
// remove all relationships before
GroupQuery::create()->filterBySport($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Group';
} else {
$related = GroupQuery... | php | {
"resource": ""
} |
q236433 | SportDomainTrait.doUpdateObjects | train | protected function doUpdateObjects(Sport $model, $data) {
// remove all relationships before
ObjectQuery::create()->filterBySport($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Object';
} else {
$related = ObjectQ... | php | {
"resource": ""
} |
q236434 | SportDomainTrait.doUpdatePositions | train | protected function doUpdatePositions(Sport $model, $data) {
// remove all relationships before
PositionQuery::create()->filterBySport($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Position';
} else {
$related = P... | php | {
"resource": ""
} |
q236435 | SportDomainTrait.doUpdateSkills | train | protected function doUpdateSkills(Sport $model, $data) {
// remove all relationships before
SkillQuery::create()->filterBySport($model)->delete();
// add them
$errors = [];
foreach ($data as $entry) {
if (!isset($entry['id'])) {
$errors[] = 'Missing id for Skill';
} else {
$related = SkillQuery... | php | {
"resource": ""
} |
q236436 | SportDomainTrait.get | train | protected function get($id) {
if ($this->pool === null) {
$this->pool = new Map();
} else if ($this->pool->has($id)) {
return $this->pool->get($id);
}
$model = SportQuery::create()->findOneById($id);
$this->pool->set($id, $model);
return $model;
} | php | {
"resource": ""
} |
q236437 | ErrorCollection.addErrors | train | public function addErrors(ErrorResourceInterface ...$errors): void
{
$this->errors = array_merge($this->errors, $errors);
} | php | {
"resource": ""
} |
q236438 | Stack.push | train | public function push(... $items) : Stack
{
$values = $this->_pushAll($items);
$this->setValues($values);
return $this;
} | php | {
"resource": ""
} |
q236439 | PermissionRepository.getAll | train | public function getAll(): iterable
{
if ($this->permissions === null) {
/** @var array $list */
$list = app()->getCollector()->collect('permissions')->get();
$key = 0;
$names = [];
$permissions = [];
foreach ($list as $name => $descr... | php | {
"resource": ""
} |
q236440 | PermissionRepository.getByName | train | public function getByName(string $name): ?IPermission
{
if ($this->permissions === null) {
$this->getAll();
}
if (!isset($this->names[$name])) {
return null;
}
return $this->permissions[$this->names[$name]];
} | php | {
"resource": ""
} |
q236441 | PermissionRepository.getMultipleByName | train | public function getMultipleByName(array $permissions): array
{
if ($this->permissions === null) {
$this->getAll();
}
$results = [];
foreach ($permissions as $permission) {
if (isset($this->names[$permission])) {
$results[] = $this->permission... | php | {
"resource": ""
} |
q236442 | InlineServiceDefinitionsPass.process | train | public function process(ContainerBuilder $container)
{
$this->compiler = $container->getCompiler();
$this->formatter = $this->compiler->getLoggingFormatter();
$this->graph = $this->compiler->getServiceReferenceGraph();
$container->setDefinitions($this->inlineArguments($container, $c... | php | {
"resource": ""
} |
q236443 | InlineServiceDefinitionsPass.inlineArguments | train | private function inlineArguments(ContainerBuilder $container, array $arguments, $isRoot = false)
{
foreach ($arguments as $k => $argument) {
if ($isRoot) {
$this->currentId = $k;
}
if (is_array($argument)) {
$arguments[$k] = $this->inlineAr... | php | {
"resource": ""
} |
q236444 | EmailController.send | train | private function send($message)
{
$widget = new Widget;
$templateParams = Json::decode($message->packed_json_template_params);
return \Yii::$app->mailer
->compose($message->template->body_view_file, $templateParams)
->setFrom(Module::module()->senderEmail)
... | php | {
"resource": ""
} |
q236445 | EmailController.actionSend | train | public function actionSend($id)
{
$message = Message::findOne($id);
if ($message !== null) {
try {
$message->status = $this->send($message) > 0 ? Message::STATUS_SUCCESS : Message::STATUS_ERROR;
$message->save(true, ['status']);
} catch (\Excep... | php | {
"resource": ""
} |
q236446 | EmailController.sendFailed | train | public function sendFailed()
{
$messages = Message::findAll(['status' => Message::STATUS_ERROR]);
foreach ($messages as $message) {
try {
$message->status = $this->send($message) > 0 ? Message::STATUS_SUCCESS : Message::STATUS_ERROR;
$message->save(true, [... | php | {
"resource": ""
} |
q236447 | Renderer.render | train | public function render($nameOrModel, array $variables = [])
{
$__module = null;
if ($nameOrModel instanceof ViewModelInterface) {
$model = $nameOrModel;
$nameOrModel = $model->getTemplate();
$__module = $model->getModule();
$variables = arr... | php | {
"resource": ""
} |
q236448 | CropHandler.create | train | public static function create($baseFolder = null, $cropsFolder = null, $adaptor = null)
{
return new static( $baseFolder, $cropsFolder, $adaptor );
} | php | {
"resource": ""
} |
q236449 | CropHandler.handle | train | public function handle($data = null)
{
// Handle data with adaptor
$adaptor = $this->getAdaptor();
if ( $adaptor ) {
$data = $adaptor->transform( $data, $this );
}
// Overwrite default data with data
$data = array_merge( [
'name'=>null,
... | php | {
"resource": ""
} |
q236450 | CropHandler.getBaseFolder | train | public function getBaseFolder( $path = null )
{
if ( $path ) {
return sprintf( '%s/%s', $this->baseFolder, $path );
}
return $this->baseFolder;
} | php | {
"resource": ""
} |
q236451 | CropHandler.getCropsFolder | train | public function getCropsFolder( $path = null )
{
if ( ! $this->cropsFolder ) {
return $this->getBaseFolder($path);
}
if ( $path ) {
return sprintf( '%s/%s', $this->cropsFolder, basename( $path ) );
}
return $this->cropsFolder;
} | php | {
"resource": ""
} |
q236452 | CropHandler.setAdaptor | train | public function setAdaptor($adaptor = null)
{
// Set the adaptor
$this->adaptor = $adaptor;
// If we just want to reset the adaptor
if ( ! $adaptor ) {
return $this;
}
// Validate the adaptor
if ( ! ( $adaptor instanceof CropAdaptorInterface ) )... | php | {
"resource": ""
} |
q236453 | OAuthConfiguration.getProvider | train | public function getProvider(): AbstractProvider
{
$class = $this->providerClass();
return new $class([
'clientId' => $this->clientId,
'clientSecret' => $this->clientSecret,
'redirectUri' => $this->redirectUrl,
]);
} | php | {
"resource": ""
} |
q236454 | QueryString.bindIn | train | public function bindIn($token, $array)
{
$bindString = "";
foreach ($array as $value) {
$bindString .= ',:fautoIn' . ++$this->whereInCount;
$this->bindValue(':fautoIn' . $this->whereInCount, $value);
}
// TODO saffer replace
$this->sqlString = str_rep... | php | {
"resource": ""
} |
q236455 | Utils.compareStr | train | public static function compareStr($str1, $str2) {
$len1 = static::binaryStrlen($str1);
$len2 = static::binaryStrlen($str2);
$len = min($len1, $len2);
$diff = $len1 ^ $len2;
for ($i = 0; $i < $len; $i++) {
$diff |= ord($str1[$i]) ^ ord($str2[$i]);
}
return $diff === 0;
} | php | {
"resource": ""
} |
q236456 | UploadedFile.validate | train | public function validate() {
if( $this->error ) {
switch( $this->error ) {
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE: {
throw new UserException('fileTooBig');
break;
}
case UPLOAD_ERR_PARTIAL:
case UPLOAD_ERR_NO_FILE: {
throw new UserException('transfertIssue');
br... | php | {
"resource": ""
} |
q236457 | UploadedFile.loadPath | train | protected static function loadPath($from, &$files=array(), $path='') {
$fileName = ($path === '') ? $from['name'] : apath_get($from['name'], $path);
// debug('LoadPath('.$path.') - $fileName', $fileName);
if( empty($fileName) ) { return $files; }
if( is_array($fileName) ) {
if( $path!=='' ) { $path .= '/'; }... | php | {
"resource": ""
} |
q236458 | Validator.addIteratedValidationMessages | train | protected function addIteratedValidationMessages($attribute, $messages = [])
{
foreach ($messages as $field => $message) {
$field_name = $attribute.$field;
$messages[$field_name] = $message;
}
$this->setCustomMessages($messages);
} | php | {
"resource": ""
} |
q236459 | ArrayRepository.setFor | train | public function setFor($key, \DateTime $date, $value)
{
$this->data[$this->keyFor($key, $date)] = $value;
} | php | {
"resource": ""
} |
q236460 | ArrayRepository.setForRange | train | public function setForRange($key, \DateTime $start, \DateTime $end, $value)
{
$this->data[$this->keyForRange($key, $start, $end)] = $value;
} | php | {
"resource": ""
} |
q236461 | ArrayRepository.getFor | train | public function getFor($key, \DateTime $date)
{
if (!$this->hasFor($key, $date)) {
return null;
}
return $this->data[$this->keyFor($key, $date)];
} | php | {
"resource": ""
} |
q236462 | ArrayRepository.getForRange | train | public function getForRange($key, \DateTime $start, \DateTime $end)
{
if (!$this->hasForRange($key, $start, $end)) {
return null;
}
return $this->data[$this->keyForRange($key, $start, $end)];
} | php | {
"resource": ""
} |
q236463 | ArrayRepository.hasFor | train | public function hasFor($key, \DateTime $date)
{
return array_key_exists($this->keyFor($key, $date), $this->data);
} | php | {
"resource": ""
} |
q236464 | ArrayRepository.hasForRange | train | public function hasForRange($key, \DateTime $start, \DateTime $end)
{
return array_key_exists($this->keyForRange($key, $start, $end), $this->data);
} | php | {
"resource": ""
} |
q236465 | ArrayRepository.keyForRange | train | protected function keyForRange($key, \DateTime $start, \DateTime $end)
{
return 'range:' . $key . '_' . $this->dateString($start) . '_' . $this->dateString($end);
} | php | {
"resource": ""
} |
q236466 | ArrayRepository.removeFor | train | public function removeFor($key, \DateTime $date)
{
unset($this->data[$this->keyFor($key, $date)]);
} | php | {
"resource": ""
} |
q236467 | ArrayRepository.removeForRange | train | public function removeForRange($key, \DateTime $start, \DateTime $end)
{
unset($this->data[$this->keyForRange($key, $start, $end)]);
} | php | {
"resource": ""
} |
q236468 | FactoryHelperTrait.isTypeMatched | train | protected function isTypeMatched($class, array $arguments)/*# : bool */
{
if (empty($arguments)) {
return false;
} elseif (null !== $class) {
return is_a($arguments[0], $class->getName());
} else {
return true;
}
} | php | {
"resource": ""
} |
q236469 | FactoryHelperTrait.getCallableParameters | train | protected function getCallableParameters(callable $callable)/*# : array */
{
// array type
if (is_array($callable)) {
$reflector = new \ReflectionClass($callable[0]);
$method = $reflector->getMethod($callable[1]);
// object with __invoke() defined
} elseif ($... | php | {
"resource": ""
} |
q236470 | FactoryHelperTrait.getObjectByClass | train | protected function getObjectByClass(/*# string */ $classname)
{
if ($this->getResolver()->hasService($classname)) {
$serviceId = ObjectResolver::getServiceId($classname);
return $this->getResolver()->get($serviceId);
}
throw new LogicException(
Message::ge... | php | {
"resource": ""
} |
q236471 | FactoryHelperTrait.mergeMethods | train | protected function mergeMethods($nodeData)/*# : array */
{
// no merge
if (empty($nodeData) || isset($nodeData[0])) {
return (array) $nodeData;
}
// in sections
$result = [];
foreach ($nodeData as $data) {
$result = array_merge($result, $data)... | php | {
"resource": ""
} |
q236472 | FactoryHelperTrait.getCommonMethods | train | protected function getCommonMethods()/*# : array */
{
// di.common node
$commNode = $this->getResolver()->getSectionId('', 'common');
return $this->mergeMethods(
$this->getResolver()->get($commNode)
);
} | php | {
"resource": ""
} |
q236473 | Consumer.getMessages | train | protected function getMessages($shard_id = NULL, $last_sequence_number = NULL): array
{
$records = [];
// Get the initial iterator.
try {
$shard_iterator = $this->getInitialShardIterator($shard_id, $last_sequence_number);
} catch (\Exception $e) {
$this->pro... | php | {
"resource": ""
} |
q236474 | Consumer.getInitialShardIterator | train | protected function getInitialShardIterator($shard_id, $starting_sequence_number = NULL)
{
$args = [
'ShardId' => $shard_id,
'StreamName' => $this->getStreamName(),
'ShardIteratorType' => $this->initialShardIteratorType,
];
// If we have the starting sequ... | php | {
"resource": ""
} |
q236475 | Consumer.getShardIds | train | protected function getShardIds(): array
{
$key = $this->getStreamName() . '.shard_ids';
if ($this->cache->has($key)) {
return $this->cache->get($key);
}
$res = $this->getClient()->describeStream(['StreamName' => $this->getStreamName()]);
$shard_ids = $res->searc... | php | {
"resource": ""
} |
q236476 | Taggable.bootTaggable | train | public static function bootTaggable()
{
static::created(function (Model $taggableModel) {
if ($taggableModel->queuedTags) {
$taggableModel->tag($taggableModel->queuedTags);
$taggableModel->queuedTags = [];
}
});
static::deleted(functi... | php | {
"resource": ""
} |
q236477 | Taggable.tagsWithGroup | train | public function tagsWithGroup(string $group = null): Collection
{
return $this->tags->filter(function (Tag $tag) use ($group) {
return $tag->group === $group;
});
} | php | {
"resource": ""
} |
q236478 | Taggable.hasTag | train | public function hasTag($tags): bool
{
// Single tag slug
if (is_string($tags)) {
return $this->tags->contains('slug', $tags);
}
// Single tag id
if (is_int($tags)) {
return $this->tags->contains('id', $tags);
}
// Single tag model
... | php | {
"resource": ""
} |
q236479 | Taggable.prepareTags | train | protected function prepareTags($tags)
{
if (is_string($tags) && mb_strpos($tags, static::getTagsDelimiter()) !== false) {
$delimiter = preg_quote(static::getTagsDelimiter(), '#');
$tags = array_map('trim', preg_split("#[{$delimiter}]#", $tags, -1, PREG_SPLIT_NO_EMPTY));
}
... | php | {
"resource": ""
} |
q236480 | Taggable.hydrateTags | train | protected function hydrateTags($tags, bool $createMissing = false): Collection
{
$tags = static::prepareTags($tags);
$isTagsStringBased = static::isTagsStringBased($tags);
$isTagsIntBased = static::isTagsIntBased($tags);
$field = $isTagsStringBased ? 'slug' : 'id';
$className... | php | {
"resource": ""
} |
q236481 | ExportController.index | train | public function index($instances = "", $selfedit="false") {
$this->instances = $instances;
$this->generatedCode = "";
if ($instances) {
$this->export($instances, $selfedit);
}
$this->content->addFile(dirname(__FILE__)."/../../../../views/exportForm.php", $this);
$this->template->toHtml();
} | php | {
"resource": ""
} |
q236482 | ExportController.export | train | public function export($instances, $selfedit="false") {
if ($selfedit == "true") {
$moufManager = MoufManager::getMoufManager();
} else {
$moufManager = MoufManager::getMoufManagerHiddenInstance();
}
$instancesList = explode("\n", $instances);
$cleaninstancesList = array();
foreach ($insta... | php | {
"resource": ""
} |
q236483 | TurboSmsAdapterFactory.soap | train | public static function soap(string $login, string $password): TurboSmsSoapAdapter
{
$responseParser = (new ResponseParserFactory())->create();
$soapClient = (new SoapClientFactory())->create();
$configuration = new Configuration($login, $password);
$authenticator = new TurboSmsSoapAu... | php | {
"resource": ""
} |
q236484 | PhpErrorException.logError | train | protected static function logError(self $e): void
{
if (class_exists('\Osf\Log\LogProxy')) {
$msg = get_class($e) . ' : ' . $e->getMessage();
try {
\Osf\Log\LogProxy::log($msg, $e->getLogLevel(), 'PHPERR', $e->getTraceAsString());
} catch (\Exception $ex) ... | php | {
"resource": ""
} |
q236485 | PhpErrorException.triggerApplication | train | protected static function triggerApplication(self $e): void
{
if (class_exists('\Osf\Application\OsfApplication')) {
if (\Osf\Application\OsfApplication::isDevelopment()) {
\Osf\Exception\Error::displayException($e);
} else {
if (\Osf\Application\OsfAp... | php | {
"resource": ""
} |
q236486 | WhileManager.addTick | train | public function addTick(TickInterface $tick)
{
$tick->setManager($this);
$this->ticks[$tick->getName()] = [
'tick' => $tick,
'time' => 0,
];
return $this;
} | php | {
"resource": ""
} |
q236487 | WhileManager.removeTick | train | public function removeTick($name)
{
if (isset($this->ticks[$name])) {
$this->ticks[$name]->setManager(null);
unset($this->ticks[$name]);
}
} | php | {
"resource": ""
} |
q236488 | WhileManager.start | train | public function start()
{
if ($this->isStart) {
return;
}
$this->startAt = time();
$this->stopAt = null;
$this->isStart = true;
if (extension_loaded('xdebug')) {
xdebug_disable();
}
foreach ($this->onStart as $callable) {
... | php | {
"resource": ""
} |
q236489 | WhileManager.tick | train | protected function tick()
{
$time = microtime(true);
foreach ($this->ticks as $name => $value) {
/* @var TickInterface $tick */
$tick = $value['tick'];
$interval = $tick->getInterval() >= $this->interval ? $tick->getInterval() : $this->interval;
$... | php | {
"resource": ""
} |
q236490 | PasswordBroker.emailResetLink | train | public function emailResetLink(CanResetPasswordContract $user, $token, Closure $callback = null)
{
// We will use the reminder view that was given to the broker to display the
// password reminder e-mail. We'll pass a "token" variable into the views
// so that it may be displayed for an user to click for passwor... | php | {
"resource": ""
} |
q236491 | ContentTypeSchemaInitializer.initialize | train | public function initialize()
{
$contentTypes = $this->contentTypeRepository->findAllNotDeletedInLastVersion();
foreach ($contentTypes as $contentType) {
$this->schemaGenerator->createMapping($contentType);
}
} | php | {
"resource": ""
} |
q236492 | PresentableTrait.toOutput | train | public function toOutput($structure, $assoc = true)
{
switch ($structure) {
case 'string':
$output = $this->toString();
break;
case 'array':
default:
$output = $this->toArray($assoc);
break;
}
... | php | {
"resource": ""
} |
q236493 | PresentableTrait.toJson | train | public function toJson($options = 0, $structure, $assoc = true)
{
return json_encode(
$this->toOutput($structure, $assoc),
$options
);
} | php | {
"resource": ""
} |
q236494 | QueryFactory.doLoad | train | protected function doLoad($itemMetaData)
{
$query = $this->newQueryInstance($itemMetaData);
$databaseMapping = $this->ormDriver->loadDatabaseMapping($itemMetaData);
$query->mapDatabase($databaseMapping, $itemMetaData->getItemClass(), $itemMetaData->getHitPositions());
return $query;
} | php | {
"resource": ""
} |
q236495 | Mailer.sendSubscribeToNewsletterMessage | train | public function sendSubscribeToNewsletterMessage(Actor $user)
{
$templateName = 'CoreBundle:Email:subscription.email.html.twig';
$context = array(
'user' => $user
);
$this->sendMessage(
$templateName,
$context,
$this->t... | php | {
"resource": ""
} |
q236496 | Mailer.sendContactMessage | train | public function sendContactMessage(array $params)
{
$templateName = 'CoreBundle:Email:base.email.html.twig';
$context = array(
'params' => $params
);
$this->sendMessage(
$templateName,
$context,
$this->twigGloba... | php | {
"resource": ""
} |
q236497 | Mailer.sendNotificationEmail | train | public function sendNotificationEmail($mail, $from=null)
{
$templateName = 'CoreBundle:Email:notification.email.html.twig';
$context = array(
'mail' => $mail
);
if(is_null($from)){
$this->sendMessage(
$templateName,
$... | php | {
"resource": ""
} |
q236498 | Mailer.sendAdvertPurchaseConfirmationMessage | train | public function sendAdvertPurchaseConfirmationMessage(Invoice $invoice, $amount)
{
//send email to optic to confirm plan purchase
//check empty bank number account
$templateName = 'PaymentBundle:Email:advert.confirmation.html.twig';
$advert = $invoice->getTransaction()->getItems()->f... | php | {
"resource": ""
} |
q236499 | Mailer.sendPurchaseConfirmationMessage | train | public function sendPurchaseConfirmationMessage(Invoice $invoice, $amount)
{
$templateName = 'PaymentBundle:Email:sale.confirmation.html.twig';
$toEmail = $invoice->getTransaction()->getActor()->getEmail();
$orderUrl = $this->router->generate('payment_checkout_showinvoice', array('nu... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.