_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q246100 | PaginationParams.getNeighbours | validation | public function getNeighbours($namespace, $callback, $id)
{
$list = $this->getList($namespace, $callback);
$list->setCurrent($id);
return [
$list->getPrevious(),
$list->getNext()
];
} | php | {
"resource": ""
} |
q246101 | MongoQueue.push | validation | public function push(JobInterface $job, array $options = [])
{
$envelope = $this->createEnvelope($job, $options);
$result = $this->mongoCollection->insertOne($envelope);
$job->setId((string) $result->getInsertedId());
} | php | {
"resource": ""
} |
q246102 | MongoQueue.pushLazy | validation | public function pushLazy($service, $payload = null, array $options = [])
{
$manager = $this->getJobPluginManager();
$serviceOptions = [];
if (is_array($service)) {
$serviceOptions = $service['options'] ?? $service[1] ?? [];
$service = $service['name'] ?? $service[0] ... | php | {
"resource": ""
} |
q246103 | MongoQueue.createEnvelope | validation | private function createEnvelope(JobInterface $job, array $options = [])
{
$scheduled = $this->parseOptionsToDateTime($options);
$tried = isset($options['tried']) ? (int) $options['tried'] : null;
$message = isset($options['message']) ? $options['message'] : null;
$trace = i... | php | {
"resource": ""
} |
q246104 | MongoQueue.retry | validation | public function retry(JobInterface $job, array $options = [])
{
$tried = $job->getMetadata('mongoqueue.tries', 0) + 1;
$job->setMetaData('mongoqueue.tries', $tried);
$options['tried'] = $tried;
$envelope = $this->createEnvelope($job, $options);
unset($envelope['created']);
... | php | {
"resource": ""
} |
q246105 | MongoQueue.pop | validation | public function pop(array $options = [])
{
$time = microtime(true);
$micro = sprintf("%06d", ($time - floor($time)) * 1000000);
$this->now = new \DateTime(
date('Y-m-d H:i:s.' . $micro, $time),
new \DateTimeZone(date_default_timezone_get())
);
... | php | {
"resource": ""
} |
q246106 | MongoQueue.listing | validation | public function listing(array $options = [])
{
$filter = [ 'queue' => $this->getName() ];
if (isset($options['status'])) {
$filter['status'] = $options['status'];
}
$opt = [ 'sort' => [ 'scheduled' => 1, 'priority' => 1] ];
if (isset($options['limit'])) {
... | php | {
"resource": ""
} |
q246107 | MongoQueue.delete | validation | public function delete(JobInterface $job, array $options = [])
{
$result = $this->mongoCollection->deleteOne(['_id' => $job->getId()]);
return (bool) $result->getDeletedCount();
} | php | {
"resource": ""
} |
q246108 | MongoQueue.fail | validation | public function fail(JobInterface $job, array $options = [])
{
$envelope = $this->createEnvelope($job, $options);
unset($envelope['created']);
unset($envelope['scheduled']);
$envelope['status'] = self::STATUS_FAILED;
$this->mongoCollection->findOneAndUpdate(
[
... | php | {
"resource": ""
} |
q246109 | MongoQueue.parseOptionsToDateTime | validation | protected function parseOptionsToDateTime($options)
{
$time = microtime(true);
$micro = sprintf("%06d", ($time - floor($time)) * 1000000);
$this->now = new \DateTime(date('Y-m-d H:i:s.' . $micro, $time), new \DateTimeZone(date_default_timezone_get()));
$scheduled = isset($op... | php | {
"resource": ""
} |
q246110 | DateFormatHelperFactory.createService | validation | public function createService(ServiceLocatorInterface $serviceLocator)
{
$helper = new DateFormat();
$helper->setLocale(Locale::DEFAULT_LOCALE);
return $helper;
} | php | {
"resource": ""
} |
q246111 | PurgeController.entityToString | validation | private function entityToString(EntityInterface $entity)
{
if (method_exists($entity, '__toString')) {
return $entity->__toString();
}
$str = get_class($entity);
if ($entity instanceof \Core\Entity\IdentifiableEntityInterface) {
$str .= '( ' . $entity->getId... | php | {
"resource": ""
} |
q246112 | EntityEraserEvents.setEventPrototype | validation | public function setEventPrototype(EventInterface $prototype)
{
if (!$prototype instanceof DependencyResultEvent) {
throw new \InvalidArgumentException('This event manager only accepts events of the type ' . DependencyResultEvent::class);
}
parent::setEventPrototype($prototype);
... | php | {
"resource": ""
} |
q246113 | EntityEraserEvents.triggerListeners | validation | protected function triggerListeners(EventInterface $event, callable $callback = null)
{
if (!$event instanceof DependencyResultEvent) {
throw new \InvalidArgumentException('This event manager only accepts events of the type ' . DependencyResultEvent::class);
}
$results = parent:... | php | {
"resource": ""
} |
q246114 | SummaryFormButtonsFieldset.init | validation | public function init()
{
$this->setName('buttons');
if (!isset($this->options['render_summary'])) {
$this->options['render_summary'] = false;
}
$this->setAttribute('class', 'text-right');
$this->add(
array(
//'type' => 'Button',
... | php | {
"resource": ""
} |
q246115 | SummaryFormButtonsFieldset.setFormId | validation | public function setFormId($formId)
{
$this->formId = $formId . '-';
foreach ($this as $button) {
$button->setAttribute('id', $this->formId . $button->getAttribute('id'));
}
return $this;
} | php | {
"resource": ""
} |
q246116 | MetaDataProviderTrait.getMetaData | validation | public function getMetaData($key = null, $default = null)
{
if (null === $key) {
return $this->metaData;
}
return $this->hasMetaData($key) ? $this->metaData[$key] : $default;
} | php | {
"resource": ""
} |
q246117 | AbstractAdminAwareVoter.vote | validation | public function vote(TokenInterface $token, $object, array $attributes)
{
// ignore checks for switch user
if (in_array('ROLE_PREVIOUS_ADMIN', $attributes)) {
return VoterInterface::ACCESS_ABSTAIN;
}
/**
* Admin users should see content no matter the scheduled d... | php | {
"resource": ""
} |
q246118 | ClearCacheService.factory | validation | public static function factory(ContainerInterface $container)
{
/* @var \Zend\ModuleManager\ModuleManager $manager */
$config = $container->get('ApplicationConfig');
$options = new ListenerOptions($config['module_listener_options']);
return new static($options);
} | php | {
"resource": ""
} |
q246119 | FileEntity.setUser | validation | public function setUser(UserInterface $user)
{
if ($this->user) {
$this->getPermissions()->revoke($this->user, Permissions::PERMISSION_ALL, false);
}
$this->user = $user;
$this->getPermissions()->grant($user, Permissions::PERMISSION_ALL);
return $this;
... | php | {
"resource": ""
} |
q246120 | FileEntity.getPrettySize | validation | public function getPrettySize()
{
$size = $this->getLength();
if ($size >= 1073741824) {
return round($size / 1073741824, 2) . ' GB';
}
if ($size >= 1048576) {
return round($size / 1048576, 2) . ' MB';
}
if ($size >= ... | php | {
"resource": ""
} |
q246121 | FileEntity.getResource | validation | public function getResource()
{
if ($this->file instanceof \Doctrine\MongoDB\GridFSFile) {
return $this->file->getMongoGridFSFile()->getResource();
}
return null;
} | php | {
"resource": ""
} |
q246122 | FileEntity.getContent | validation | public function getContent()
{
if ($this->file instanceof \Doctrine\MongoDB\GridFSFile) {
return $this->file->getMongoGridFSFile()->getBytes();
}
return null;
} | php | {
"resource": ""
} |
q246123 | FileEntity.getPermissions | validation | public function getPermissions()
{
if (!$this->permissions) {
$perms = new Permissions();
if ($this->user instanceof UserInterface) {
$perms->grant($this->user, PermissionsInterface::PERMISSION_ALL);
}
$this->setPermissions($perms);
}
... | php | {
"resource": ""
} |
q246124 | LanguageAwareAliasingStrategy.generatePublicAlias | validation | public function generatePublicAlias($subject, $currentAlias = '')
{
$alias = $this->strategyWrapper->generatePublicAlias($subject, $currentAlias);
if ($alias !== null && method_exists($subject, 'getLanguage')) {
if (in_array($subject->getLanguage(), $this->localesToPrefix)) {
... | php | {
"resource": ""
} |
q246125 | DependencyResultEvent.addDependencies | validation | public function addDependencies($name, $entities = null, array $options = null)
{
return $this->dependencyResultCollection->add($name, $entities, $options);
} | php | {
"resource": ""
} |
q246126 | EntityHydrator.setExcludeMethods | validation | public function setExcludeMethods($methods)
{
if (is_string($methods)) {
$methods = array($methods);
}
foreach ($methods as $method) {
$this->addFilter($method, new MethodMatchFilter($method), FilterComposite::CONDITION_AND);
}
} | php | {
"resource": ""
} |
q246127 | Proxy.plugin | validation | public function plugin($plugin, $options = null)
{
$renderer = $this->getView();
if (!method_exists($renderer, 'getHelperPluginManager')) {
return true === $options ? false : new HelperProxy(false);
}
/* @var \Zend\View\HelperPluginManager $manager */
$manager ... | php | {
"resource": ""
} |
q246128 | AttachableEntityManager.createAttachedEntity | validation | public function createAttachedEntity($entityClass, $values = [], $key = null)
{
if (is_string($values)) {
$key = $values;
$values = [];
}
$entity = $this->repositories->getRepository($entityClass)->create($values);
$this->addAttachedEntity($entity, $key);
... | php | {
"resource": ""
} |
q246129 | PageController.gotoAction | validation | public function gotoAction(Request $r)
{
return $this->redirect(
$this->get('zicht_url.provider')->url($this->getPageManager()->findForView($r->get('id')))
);
} | php | {
"resource": ""
} |
q246130 | PageController.viewAction | validation | public function viewAction(Request $request, $id)
{
/** @var $pageManager \Zicht\Bundle\PageBundle\Manager\PageManager */
$pageManager = $this->getPageManager();
$page = $pageManager->findForView($id);
if (null !== ($validator = $this->getViewActionValidator())) {
$valid... | php | {
"resource": ""
} |
q246131 | PageController.renderPage | validation | public function renderPage(PageInterface $page, $vars = array())
{
return $this->render(
$this->getPageManager()->getTemplate($page),
$vars + array(
'page' => $page,
'id' => $page->getId(),
)
);
} | php | {
"resource": ""
} |
q246132 | EntitySnapshot.getTarget | validation | protected function getTarget($generateInstance = true)
{
$serviceLocator = $this->getServicelocator();
// set the actual options
$this->getGenerator();
$target = null;
if (array_key_exists('target', $this->options)) {
$target = $this->options['target'];
... | php | {
"resource": ""
} |
q246133 | EntitySnapshot.getGenerator | validation | protected function getGenerator()
{
if (isset($this->generator)) {
return $this->generator;
}
if ($this->entity instanceof SnapshotGeneratorProviderInterface) {
$serviceLocator = $this->getServicelocator();
// the snapshotgenerator is a service defined b... | php | {
"resource": ""
} |
q246134 | EntitySnapshot.array_compare | validation | protected function array_compare($array1, $array2, $maxDepth = 2)
{
$result = array();
$arraykeys = array_unique(array_merge(array_keys($array1), array_keys($array2)));
foreach ($arraykeys as $key) {
if (!empty($key) && is_string($key) && $key[0] != "\0" && substr($key, 0, 8) != ... | php | {
"resource": ""
} |
q246135 | Alert.end | validation | public function end()
{
if (!$this->captureLock) {
throw new \RuntimeException('Cannot end capture, there is no capture running.');
}
$type = $this->captureType;
$content = ob_get_clean();
$options = $this->captureOptions... | php | {
"resource": ""
} |
q246136 | Alert.render | validation | public function render($type = null, $content = true, array $options = array())
{
if (is_array($type)) {
$options = $type;
$type = self::TYPE_INFO;
$content = true;
} elseif (is_array($content)) {
$options = $content;
$content = true;
... | php | {
"resource": ""
} |
q246137 | Alert.start | validation | public function start($type = self::TYPE_INFO, array $options = array())
{
if ($this->captureLock) {
throw new \RuntimeException('Cannot start capture, there is already a capture running.');
}
$this->captureLock = true;
$this->captureType = $type;
$this->cap... | php | {
"resource": ""
} |
q246138 | Application.getConfigDir | validation | public static function getConfigDir()
{
if (is_null(static::$configDir)) {
$configDir = '';
$dirs = [
// path/to/module/test/sandbox/config directories
__DIR__.'/../../../../*/sandbox/config',
// path/to/yawik-standard/config
... | php | {
"resource": ""
} |
q246139 | Application.checkCache | validation | private static function checkCache(array $configuration)
{
$config = $configuration['module_listener_options'];
$options = new ListenerOptions($config);
$cache = new ClearCacheService($options);
$cache->checkCache();
} | php | {
"resource": ""
} |
q246140 | Application.setupCliServerEnv | validation | public static function setupCliServerEnv()
{
$parseUrl = parse_url(substr($_SERVER["REQUEST_URI"], 1));
$route = isset($parseUrl['path']) ? $parseUrl['path']:null;
if (is_file(__DIR__ . '/' . $route)) {
if (substr($route, -4) == ".php") {
require __DIR__ . '/' . $... | php | {
"resource": ""
} |
q246141 | Application.loadDotEnv | validation | public static function loadDotEnv()
{
$dotenv = new Dotenv();
if (is_file(getcwd().'/.env.dist')) {
$dotenv->load(getcwd().'/.env.dist');
}
if (is_file($file = getcwd().'/.env')) {
$dotenv->load($file);
}
if (false === getenv('TIMEZONE')) {
... | php | {
"resource": ""
} |
q246142 | Application.loadConfig | validation | public static function loadConfig($configuration = [])
{
$configDir = static::getConfigDir();
if (empty($configuration)) {
$configFile = $configDir.'/config.php';
// @codeCoverageIgnoreStart
if (!is_file($configFile)) {
throw new InvalidArgumentExc... | php | {
"resource": ""
} |
q246143 | Application.getDockerEnv | validation | private static function getDockerEnv($configuration)
{
// add doctrine hydrator
$cacheDir = $configuration['module_listener_options']['cache_dir'].'/docker';
$configDir = static::getConfigDir();
$hydratorDir = $cacheDir.'/Doctrine/Hydrator';
$proxyDir = $cacheDir.'/Doctrine/P... | php | {
"resource": ""
} |
q246144 | SelectFactory.createService | validation | public function createService(ServiceLocatorInterface $serviceLocator)
{
/* @var \Zend\ServiceManager\AbstractPluginManager $serviceLocator */
$select = $this($serviceLocator, self::class, $this->options);
$this->options = [];
return $select;
} | php | {
"resource": ""
} |
q246145 | SelectFactory.createValueOptions | validation | protected function createValueOptions(NodeInterface $node, $allowSelectNodes = false, $isRoot=true)
{
$key = $isRoot ? $node->getValue() : $node->getValueWithParents();
$name = $node->getName();
if ($node->hasChildren()) {
$leafOptions = [];
if ($allowSelectNod... | php | {
"resource": ""
} |
q246146 | Config.getByKey | validation | public function getByKey($key = null)
{
if (!array_key_exists($key, $this->applicationMap)) {
$this->applicationMap[$key] = array();
$config = $this->serviceManager->get('Config');
$appConfig = $this->serviceManager->get('ApplicationConfig');
foreach ($appConf... | php | {
"resource": ""
} |
q246147 | ContentController.indexAction | validation | public function indexAction()
{
$view = $this->params('view');
$view = 'content/' . $view;
$viewModel = new ViewModel();
$viewModel->setTemplate($view);
/* @var $request Request */
$request = $this->getRequest();
if ($request->isXmlHttpRequest()) {
... | php | {
"resource": ""
} |
q246148 | AjaxRouteListener.onRoute | validation | public function onRoute(MvcEvent $event)
{
/* @var \Zend\Http\PhpEnvironment\Request $request */
$request = $event->getRequest();
$ajax = $request->getQuery()->get('ajax');
if (!$request->isXmlHttpRequest() || !$ajax) {
/* no ajax request or required parameter not presen... | php | {
"resource": ""
} |
q246149 | SummaryForm.render | validation | public function render(SummaryFormInterface $form, $layout = Form::LAYOUT_HORIZONTAL, $parameter = array())
{
$renderer = $this->getView();
$renderer->headscript()->appendFile($renderer->basepath('modules/Core/js/jquery.summary-form.js'));
$label = $form->getLabel();
$labelC... | php | {
"resource": ""
} |
q246150 | SummaryForm.renderForm | validation | public function renderForm(SummaryFormInterface $form, $layout = Form::LAYOUT_HORIZONTAL, $parameter = array())
{
/* @var $form SummaryFormInterface|\Core\Form\SummaryForm */
$renderer = $this->getView(); /* @var $renderer \Zend\View\Renderer\PhpRenderer */
$formHelper = $ren... | php | {
"resource": ""
} |
q246151 | SummaryForm.renderSummary | validation | public function renderSummary(SummaryFormInterface $form)
{
$form->prepare();
$baseFieldset = $form->getBaseFieldset();
if (!isset($baseFieldset)) {
throw new \InvalidArgumentException('For the Form ' . get_class($form) . ' there is no Basefieldset');
}
$dataAttr... | php | {
"resource": ""
} |
q246152 | DefaultNavigationFactory.injectComponents | validation | protected function injectComponents(
array $pages,
$routeMatch = null,
$router = null,
$request = null
) {
if ($routeMatch) {
/* @var RouteMatch|MvcRouter\RouteMatch $routeMatch */
$routeName = $routeMatch->getMatchedRouteName();
foreach (... | php | {
"resource": ""
} |
q246153 | HTMLTemplateMessage.setVariables | validation | public function setVariables($variables, $overwrite = false)
{
if (!is_array($variables) && !$variables instanceof \Traversable) {
throw new \InvalidArgumentException(
sprintf(
'%s: expects an array, or Traversable argument; received "%s"',
... | php | {
"resource": ""
} |
q246154 | DependencyResultCollection.add | validation | public function add($name, $entities = null, array $options = null)
{
if ($name instanceof DependencyResult) {
return $this->addResult($name);
}
if ($name instanceof \Traversable) {
return $this->addTraversable($name);
}
if (is_array($name)) {
... | php | {
"resource": ""
} |
q246155 | DependencyResultCollection.addTraversable | validation | private function addTraversable(\Traversable $result)
{
/*
* Since we only know, that $result is an instance of \Traversable
* (and thus, usable in a foreach), we cannot relay on methods like first()
* which are defined in the \Iterable interface.
* We must use a foreach ... | php | {
"resource": ""
} |
q246156 | DependencyResultCollection.addArray | validation | private function addArray(array $result)
{
if (1 < count($result) && !isset($result['name']) && !is_string($result[0])) {
foreach ($result as $r) {
if (is_array($r)) {
$this->add($r);
} else {
return $this->addTraversable(ne... | php | {
"resource": ""
} |
q246157 | Node.setValue | validation | public function setValue($value)
{
if (!$value) {
if (!$this->getName()) {
throw new \InvalidArgumentException('Value must not be empty.');
}
$value = self::filterValue($this->getName());
}
$this->value = (string) $value;
return $... | php | {
"resource": ""
} |
q246158 | Form.setParams | validation | public function setParams(array $params)
{
foreach ($params as $key => $value) {
$this->setParam($key, $value);
}
return $this;
} | php | {
"resource": ""
} |
q246159 | Form.setParam | validation | public function setParam($key, $value)
{
if ($this->has($key)) {
$this->get($key)->setValue($value);
} else {
$this->add(
[
'type' => 'hidden',
'name' => $key,
'attributes' => [
... | php | {
"resource": ""
} |
q246160 | Form.attachInputFilterDefaults | validation | public function attachInputFilterDefaults(InputFilterInterface $inputFilter, FieldsetInterface $fieldset)
{
parent::attachInputFilterDefaults($inputFilter, $fieldset);
/* @var $inputFilter \Zend\InputFilter\InputFilter */
foreach ($inputFilter->getInputs() as $name => $input) {
i... | php | {
"resource": ""
} |
q246161 | WizardContainer.setForm | validation | public function setForm($key, $spec, $enabled = true)
{
if (is_object($spec)) {
if (!$spec instanceof Container) {
throw new \InvalidArgumentException('Tab container must be of the type \Core\Form\Container');
}
if (!$spec->getLabel()) {
t... | php | {
"resource": ""
} |
q246162 | ContentItemMatrix.region | validation | public function region($region, $reset = false)
{
$this->currentRegion = $region;
if ($reset) {
$this->matrix[$this->currentRegion] = [];
}
return $this;
} | php | {
"resource": ""
} |
q246163 | ContentItemMatrix.removeRegion | validation | public function removeRegion($region)
{
if (array_key_exists($region, $this->matrix)) {
unset($this->matrix[$region]);
}
return $this;
} | php | {
"resource": ""
} |
q246164 | ContentItemMatrix.removeTypeFromRegion | validation | public function removeTypeFromRegion($type, $region)
{
if (array_key_exists($region, $this->matrix)) {
array_walk(
$this->matrix[ $region ],
function ($value, $idx, $matrix) use ($type, $region) {
$class = explode('\\', $value);
... | php | {
"resource": ""
} |
q246165 | ContentItemMatrix.type | validation | public function type($className)
{
if (!class_exists($className)) {
throw new \InvalidArgumentException(
sprintf(
'Class %s is non-existent or could not be loaded',
$className
)
);
}
$this->matrix... | php | {
"resource": ""
} |
q246166 | ContentItemMatrix.getTypes | validation | public function getTypes($region = null)
{
if (null === $region) {
$ret = [];
foreach ($this->matrix as $types) {
$ret = array_merge($ret, $types);
}
return array_values(array_unique($ret));
}
return $this->matrix[$region];
... | php | {
"resource": ""
} |
q246167 | ContentItemMatrix.getRegions | validation | public function getRegions($type = null)
{
if (null === $type) {
return array_keys($this->matrix);
}
$regions = [];
foreach ($this->matrix as $region => $types) {
if (in_array($type, $types)) {
$regions[] = $region;
}
}
... | php | {
"resource": ""
} |
q246168 | DeferredListenerAggregate.setListeners | validation | public function setListeners(array $specs)
{
foreach ($specs as $spec) {
if (!isset($spec['event']) || !isset($spec['service'])) {
throw new \DomainException('Listener specification must be an array with the keys "event" and "service".');
}
$method = isset... | php | {
"resource": ""
} |
q246169 | DeferredListenerAggregate.setListener | validation | public function setListener($event, $service, $method = null, $priority = 0)
{
if (is_int($method)) {
$priority = $method;
$method = null;
}
$name = uniqid();
$this->listenerSpecs[$name] = [
'event' => $event,
'service' => $service,
... | php | {
"resource": ""
} |
q246170 | DeferredListenerAggregate.attach | validation | public function attach(EventManagerInterface $events, $priority = 1)
{
foreach ($this->listenerSpecs as $name => $spec) {
$this->listeners[] = $events->attach($spec['event'], array($this, "do$name"), $spec['priority']);
}
} | php | {
"resource": ""
} |
q246171 | DeferredListenerAggregate.detach | validation | public function detach(EventManagerInterface $events)
{
foreach ($this->listeners as $i => $listener) {
if ($events->detach($listener)) {
unset($this->listeners[$i]);
}
}
return empty($this->listeners);
} | php | {
"resource": ""
} |
q246172 | AbstractLeafs.updateValues | validation | public function updateValues()
{
$values = [];
/* @var NodeInterface $item */
foreach ($this->getItems() as $item) {
if (!is_null($item)) {
$values[] = $item->getValueWithParents();
}
}
$this->values = $values;
} | php | {
"resource": ""
} |
q246173 | NotificationListener.renderJSON | validation | public function renderJSON(MvcEvent $event)
{
if (!$this->hasRunned) {
$valueToPlainStati = array(1 => 'error', 2 => 'error', 3 => 'error', 4 => 'error', 5 => 'success', 6 => 'info', 7 => 'info');
$viewModel = $event->getViewModel();
if ($viewModel instanceof JsonModel) {... | php | {
"resource": ""
} |
q246174 | EntityEraser.loadEntities | validation | public function loadEntities($entity, $id = null)
{
$params = $this->options;
$params['id'] = $id;
$params['repositories'] = $this->repositories;
$event = $this->loadEntitiesEvents->getEvent($entity, $this, $params);
$responses = $this->loadEntitiesEvents->triggerEventUntil(... | php | {
"resource": ""
} |
q246175 | EntityEraser.erase | validation | public function erase(EntityInterface $entity)
{
$dependencies = $this->triggerEvent(DependencyResultEvent::DELETE, $entity);
foreach ($dependencies as $result) {
if ($result->isDelete()) {
foreach ($result->getEntities() as $dependendEntity) {
$this-... | php | {
"resource": ""
} |
q246176 | EntityEraser.triggerEvent | validation | private function triggerEvent($name, EntityInterface $entity)
{
$params = $this->options;
$params['entity'] = $entity;
$params['repositories'] = $this->repositories;
/* @var DependencyResultEvent $event */
$event = $this->entityEraserEvents->getEvent($name, $this, $params);
... | php | {
"resource": ""
} |
q246177 | AbstractUpdatePermissionsSubscriber.getEntities | validation | protected function getEntities($args)
{
$dm = $args->getDocumentManager();
$resource = $args->getDocument();
$repositoryName = $this->getRepositoryName();
$resourceId = $resource->getPermissionsResourceId();
$repository = $dm->getRepository($reposito... | php | {
"resource": ""
} |
q246178 | OptionsAbstractFactory.createNestedOptions | validation | protected function createNestedOptions($className, $options)
{
$class = new $className();
foreach ($options as $key => $spec) {
if (is_array($spec) && array_key_exists('__class__', $spec)) {
$nestedClassName = $spec['__class__'];
unset($spec['__class__'])... | php | {
"resource": ""
} |
q246179 | OptionsAbstractFactory.getOptionsConfig | validation | protected function getOptionsConfig($fullName)
{
if (array_key_exists($fullName, $this->optionsConfig)) {
return $this->optionsConfig[$fullName];
}
return false;
} | php | {
"resource": ""
} |
q246180 | FileUpload.setAllowedTypes | validation | public function setAllowedTypes($types)
{
if (is_array($types)) {
$types = implode(',', $types);
}
return $this->setAttribute('data-allowedtypes', $types);
} | php | {
"resource": ""
} |
q246181 | FileUpload.setIsMultiple | validation | public function setIsMultiple($flag)
{
$this->isMultiple = (bool) $flag;
if ($flag) {
$this->setAttribute('multiple', true);
} else {
$this->removeAttribute('multiple');
}
return $this;
} | php | {
"resource": ""
} |
q246182 | FileUpload.getAllowedTypes | validation | public function getAllowedTypes($asArray = false)
{
$types = $this->getAttribute('data-allowedtypes');
if ($asArray) {
return explode(',', $types);
}
return $types;
} | php | {
"resource": ""
} |
q246183 | FileUpload.fileCountValidationCallback | validation | public function fileCountValidationCallback()
{
if ($this->form && ($object = $this->form->getObject())) {
if ($this->getMaxFileCount() - 1 < count($object)) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q246184 | BaseForm.addBaseFieldset | validation | protected function addBaseFieldset()
{
if (null === $this->baseFieldset) {
return;
}
$fs = $this->baseFieldset;
if (!is_array($fs)) {
$fs = array(
'type' => $fs,
);
}
if (!isset($fs['options']['use_as_base_f... | php | {
"resource": ""
} |
q246185 | Permissions.grant | validation | public function grant($resource, $permission = null, $build = true)
{
if (is_array($resource)) {
foreach ($resource as $r) {
$this->grant($r, $permission, false);
}
if ($build) {
$this->build();
}
return $this;
... | php | {
"resource": ""
} |
q246186 | Permissions.revoke | validation | public function revoke($resource, $permission = null, $build = true)
{
if (self::PERMISSION_NONE == $permission || !$this->isAssigned($resource)) {
return $this;
}
if (self::PERMISSION_CHANGE == $permission) {
return $this->grant($resource, self::PERMISSION_V... | php | {
"resource": ""
} |
q246187 | Permissions.build | validation | public function build()
{
$view = $change = array();
foreach ($this->assigned as $resourceId => $spec) {
/* This is needed to convert old permissions to the new spec format
* introduced in 0.18
* TODO: Remove this line some versions later.
*/
... | php | {
"resource": ""
} |
q246188 | Permissions.checkPermission | validation | protected function checkPermission($permission)
{
$perms = array(
self::PERMISSION_ALL,
self::PERMISSION_CHANGE,
self::PERMISSION_NONE,
self::PERMISSION_VIEW,
);
if (!in_array($permission, $perms)) {
throw new \InvalidArgumentExcept... | php | {
"resource": ""
} |
q246189 | DraftableEntityAwareTrait.findDraftsBy | validation | public function findDraftsBy(array $criteria, array $sort = null, $limit = null, $skip = null)
{
$criteria['isDraft'] = true;
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedMethodInspection */
return parent::findBy($criteria, $sort, $limit, $skip);
... | php | {
"resource": ""
} |
q246190 | DraftableEntityAwareTrait.createQueryBuilder | validation | public function createQueryBuilder($findDrafts = false)
{
/* @var \Doctrine\MongoDB\Query\Builder $qb */
/** @noinspection PhpUndefinedClassInspection */
/** @noinspection PhpUndefinedMethodInspection */
$qb = parent::createQueryBuilder();
if (null !== $findDrafts) {
... | php | {
"resource": ""
} |
q246191 | DraftableEntityAwareTrait.createDraft | validation | public function createDraft(array $data = null, $persist = false)
{
$data['isDraft'] = true;
return $this->create($data, $persist);
} | php | {
"resource": ""
} |
q246192 | MissingOptionException.getTargetFQCN | validation | public function getTargetFQCN()
{
return is_object($this->target) ? get_class($this->target) : (string) $this->target;
} | php | {
"resource": ""
} |
q246193 | AbstractRatingEntity.checkRatingValue | validation | protected function checkRatingValue($rating, $throwException = true)
{
if (!is_int($rating) || static::RATING_EXCELLENT < $rating || static::RATING_NONE > $rating) {
if ($throwException) {
throw new \InvalidArgumentException(sprintf('%s is not a valid rating value.', $rating));
... | php | {
"resource": ""
} |
q246194 | HelperProxy.call | validation | public function call($method, $args = [], $expect = self::EXPECT_SELF)
{
if (!is_array($args)) {
$expect = $args;
$args = [];
}
if (!$this->helper) {
return $this->expected($expect);
}
return call_user_func_array([$this->helper, $method... | php | {
"resource": ""
} |
q246195 | InjectHeadscriptInitializer.initialize | validation | public function initialize($instance, ServiceLocatorInterface $serviceLocator)
{
/* @var $serviceLocator \Zend\Form\FormElementManager\FormElementManagerV3Polyfill */
if (!$instance instanceof HeadscriptProviderInterface) {
return;
}
$scripts = $instance->getHeadscripts... | php | {
"resource": ""
} |
q246196 | InsertFile.listenToRenderer | validation | public function listenToRenderer()
{
if ($this->ListenersUnaware) {
// set a listener at the end of the Rendering-Process
// to announce what files have been inserted
$this->ListenersUnaware = false;
$view = $this->serviceManager->get('View');
$vie... | php | {
"resource": ""
} |
q246197 | ProxyDecorator.proxy | validation | protected function proxy()
{
$args = func_get_args();
$method = array_shift($args);
$callback = array($this->object, $method);
if (!is_callable($callback)) {
throw new \BadMethodCallException(
sprintf(
'Cannot proxy "%s" to "%s": Unkno... | php | {
"resource": ""
} |
q246198 | AbstractUpdateFilesPermissionsSubscriber.onFlush | validation | public function onFlush(OnFlushEventArgs $args)
{
$dm = $args->getDocumentManager();
$uow = $dm->getUnitOfWork();
$filter = function ($element) {
return $element instanceof $this->targetDocument
&& $element instanceof PermissionsAwareInterface
... | php | {
"resource": ""
} |
q246199 | XmlRenderListener.attach | validation | public function attach(EventManagerInterface $events, $priority = 1)
{
$callback = array($this, 'injectXmlTemplate');
/*
* We need to hack a little, because injectViewModelListener is attached to the
* shared event manager and triggered in Controller, we need to attach to the
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.