_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q246200
XmlRenderListener.detach
validation
public function detach(EventManagerInterface $events) { foreach ($this->listeners as $index => $listener) { if ($events->detach($listener)) { unset($this->listeners[$index]); } } /* @var SharedEventManager $sharedEvents */ $sharedEvents = $even...
php
{ "resource": "" }
q246201
Form.render
validation
public function render(FormInterface $form, $layout = self::LAYOUT_HORIZONTAL, $parameter = array()) { /* @var $renderer \Zend\View\Renderer\PhpRenderer */ $formContent = $this->renderBare($form, $layout, $parameter); $renderer = $this->getView(); if ($form instanceof Des...
php
{ "resource": "" }
q246202
FormEvent.setForm
validation
public function setForm($form) { if (!$form instanceof FormInterface && !$form instanceof Container) { throw new \InvalidArgumentException('Form must either implement \Zend\Form\FormInterface or extend from \Core\Form\Container'); } $this->form = $form; return $this; ...
php
{ "resource": "" }
q246203
AdminControllerEvent.addViewModel
validation
public function addViewModel($name, $model, $priority=0) { $this->models->insert($name, $model, $priority); return $this; }
php
{ "resource": "" }
q246204
AdminControllerEvent.addViewTemplate
validation
public function addViewTemplate($name, $template, $vars = [], $priority = 0) { if (is_int($vars)) { $priority = $vars; $vars = []; } $model = new ViewModel($vars); $model->setTemplate($template); return $this->addViewModel($name, $model, $priority); ...
php
{ "resource": "" }
q246205
AdminControllerEvent.addViewVariables
validation
public function addViewVariables($name, $data = [], $priority = 0) { if (is_array($name)) { if (!isset($name['name'])) { throw new \DomainException('Key "name" must be specified, if array is passed as first parameter.'); } if (is_int($data)) { ...
php
{ "resource": "" }
q246206
Params.fromFiles
validation
public function fromFiles($name = null, $default = null) { if ($name === null) { return $this->event->getRequest()->getFiles($name, $default)->toArray(); } return $this->event->getRequest()->getFiles($name, $default); }
php
{ "resource": "" }
q246207
Params.fromHeader
validation
public function fromHeader($header = null, $default = null) { if ($header === null) { return $this->event->getRequest()->getHeaders($header, $default)->toArray(); } return $this->event->getRequest()->getHeaders($header, $default); }
php
{ "resource": "" }
q246208
Params.fromPost
validation
public function fromPost($param = null, $default = null) { if ($param === null) { return $this->event->getRequest()->getPost($param, $default)->toArray(); } return $this->event->getRequest()->getPost($param, $default); }
php
{ "resource": "" }
q246209
Params.fromQuery
validation
public function fromQuery($param = null, $default = null) { if ($param === null) { return $this->event->getRequest()->getQuery($param, $default)->toArray(); } return $this->event->getRequest()->getQuery($param, $default); }
php
{ "resource": "" }
q246210
Params.fromEvent
validation
public function fromEvent($param = null, $default = null) { if (null === $param) { return $this->event->getParams(); } return $this->event->getParam($param, $default); }
php
{ "resource": "" }
q246211
UniqueId.process
validation
public function process(array $event) { $event = parent::process($event); $event['uniqueId'] = substr($event['extra']['requestId'], 0, 7); unset($event['extra']['requestId']); return $event; }
php
{ "resource": "" }
q246212
ContentItem.convert
validation
public static function convert(ContentItemInterface $from, ContentItemInterface $to) { $reflectionFrom = new \ReflectionClass($from); $reflectionTo = new \ReflectionClass($to); foreach ($reflectionFrom->getProperties() as $property) { $property->setAccessible(true); ...
php
{ "resource": "" }
q246213
TreeHydrator.flattenTree
validation
private function flattenTree($tree, &$data, $curId = '1') { $data[] = new \ArrayObject([ 'id' => $tree->getId(), 'current' => $curId, 'name' => $tree->getName(), 'value' => $tree->getValue(), 'priority' => $tree->getPriority(), ...
php
{ "resource": "" }
q246214
TreeHydrator.prepareHydrateData
validation
private function prepareHydrateData(array $data) { /* * unflatten tree */ $items = $data['items']; $tree = [ '__root__' => array_shift($items) ]; foreach ($items as $item) { $parent = substr($item['current'], 0, strrpos($item['current'], '-')); ...
php
{ "resource": "" }
q246215
TreeHydrator.hydrateTree
validation
private function hydrateTree(NodeInterface $object, \ArrayObject $currentData = null) { if (null === $currentData) { $currentData = $this->hydrateData['__root__']; } if ('set' == $currentData['do']) { $object ->setName($currentData['name']) ...
php
{ "resource": "" }
q246216
TreeHydrator.findOrCreateChild
validation
private function findOrCreateChild($tree, $id) { /* @var NodeInterface $node */ foreach ($tree->getChildren() as $node) { if ($id && $node->getId() == $id) { return $node; } } $nodeClass = get_class($tree); $node = new $nodeClass(); ...
php
{ "resource": "" }
q246217
AssetsInstallController.factory
validation
public static function factory(ContainerInterface $container) { /* @var ModuleManager $manager */ $manager = $container->get('ModuleManager'); $modules = $manager->getLoadedModules(); return new static($modules); }
php
{ "resource": "" }
q246218
FileTransport.send
validation
public function send(\Zend\Mail\Message $message) { $options = $this->options; $filename = call_user_func($options->getCallback(), $this); $file = $options->getPath() . DIRECTORY_SEPARATOR . $filename; $contents = $message->toString(); $umask = umask(); umask(0...
php
{ "resource": "" }
q246219
NameFilter.filter
validation
public function filter($value) { return isset($this->map[$value]) ? $this->map[$value] : $value; }
php
{ "resource": "" }
q246220
SearchForm.get
validation
public function get($form, $options = null, $params = null) { if (!is_object($form)) { $form = $this->formElementManager->get($form, $options); } /** @noinspection PhpUndefinedMethodInspection */ $params = $params ?: clone $this->getController()->ge...
php
{ "resource": "" }
q246221
TimezoneAwareDate.convertToDatabaseValue
validation
public function convertToDatabaseValue($value) { if (!$value instanceof \DateTime) { return null; } $timezone = $value->getTimezone()->getName(); $timestamp = $value->getTimestamp(); $date = new \MongoDate($timestamp); return array(...
php
{ "resource": "" }
q246222
TimezoneAwareDate.convertToPhpValue
validation
public function convertToPhpValue($value) { if (!is_array($value) || !isset($value['date']) || !$value['date'] instanceof \MongoDate || !isset($value['tz']) ) { return null; } $timestamp = $value['date']->sec; $date = n...
php
{ "resource": "" }
q246223
FormEditor.setOptions
validation
public function setOptions($options) { foreach ($options as $key => $val) { $this->setOption($key, $val); } }
php
{ "resource": "" }
q246224
Container.getIterator
validation
public function getIterator() { $iterator = new PriorityList(); $iterator->isLIFO(false); foreach ($this->activeForms as $key) { $spec = $this->forms[$key]; $priority = isset($spec['priority']) ? $spec['priority'] : 0; $iterator->insert($key, $this->getF...
php
{ "resource": "" }
q246225
Container.setParams
validation
public function setParams(array $params) { $this->params = array_merge($this->params, $params); foreach ($this->forms as $form) { if (isset($form['__instance__']) && is_object($form['__instance__']) && method_exists($form['__instance__'], 'setPara...
php
{ "resource": "" }
q246226
Container.setParam
validation
public function setParam($key, $value) { $this->params[$key] = $value; foreach ($this->forms as $form) { if (isset($form['__instance__']) && is_object($form['__instance__']) && method_exists($form['__instance__'], 'setParam') ) { ...
php
{ "resource": "" }
q246227
Container.executeAction
validation
public function executeAction($name, array $data = []) { if (false !== strpos($name, '.')) { list($name, $childKey) = explode('.', $name, 2); $container = $this->getForm($name); // execute child container's action return $container->executeAction(...
php
{ "resource": "" }
q246228
Container.setForm
validation
public function setForm($key, $spec, $enabled = true) { if (is_object($spec)) { if ($spec instanceof FormParentInterface) { $spec->setParent($this); } $spec = [ '__instance__' => $spec, 'name' => $key, 'entity' => '*' ]; } if (!is_array($...
php
{ "resource": "" }
q246229
Container.setForms
validation
public function setForms(array $forms, $enabled = true) { foreach ($forms as $key => $spec) { if (is_array($spec) && isset($spec['enabled'])) { $currentEnabled = $spec['enabled']; unset($spec['enabled']); } else { $currentEnabled = $ena...
php
{ "resource": "" }
q246230
Container.enableForm
validation
public function enableForm($key = null) { if (null === $key) { $this->activeForms = array_keys($this->forms); return $this; } if (!is_array($key)) { $key = array($key); } foreach ($key as $k) { if (false !== st...
php
{ "resource": "" }
q246231
Container.disableForm
validation
public function disableForm($key = null) { if (null === $key) { $this->activeForms = array(); return $this; } if (!is_array($key)) { $key = array($key); } foreach ($key as $k) { if (false !== strpos($k, '.')) {...
php
{ "resource": "" }
q246232
Container.getEntity
validation
public function getEntity($key='*') { return isset($this->entities[$key]) ? $this->entities[$key] : null; }
php
{ "resource": "" }
q246233
Container.mapEntity
validation
protected function mapEntity($form, $entity, $property) { if (false === $property) { return; } if (true === $property) { $mapEntity = $entity; } elseif ($entity->hasProperty($property) || is_callable([$entity, "get$property"])) { $getter = "get$pr...
php
{ "resource": "" }
q246234
Container.getActiveFormActual
validation
public function getActiveFormActual($setDefault = true) { $key = null; if (!empty($this->activeForms)) { $key = $this->activeForms[0]; } if (!isset($key) && $setDefault) { $formsAvailable = array_keys($this->forms); $key = array_shift($formsAvailab...
php
{ "resource": "" }
q246235
Container.getActiveFormPrevious
validation
public function getActiveFormPrevious() { $key = null; $actualKey = $this->getActiveFormActual(); if (isset($actualKey)) { $forms = array_keys($this->forms); $formsFlip = array_flip($forms); $index = $formsFlip[$actualKey]; if (0 < $index) { ...
php
{ "resource": "" }
q246236
Container.getActiveFormNext
validation
public function getActiveFormNext() { $key = null; $actualKey = $this->getActiveFormActual(); if (isset($actualKey)) { $forms = array_keys($this->forms); $formsFlip = array_flip($forms); $index = $formsFlip[$actualKey]; if ($index < count($for...
php
{ "resource": "" }
q246237
SearchForm.getColumnMap
validation
public function getColumnMap() { $map = $this->getOption('column_map'); if (null === $map) { $map = []; foreach ($this as $element) { $col = $element->getOption('span'); if (null !== $col) { $map[$element->getName()] = $col...
php
{ "resource": "" }
q246238
SearchForm.setSearchParams
validation
public function setSearchParams($params) { if ($params instanceof \Traversable) { $params = ArrayUtils::iteratorToArray($params); } $params = Json::encode($params); $this->setAttribute('data-search-params', $params); return $this; }
php
{ "resource": "" }
q246239
ScheduledContentVoter.decide
validation
public static function decide(ScheduledContentInterface $object, array $attributes = []) { $now = new \DateTimeImmutable(); $vote = VoterInterface::ACCESS_ABSTAIN; $from = $object->isScheduledFrom(); $till = $object->isScheduledTill(); if (!$object->isPublic() || false === s...
php
{ "resource": "" }
q246240
PageAdmin.fixOneToMany
validation
protected function fixOneToMany(PageInterface $object) { $items = $object->getContentItems(); if ($items) { foreach ($object->getContentItems() as $item) { $item->setPage($object); } } if ($this->menuManager) { $this->menuManager->f...
php
{ "resource": "" }
q246241
PageAdmin.preRemove
validation
public function preRemove($object) { if (!is_null($this->urlProvider) && !is_null($this->menuManager)) { $url = $this->urlProvider->url($object); $menuItem = $this->menuManager->getItem($url); if ($menuItem instanceof MenuItem) { $this->menuManager->...
php
{ "resource": "" }
q246242
PageAdmin.removeTab
validation
public function removeTab($tabName, FormMapper $formMapper) { $tabs = $this->getFormTabs(); if (array_key_exists($tabName, $tabs)) { $groups = $this->getFormGroups(); if (!is_array($groups)) { return; } foreach ($tabs[$tabName]['grou...
php
{ "resource": "" }
q246243
PageAdmin.removeEmptyGroups
validation
public function removeEmptyGroups() { $tabs = $this->getFormTabs(); if (!is_array($tabs)) { return; } $groups = $this->getFormGroups(); foreach ($tabs as $tabKey => $tab) { foreach ($tab['groups'] as $tabGroup) { if (!array_key_exist...
php
{ "resource": "" }
q246244
EventManagerAbstractFactory.getConfig
validation
protected function getConfig($services, $name) { $defaults = [ 'service' => 'EventManager', 'configure' => true, 'identifiers' => [ $name ], 'event' => '\Zend\EventManager\Event', 'listeners' => [], ]; $config = $services->get('Con...
php
{ "resource": "" }
q246245
EventManagerAbstractFactory.createEventManager
validation
protected function createEventManager($services, $config) { /* @var \Zend\EventManager\EventManagerInterface|\Core\EventManager\EventProviderInterface $events */ if ($services->has($config['service'])) { $events = $services->get($config['service']); } else { if (!cla...
php
{ "resource": "" }
q246246
EventManagerAbstractFactory.attachListeners
validation
protected function attachListeners($services, $eventManager, $listeners) { $lazyListeners = []; foreach ($listeners as $name => $options) { $options = $this->normalizeListenerOptions($name, $options); if ($options['lazy'] && null !== $options['attach']) { fo...
php
{ "resource": "" }
q246247
EventManagerAbstractFactory.normalizeListenerOptions
validation
protected function normalizeListenerOptions($name, $options) { /* * $options is an array with following meta-syntax: * * $options = [ * string:listener => string:event, * string:listener => [ string|array:event{, string:methodName}{, int:priority}{, b...
php
{ "resource": "" }
q246248
AbstractStatusEntity.init
validation
private function init($name) { if (null === $name) { $name = $this->default; } if (!isset(static::$orderMap[ $name ])) { throw new \InvalidArgumentException(sprintf( 'Unknown status name "%s" for "%s"', $name, static::c...
php
{ "resource": "" }
q246249
ContentCollector.trigger
validation
public function trigger($event, $target = null) { if (empty($this->_template) || !is_string($this->_template)) { throw new \InvalidArgumentException('ContentCollector must have a template-name'); } $responseCollection = $this->getController()->getEventManager()->trigge...
php
{ "resource": "" }
q246250
TranslatorAwareMessage.setSubject
validation
public function setSubject($subject, $translate = true) { if (false !== $translate) { $translator = $this->getTranslator(); $domain = $this->getTranslatorTextDomain(); if (true === $translate) { $subject = $translator->translate($subject, $domain); ...
php
{ "resource": "" }
q246251
PermissionsAwareTrait.getPermissions
validation
public function getPermissions() { if (!$this->permissions) { $type = property_exists($this, 'permissionsType') ? $this->permissionsType : str_replace('\\Entity\\', '/', static::class); $permissions = new Permissions($type); if (method_exi...
php
{ "resource": "" }
q246252
LogStrategy.getLogger
validation
public function getLogger() : LoggerInterface { if (!$this->logger) { $logger = new class implements LoggerInterface { public function emerg($message, $extra = []) : void {} public function alert($message, $extra = []) : void {} public ...
php
{ "resource": "" }
q246253
LogStrategy.injectLogger
validation
public function injectLogger(bool $flag = null) : bool { if (null === $flag) { return $this->injectLogger; } $this->injectLogger = $flag; return $flag; }
php
{ "resource": "" }
q246254
LogStrategy.attach
validation
public function attach(EventManagerInterface $events, $priority = 1) : void { $this->listeners[] = $events->attach(AbstractWorkerEvent::EVENT_BOOTSTRAP, [$this, 'logBootstrap'], 1000); $this->listeners[] = $events->attach(AbstractWorkerEvent::EVENT_FINISH, [$this, 'logFinish'], 1000); $this-...
php
{ "resource": "" }
q246255
LogStrategy.logBootstrap
validation
public function logBootstrap(BootstrapEvent $event) : void { $this->getLogger()->info(sprintf( $this->tmpl['queue'], 'Start', $event->getQueue()->getName() )); $this->injectLoggerInObject($event->getWorker()); $this->injectLoggerInEvent($event); ...
php
{ "resource": "" }
q246256
LogStrategy.logFinish
validation
public function logFinish(FinishEvent $event) : void { $this->getLogger()->info(sprintf( $this->tmpl['queue'], 'Stop', $event->getQueue()->getName() )); $this->injectLoggerInEvent($event); }
php
{ "resource": "" }
q246257
LogStrategy.logJobStart
validation
public function logJobStart(ProcessJobEvent $event) : void { $queue = $event->getQueue(); $job = $event->getJob(); $logger = $this->getLogger(); $logger->info(sprintf( $this->tmpl['job'], $queue->getName(), 'START', $this->formatJo...
php
{ "resource": "" }
q246258
LogStrategy.logJobEnd
validation
public function logJobEnd(ProcessJobEvent $event) : void { $result = $event->getResult(); $job = $event->getJob(); $queue = $event->getQueue()->getName(); $logger = $this->getLogger(); switch ($result) { default: $logger->info(sprintf( ...
php
{ "resource": "" }
q246259
FieldsetCustomizationOptions.isEnabled
validation
public function isEnabled($field) { return !isset($this->fields[$field]['enabled']) || (bool) $this->fields[$field]['enabled']; }
php
{ "resource": "" }
q246260
FieldsetCustomizationOptions.getFieldOptions
validation
public function getFieldOptions($field) { if (!$this->hasField($field)) { return []; } if (!isset($this->fields[$field]['__options__'])) { $this->fields[$field]['__options__'] = $this->copyArrayValues( $this->fields[$field], [ ...
php
{ "resource": "" }
q246261
FieldsetCustomizationOptions.getFieldFlags
validation
public function getFieldFlags($field) { if (!$this->hasField($field)) { return []; } if (!isset($this->fields[$field]['__flags__'])) { $this->fields[$field]['__flags__'] = $this->copyArrayValues( $this->fields[$field], [ ...
php
{ "resource": "" }
q246262
FieldsetCustomizationOptions.getFieldInputSpecification
validation
public function getFieldInputSpecification($field) { if (!$this->hasField($field)) { return []; } if (!isset($this->fields[$field]['__filter__'])) { $this->fields[$field]['__filter__'] = $this->copyArrayValues( $this->fields[$field], [...
php
{ "resource": "" }
q246263
FieldsetCustomizationOptions.copyArrayValues
validation
protected function copyArrayValues(array $source, array $keys) { $target = []; foreach ($keys as $key => $spec) { if (is_int($key)) { $key = $spec; $spec = null; } if (!array_key_exists($key, $source)) { continue; ...
php
{ "resource": "" }
q246264
TreeSelectStrategy.allowSelectMultipleItems
validation
public function allowSelectMultipleItems() { $flagOrCallback = $this->allowSelectMultipleItems; return is_callable($flagOrCallback) ? (bool) $flagOrCallback() : (bool) $flagOrCallback; }
php
{ "resource": "" }
q246265
TreeSelectStrategy.findLeaf
validation
private function findLeaf(NodeInterface $leaf, $value) { $parts = is_array($value) ? $value : explode($this->shouldUseNames() ? ' | ': '-', $value); $value = array_shift($parts); /* @var NodeInterface $item */ foreach ($leaf->getChildren() as $item) { $compare = $this->s...
php
{ "resource": "" }
q246266
FormFileUpload.renderMarkup
validation
protected function renderMarkup(FileUpload $element) { $markup = ' <div class="%s" id="%s-dropzone"> %s __input__ </div>'; return sprintf( $markup, $this->getDropZoneClass($element), $element->getAttribute('id'), $this->renderFileList($...
php
{ "resource": "" }
q246267
AbstractCustomizableFieldsetFactory.getCustomizationOptions
validation
protected function getCustomizationOptions(ContainerInterface $container, $requestedName, array $options = null) { if (!static::OPTIONS_NAME) { throw new \RuntimeException('The class constants "OPTIONS_NAME" must be non empty.'); } return $container->get(static::OPTIONS_NAME); ...
php
{ "resource": "" }
q246268
PageManager.getTemplate
validation
public function getTemplate($page) { // determine page bundle name. $bundle = $this->getBundleName(ClassUtils::getRealClass(get_class($page))); return sprintf('%s:Page:%s.html.twig', $bundle, $page->getTemplateName()); }
php
{ "resource": "" }
q246269
PageManager.decorateClassMetaData
validation
public function decorateClassMetaData(ClassMetadata $c) { $parentClassName = $c->getName(); if (isset($this->mappings[$parentClassName])) { $c->discriminatorMap = array(); $c->discriminatorMap[strtolower(Str::classname($parentClassName))] = $parentClassName; fore...
php
{ "resource": "" }
q246270
PageManager.findForView
validation
public function findForView($id) { $type = $this->doctrine->getConnection()->fetchColumn('SELECT type FROM page WHERE id=:id', array('id' => $id)); if (!$type) { throw new NotFoundHttpException; } $types = $this->em->getClassMetadata($this->pageClassName)->discriminatorMa...
php
{ "resource": "" }
q246271
PageManager.findPageBy
validation
public function findPageBy($repository, $conditions) { $ret = $this->em->getRepository($repository)->findOneBy($conditions); if (!$ret) { throw new NotFoundHttpException; } return $ret; }
php
{ "resource": "" }
q246272
PageManager.setLoadedPage
validation
public function setLoadedPage($loadedPage) { $this->dispatch(Event\PageEvents::PAGE_VIEW, new Event\PageViewEvent($loadedPage)); $this->loadedPage = $loadedPage; }
php
{ "resource": "" }
q246273
PageManager.getLoadedPage
validation
public function getLoadedPage($default = null) { if (!$this->loadedPage) { if (is_callable($default)) { $page = call_user_func($default, $this); if ($page !== null) { $this->setLoadedPage($page); } } if ...
php
{ "resource": "" }
q246274
FileCopyStrategy.extract
validation
public function extract($value) { if (!$value instanceof FileInterface) { return null; } // Store binary data in temporary file. $tmp = tempnam(sys_get_temp_dir(), 'yk-copy.'); $out = fopen($tmp, 'w'); $in = $value->getResource(); ...
php
{ "resource": "" }
q246275
FileCopyStrategy.hydrate
validation
public function hydrate($value) { if (!is_array($value)) { return null; } $entity = $this->getTargetEntity(); foreach ($value as $key=>$v) { $entity->{"set$key"}($v); } return $entity; }
php
{ "resource": "" }
q246276
MailService.setFrom
validation
public function setFrom($email, $name = null) { if (is_array($email)) { $this->from = [$email['email'] => $email['name']]; } else { $this->from = is_object($email) || null === $name ? $email : array($email => $name); } return $...
php
{ "resource": "" }
q246277
AdminController.indexAction
validation
public function indexAction() { /* @var \Core\EventManager\EventManager $events * @var AdminControllerEvent $event */ $events = $this->adminControllerEvents; $event = $events->getEvent(AdminControllerEvent::EVENT_DASHBOARD, $this); $events->trigger($event, $this); ...
php
{ "resource": "" }
q246278
ImageSet.setImages
validation
public function setImages(array $images, PermissionsInterface $permissions = null) { $this->clear(); foreach ($images as $prop => $image) { $this->set($prop, $image, /* check */ false); } if ($permissions) { $this->setPermissions($permissions); } ...
php
{ "resource": "" }
q246279
ImageSet.get
validation
public function get($key, $fallback = true) { foreach ($this->getImages() as $image) { /* @var ImageInterface $image */ if ($key == $image->getKey()) { return $image; } } return !$fallback || self::ORIGINAL == $key ? null : $this->get(self...
php
{ "resource": "" }
q246280
ImageSet.set
validation
public function set($key, ImageInterface $image, $check = true) { $images = $this->getImages(); if ($check && ($img = $this->get($key))) { $images->removeElement($img); } $image->setBelongsTo($this->id); $image->setKey($key); $images->add($image); ...
php
{ "resource": "" }
q246281
ImageSet.setPermissions
validation
public function setPermissions(PermissionsInterface $permissions) { foreach ($this->getImages() as $file) { /* @var PermissionsInterface $filePermissions */ /* @var \Core\Entity\FileInterface $file */ $filePermissions = $file->getPermissions(); $filePermission...
php
{ "resource": "" }
q246282
Module.onBootstrap
validation
public function onBootstrap(MvcEvent $e) { // Register the TimezoneAwareDate type with DoctrineMongoODM // Use it in Annotations ( @Field(type="tz_date") ) if (!DoctrineType::hasType('tz_date')) { DoctrineType::addType( 'tz_date', '\Core\Repository...
php
{ "resource": "" }
q246283
Notification.setListener
validation
public function setListener($listener) { $listener->getSharedManager()->attach('*', NotificationEvent::EVENT_NOTIFICATION_HTML, array($this,'createOutput'), 1); $this->notificationListener = $listener; }
php
{ "resource": "" }
q246284
Notification.addMessage
validation
public function addMessage($message, $namespace = self::NAMESPACE_INFO) { if (!$message instanceof NotificationEntityInterface) { $messageText = $this->isTranslatorEnabled() ? $this->getTranslator()->translate($message, $this->getTranslatorTextDomain()) : $message...
php
{ "resource": "" }
q246285
LanguageRouteListener.onRoute
validation
public function onRoute(MvcEvent $e) { $routeMatch = $e->getRouteMatch(); if (0 !== strpos($routeMatch->getMatchedRouteName(), 'lang')) { // We do not have a language enabled route here. // but we need to provide a language to the navigation container $lang = $thi...
php
{ "resource": "" }
q246286
PaginationBuilder.paginator
validation
public function paginator($paginatorName, $defaultParams = [], $as = 'paginator') { if (is_string($defaultParams)) { $as = $defaultParams; $defaultParams = []; } $this->stack['paginator'] = ['as' => $as, $paginatorName, $defaultParams]; return $this; }
php
{ "resource": "" }
q246287
PaginationBuilder.form
validation
public function form($form, $options = null, $as = 'searchform') { if (is_string($options)) { $as = $options; $options = null; } $this->stack['form'] = ['as' => $as, $form, $options]; return $this; }
php
{ "resource": "" }
q246288
PaginationBuilder.getResult
validation
public function getResult($paginatorAlias = null, $formAlias = null) { if (null === $paginatorAlias) { $paginatorAlias = isset($this->stack['paginator']['as']) ? $this->stack['paginator']['as'] : 'paginator'; } if (null ===...
php
{ "resource": "" }
q246289
PaginationBuilder.callPlugin
validation
protected function callPlugin($name, $args) { /* @var \Zend\Mvc\Controller\AbstractController $controller */ $controller = $this->getController(); $plugin = $controller->plugin($name); /* We remove the array entry with the key "as" here. * because we want to keep it in the ...
php
{ "resource": "" }
q246290
AbstractEntity.__isset
validation
public function __isset($property) { trigger_error( sprintf( 'Using isset() with entity properties is deprecated. Use %s::notEmpty("%s") instead.', get_class($this), $property ), E_USER_DEPRECATED ); return $...
php
{ "resource": "" }
q246291
EventManager.trigger
validation
public function trigger($eventName, $target = null, $argv = []) { $event = $eventName instanceof EventInterface ? $eventName : $this->getEvent($eventName, $target, $argv); return $this->triggerListeners($event); }
php
{ "resource": "" }
q246292
EventManager.triggerUntil
validation
public function triggerUntil(callable $callback, $eventName, $target = null, $argv = []) { $event = $eventName instanceof EventInterface ? $eventName : $this->getEvent($eventName, $target, $argv); return $this->triggerListeners($event, $callback); }
php
{ "resource": "" }
q246293
AjaxEvent.getContentType
validation
public function getContentType() { if (!$this->contentType) { $this->setContentType($this->getParam('contentType') ?: static::TYPE_JSON); } return $this->contentType; }
php
{ "resource": "" }
q246294
AjaxEvent.setResponse
validation
public function setResponse(Response $response) { $this->setParam('response', $response); $this->response = $response; return $this; }
php
{ "resource": "" }
q246295
LocalizationSettingsFieldset.init
validation
public function init() { $this->setLabel('general settings'); $this->add( array( 'type' => 'Core\Form\Element\Select', 'name' => 'language', 'options' => array( 'label' => /* @translate */ 'choose your langu...
php
{ "resource": "" }
q246296
RepositoryAbstractFactory.getEntityClassName
validation
protected function getEntityClassName($name) { $repositoryName = str_replace('Repository/', '', $name); $nameParts = explode('/', $repositoryName); $namespace = $nameParts[0]; $entity = isset($nameParts[1]) ? $nameParts[1] : substr($namespace, 0, -1); $class = "\...
php
{ "resource": "" }
q246297
ListenerAggregateTrait.attachEvents
validation
public function attachEvents(EventManagerInterface $events, array $eventsSpec = null) { if (null === $eventsSpec) { $eventsSpec = $this->eventsProvider(); } foreach ($eventsSpec as $spec) { if (!is_array($spec) || 2 > count($spec)) { throw new \Unex...
php
{ "resource": "" }
q246298
LazyControllerFactory.getClassName
validation
private function getClassName($requestedName) { $exp = explode('/', $requestedName); $className = array_shift($exp).'\\Controller\\'.implode('\\', $exp).'Controller'; if (!class_exists($className)) { throw new ServiceNotCreatedException( sprintf( ...
php
{ "resource": "" }
q246299
Poser.generate
validation
public function generate($subject, $status, $color, $format) { $badge = new Badge($subject, $status, $color, $format); return $this->getRenderFor($badge->getFormat())->render($badge); }
php
{ "resource": "" }