_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q400 | BlockManager.findById | train | public function findById($id, $draft = true)
{
if ($draft) {
$this->setDraftVersionFilter(! $draft);
}
$blocks = $this->getRepository()->findById($id);
if ($draft) {
foreach ($blocks as $block) {
if (null !== $revision = $this->revisionManage... | php | {
"resource": ""
} |
q401 | BlockManager.findDescendants | train | public function findDescendants($parent, $draft = true)
{
$this->setDraftVersionFilter(! $draft);
$iterator = new \RecursiveIteratorIterator(
new RecursiveBlockIterator([$parent]),
\RecursiveIteratorIterator::SELF_FIRST
);
$blocks = [];
forea... | php | {
"resource": ""
} |
q402 | BlockManager.publish | train | public function publish($blocks)
{
if ($blocks instanceof PersistentCollection) {
$blocks = $blocks->getValues();
}
if (!$blocks ||
(is_array($blocks) && !count($blocks))) {
return;
}
if (! is_array($blocks)) {
$blocks = [$blo... | php | {
"resource": ""
} |
q403 | BlockManager.duplicate | train | public function duplicate($blocks, $owner = null)
{
if ($blocks instanceof BlockInterface) {
$blocks = array($blocks);
}
$iterator = new \RecursiveIteratorIterator(
new RecursiveBlockIterator($blocks),
\RecursiveIteratorIterator::SELF_FIRST
);
... | php | {
"resource": ""
} |
q404 | BlockManager.setDraftVersionFilter | train | public function setDraftVersionFilter($enabled = true)
{
if ($this->em->getFilters()->isEnabled('draft') && ! $enabled) {
$this->em->getFilters()->disable('draft');
} else if (! $this->em->getFilters()->isEnabled('draft') && $enabled) {
$this->em->getFilters()->enable('draft'... | php | {
"resource": ""
} |
q405 | BlockManager.disableRevisionListener | train | public function disableRevisionListener()
{
foreach ($this->em->getEventManager()->getListeners() as $event => $listeners) {
foreach ($listeners as $hash => $listener) {
if ($listener instanceof RevisionListener) {
$this->revisionListener = $listener;
... | php | {
"resource": ""
} |
q406 | BlockManager.getSiblings | train | public function getSiblings(BlockInterface $block, $version = false)
{
$owner = $block->getOwner();
$family = $this->findByOwner($owner, $version);
$siblings = array();
foreach ($family as $member) {
if ($member->getParent() && $member->getParent()->getId() == $block->g... | php | {
"resource": ""
} |
q407 | ExceptionRouter.match | train | public function match($pathinfo)
{
$urlMatcher = new UrlMatcher($this->routeCollection, $this->getContext());
$result = $urlMatcher->match($pathinfo);
return $result;
} | php | {
"resource": ""
} |
q408 | EmptyValueListener.postLoad | train | public function postLoad(LifeCycleEventArgs $args)
{
$entity = $args->getEntity();
if ($entity instanceof ValueSetInterface && $entity->getValues() !== null) {
$this->eavManager->replaceEmptyValues($entity);
}
} | php | {
"resource": ""
} |
q409 | EmptyValueListener.postPersist | train | public function postPersist(LifeCycleEventArgs $args)
{
$entity = $args->getEntity();
$entityManager = $args->getEntityManager();
if ($entity instanceof ValueInterface && $entity->isEmpty()) {
$entityManager->remove($entity);
}
} | php | {
"resource": ""
} |
q410 | SchemaRepository.findByRequest | train | public function findByRequest(Request $request)
{
$qb = $this->createQueryBuilder('s');
if ($request->get('attribute')) {
$qb->join('s.allowedInAttributes', 'a')
->andWhere('a.id = :attributeId')
->setParameter('attributeId', $request->get('attribute'));
... | php | {
"resource": ""
} |
q411 | Pool.addValue | train | public function addValue(ValueProviderInterface $value, $alias)
{
if (false === $value->isEnabled()) {
return;
}
$this->values[$alias] = $value;
} | php | {
"resource": ""
} |
q412 | Pool.getValueByEntity | train | public function getValueByEntity($entity)
{
if (is_object($entity)) {
$entity = get_class($entity);
}
/** @var ValueProviderInterface $provider */
foreach ($this->getValues() as $provider) {
if ($entity === $provider->getEntity()) {
return $pr... | php | {
"resource": ""
} |
q413 | CodemirrorAsset.registerAssetFiles | train | public function registerAssetFiles($view)
{
if (is_array(self::$_assets)) {
$this->css = array_values(array_intersect_key(self::$_css, self::$_assets));
$this->js = array_values(array_intersect_key(self::$_js, self::$_assets));
}
array_unshift($this->css, self::... | php | {
"resource": ""
} |
q414 | Site.getDefaultDomain | train | public function getDefaultDomain()
{
if ($this->defaultDomain) {
return $this->defaultDomain;
} elseif ($first = $this->getDomains()->first()) {
return $first->getDomain();
} else {
return null;
}
} | php | {
"resource": ""
} |
q415 | HttpBinding.request | train | public function request($name, array $arguments, array $options = null, $inputHeaders = null)
{
$soapRequest = $this->interpreter->request($name, $arguments, $options, $inputHeaders);
if ($soapRequest->getSoapVersion() == '1') {
$this->builder->isSOAP11();
} else {
$t... | php | {
"resource": ""
} |
q416 | HttpBinding.response | train | public function response(ResponseInterface $response, $name, array &$outputHeaders = null)
{
return $this->interpreter->response($response->getBody()->__toString(), $name, $outputHeaders);
} | php | {
"resource": ""
} |
q417 | Factory.create | train | public function create($name, $value)
{
if (!empty($this->callbacks[$name])) {
return call_user_func($this->callbacks[$name], $name, $value);
}
return $this->createBasic($name, $value);
} | php | {
"resource": ""
} |
q418 | ContentEditorController.clipboardBlockAction | train | public function clipboardBlockAction($id)
{
/** @var BlockManager $manager */
$manager = $this->get('opifer.content.block_manager');
/** @var ClipboardBlockService $clipboardService */
$clipboardService = $this->get('opifer.content.clipboard_block');
$response = new JsonRe... | php | {
"resource": ""
} |
q419 | ContentEditorController.publishSharedAction | train | public function publishSharedAction(Request $request)
{
$this->getDoctrine()->getManager()->getFilters()->disable('draft');
/** @var BlockManager $manager */
$manager = $this->get('opifer.content.block_manager');
$response = new JsonResponse;
$id = (int) $request->req... | php | {
"resource": ""
} |
q420 | ContentEditorController.discardBlockAction | train | public function discardBlockAction(Request $request)
{
$this->getDoctrine()->getManager()->getFilters()->disable('draft');
/** @var BlockManager $manager */
$manager = $this->get('opifer.content.block_manager');
$response = new JsonResponse;
$id = (int) $request->request->g... | php | {
"resource": ""
} |
q421 | SubscriptionRepository.findPendingSynchronisation | train | public function findPendingSynchronisation()
{
return $this->createQueryBuilder('s')
->innerjoin('s.mailingList', 'm')
->andWhere('s.status = :pending OR s.status = :failed')
->setParameters([
'pending' => Subscription::STATUS_PENDING,
'fai... | php | {
"resource": ""
} |
q422 | SubscriptionRepository.findPendingSynchronisationList | train | public function findPendingSynchronisationList(MailingList $mailingList)
{
return $this->createQueryBuilder('s')
->innerjoin('s.mailingList', 'm')
->where('s.mailingList = :mailingList')
->andWhere('s.status = :pending OR s.status = :failed')
->setParameters([... | php | {
"resource": ""
} |
q423 | Attribute.getOptionByName | train | public function getOptionByName($name)
{
foreach ($this->options as $option) {
if ($option->getName() == $name) {
return $option;
}
}
return false;
} | php | {
"resource": ""
} |
q424 | Attribute.addAllowedSchema | train | public function addAllowedSchema(SchemaInterface $schema)
{
$exists = false;
foreach ($this->allowedSchemas as $allowedSchema) {
if ($allowedSchema->getId() == $schema->getId()) {
$exists = true;
}
}
if (!$exists) {
$this->allowedS... | php | {
"resource": ""
} |
q425 | OpiferCmsExtension.mapClassParameters | train | protected function mapClassParameters(array $classes, ContainerBuilder $container)
{
foreach ($classes as $model => $serviceClasses) {
foreach ($serviceClasses as $service => $class) {
$container->setParameter(
sprintf(
'opifer_cms.%s_%... | php | {
"resource": ""
} |
q426 | FormExtension.createFormView | train | public function createFormView(FormInterface $form)
{
$post = $this->eavManager->initializeEntity($form->getSchema());
$form = $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]);
return $form->createView();
} | php | {
"resource": ""
} |
q427 | BlockController.viewAction | train | public function viewAction($id)
{
/** @var BlockManager $manager */
$manager = $this->get('opifer.content.block_manager');
/** @var BlockInterface $block */
$block = $manager->getRepository()->find($id);
if (!$block) {
throw $this->createNotFoundException();
... | php | {
"resource": ""
} |
q428 | BlockController.sharedAction | train | public function sharedAction()
{
$blocks = $this->get('opifer.content.block_manager')->getRepository()
->findBy(['shared' => true]);
return $this->render($this->getParameter('opifer_content.block_shared_view'), [
'blocks' => $blocks,
]);
} | php | {
"resource": ""
} |
q429 | BlockEventSubscriber.setChildren | train | protected function setChildren(Block $block)
{
if (method_exists($block, 'setChildren')) {
$children = $this->environment->getBlockChildren($block);
$block->setChildren($children);
}
} | php | {
"resource": ""
} |
q430 | ContentTypeController.indexAction | train | public function indexAction()
{
$contentTypes = $this->get('opifer.content.content_type_manager')->getRepository()
->findAll();
return $this->render($this->getParameter('opifer_content.content_type_index_view'), [
'content_types' => $contentTypes,
]);
} | php | {
"resource": ""
} |
q431 | ContentTypeController.createAction | train | public function createAction(Request $request)
{
$contentTypeManager = $this->get('opifer.content.content_type_manager');
$contentType = $contentTypeManager->create();
$form = $this->createForm(ContentTypeType::class, $contentType);
$form->handleRequest($request);
if ($for... | php | {
"resource": ""
} |
q432 | CKEditorController.contentAction | train | public function contentAction(Request $request)
{
return $this->render('OpiferCmsBundle:CKEditor:content.html.twig', [
'funcNum' => $request->get('CKEditorFuncNum'),
'CKEditor' => $request->get('CKEditor'),
'type' => $request->get('type'),
]);
} | php | {
"resource": ""
} |
q433 | CKEditorController.mediaAction | train | public function mediaAction(Request $request)
{
$providers = $this->get('opifer.media.provider.pool')->getProviders();
return $this->render('OpiferCmsBundle:CKEditor:media.html.twig', [
'providers' => $providers,
'funcNum' => $request->get('CKEditorFuncNum'),
'CK... | php | {
"resource": ""
} |
q434 | CronRunCommand.isLocked | train | protected function isLocked(Cron $cron)
{
$hourAgo = new \DateTime('-65 minutes');
if ($cron->getState() === Cron::STATE_RUNNING && $cron->getStartedAt() > $hourAgo) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q435 | CronRunCommand.startCron | train | private function startCron(Cron $cron)
{
if ($this->isLocked($cron)) {
return;
}
$this->output->writeln(sprintf('Started %s.', $cron));
$this->changeState($cron, Cron::STATE_RUNNING);
$pb = $this->getCommandProcessBuilder();
$parts = explode(' ', $cron->... | php | {
"resource": ""
} |
q436 | CronRunCommand.changeState | train | private function changeState(Cron $cron, $state, $lastError = null)
{
$cron->setState($state);
$cron->setLastError($lastError);
$em = $this->getEntityManager();
$em->persist($cron);
$em->flush($cron);
} | php | {
"resource": ""
} |
q437 | CronRunCommand.getCommandProcessBuilder | train | private function getCommandProcessBuilder()
{
$pb = new ProcessBuilder();
// PHP wraps the process in "sh -c" by default, but we need to control
// the process directly.
if (!defined('PHP_WINDOWS_VERSION_MAJOR')) {
$pb->add('exec');
}
$pb
->a... | php | {
"resource": ""
} |
q438 | OptionRepository.findByIds | train | public function findByIds($ids)
{
if (!is_array($ids)) {
$ids = explode(',', trim($ids));
}
return $this->createQueryBuilder('o')
->where('o.id IN (:ids)')
->setParameters([
'ids' => $ids,
])
->getQuery()
... | php | {
"resource": ""
} |
q439 | SweetSubmitAsset.initOptions | train | protected function initOptions()
{
$view = Yii::$app->view;
$opts = [
'confirmButtonText' => Yii::t('sweetsubmit', 'Ok'),
'cancelButtonText' => Yii::t('sweetsubmit', 'Cancel'),
];
$opts = Json::encode($opts);
$view->registerJs("yii.sweetSubmitOption... | php | {
"resource": ""
} |
q440 | ExceptionController.error404Action | train | public function error404Action(Request $request)
{
$host = $request->getHost();
$slugParts = explode('/', $request->getPathInfo());
$locale = $this->getDoctrine()->getRepository(Locale::class)
->findOneByLocale($slugParts[1]);
/** @var ContentRepository $contentRepositor... | php | {
"resource": ""
} |
q441 | ExpressionEngine.transform | train | protected function transform(Expression $expression)
{
$constraint = $expression->getConstraint();
$getter = 'get'.ucfirst($expression->getSelector());
return Expr::method($getter, new $constraint($expression->getValue()));
} | php | {
"resource": ""
} |
q442 | MediaController.deleteAction | train | public function deleteAction(Request $request, $id)
{
$mediaManager = $this->get('opifer.media.media_manager');
$media = $mediaManager->getRepository()->find($id);
$dispatcher = $this->get('event_dispatcher');
$event = new MediaResponseEvent($media, $request);
$dispatcher->d... | php | {
"resource": ""
} |
q443 | ValueSet.getSortedValues | train | public function getSortedValues($order = 'asc')
{
$values = $this->values->toArray();
usort($values, function ($a, $b) use ($order) {
$left = $a->getAttribute()->getSort();
$right = $b->getAttribute()->getSort();
if ($order == 'desc') {
return ($l... | php | {
"resource": ""
} |
q444 | ValueSet.getNamedValues | train | public function getNamedValues($order = 'asc')
{
$values = $this->getSortedValues($order);
$valueArray = [];
foreach ($values as $value) {
$valueArray[$value->getAttribute()->getName()] = $value;
}
return $valueArray;
} | php | {
"resource": ""
} |
q445 | ValueSet.has | train | public function has($value)
{
if (!is_string($value) && !is_array($value)) {
throw new \InvalidArgumentException('The ValueSet\'s "has" method requires the argument to be of type string or array');
}
if (is_string($value)) {
return $this->__isset($value);
} e... | php | {
"resource": ""
} |
q446 | ValueSet.getValueByAttributeId | train | public function getValueByAttributeId($attributeId)
{
foreach ($this->values as $valueObject) {
if ($valueObject->getAttribute()->getId() == $attributeId) {
return $valueObject;
}
}
return null;
} | php | {
"resource": ""
} |
q447 | ContentEditorController.tocAction | train | public function tocAction($owner, $ownerId)
{
/** @var BlockProviderInterface $provider */
$provider = $this->get('opifer.content.block_provider_pool')->getProvider($owner);
$object = $provider->getBlockOwner($ownerId);
/** @var Environment $environment */
$environment = $th... | php | {
"resource": ""
} |
q448 | CronRepository.findDue | train | public function findDue()
{
/** @var Cron[] $active */
$active = $this->createQueryBuilder('c')
->where('c.state <> :canceled')
->andWhere('c.state <> :running OR (c.state = :running AND c.startedAt < :hourAgo)')
->orderBy('c.priority', 'DESC')
->setPa... | php | {
"resource": ""
} |
q449 | FormController.getFormAction | train | public function getFormAction($id)
{
/** @var Form $form */
$form = $this->get('opifer.form.form_manager')->getRepository()->find($id);
if (!$form) {
throw $this->createNotFoundException('The form could not be found');
}
/** @var Post $post */
$post = $t... | php | {
"resource": ""
} |
q450 | FormController.postFormPostAction | train | public function postFormPostAction(Request $request, $id)
{
/** @var Form $form */
$form = $this->get('opifer.form.form_manager')->getRepository()->find($id);
if (!$form) {
throw $this->createNotFoundException('The form could not be found');
}
$data = json_decod... | php | {
"resource": ""
} |
q451 | Builder.setRegisteredClaim | train | protected function setRegisteredClaim($name, $value, $replicate)
{
$this->set($name, $value);
if ($replicate) {
$this->headers[$name] = $this->claims[$name];
}
return $this;
} | php | {
"resource": ""
} |
q452 | Builder.setHeader | train | public function setHeader($name, $value)
{
if ($this->signature) {
throw new \BadMethodCallException('You must unsign before make changes');
}
$this->headers[(string) $name] = $this->claimFactory->create($name, $value);
return $this;
} | php | {
"resource": ""
} |
q453 | Builder.set | train | public function set($name, $value)
{
if ($this->signature) {
throw new \BadMethodCallException('You must unsign before make changes');
}
$this->claims[(string) $name] = $this->claimFactory->create($name, $value);
return $this;
} | php | {
"resource": ""
} |
q454 | Builder.sign | train | public function sign(Signer $signer, $key)
{
$signer->modifyHeader($this->headers);
$this->signature = $signer->sign(
$this->getToken()->getPayload(),
$key
);
return $this;
} | php | {
"resource": ""
} |
q455 | Builder.getToken | train | public function getToken()
{
$payload = array(
$this->serializer->toBase64URL($this->serializer->toJSON($this->headers)),
$this->serializer->toBase64URL($this->serializer->toJSON($this->claims))
);
if ($this->signature !== null) {
$payload[] = $this->seri... | php | {
"resource": ""
} |
q456 | EavManager.initializeEntity | train | public function initializeEntity(SchemaInterface $schema)
{
$valueSet = $this->createValueSet();
$valueSet->setSchema($schema);
// To avoid persisting Value entities with no actual value to the database
// we create empty ones, that will be removed on postPersist events.
$th... | php | {
"resource": ""
} |
q457 | EavManager.replaceEmptyValues | train | public function replaceEmptyValues(ValueSetInterface $valueSet)
{
// collect persisted attributevalues
$persistedAttributes = array();
foreach ($valueSet->getValues() as $value) {
$persistedAttributes[] = $value->getAttribute();
}
$newValues = array();
/... | php | {
"resource": ""
} |
q458 | Hmac.hashEquals | train | public function hashEquals($expected, $generated)
{
$expectedLength = strlen($expected);
if ($expectedLength !== strlen($generated)) {
return false;
}
$res = 0;
for ($i = 0; $i < $expectedLength; ++$i) {
$res |= ord($expected[$i]) ^ ord($generated[$... | php | {
"resource": ""
} |
q459 | Generator.make | train | protected function make($filenames, $template = 'base.php.twig', array $options = array())
{
foreach ((array) $filenames as $filename)
{
if (! $this->getOption('force') && $this->fs->exists($filename))
{
throw new \RuntimeException(sprintf('Cannot duplicate %s', $filename))... | php | {
"resource": ""
} |
q460 | Generator.createDirectory | train | public function createDirectory($dirPath)
{
if (! $this->fs->exists($dirPath))
{
$this->fs->mkdir($dirPath);
}
} | php | {
"resource": ""
} |
q461 | MediaListener.getProvider | train | public function getProvider(LifecycleEventArgs $args)
{
$provider = $args->getObject()->getProvider();
if (!$provider) {
throw new \Exception('Please set a provider on the entity before persisting any media');
}
return $this->container->get('opifer.media.provider.pool')... | php | {
"resource": ""
} |
q462 | VimeoProvider.saveThumbnail | train | public function saveThumbnail(MediaInterface $media, $url)
{
$thumb = $this->mediaManager->createMedia();
$thumb
->setStatus(Media::STATUS_HASPARENT)
->setName($media->getName().'_thumb')
->setProvider('image')
;
$filename = '/tmp/'.basename($url... | php | {
"resource": ""
} |
q463 | FormSubmitListener.postFormSubmit | train | public function postFormSubmit(FormSubmitEvent $event)
{
$post = $event->getPost();
$mailinglists = $email = null;
foreach ($post->getValueSet()->getValues() as $value) {
if ($value instanceof MailingListSubscribeValue && $value->getValue() == true) {
$parameters... | php | {
"resource": ""
} |
q464 | Ballot.initDefaultMentions | train | public function initDefaultMentions(): Ballot{
$this->mentions=[new Mention("Excellent"),new Mention("Good"),new Mention("Pretty good"),new Mention("Fair"),new Mention("Insufficient"),new Mention("To Reject")];
return $this;
} | php | {
"resource": ""
} |
q465 | Block.hasSharedParent | train | public function hasSharedParent()
{
$parent = $this->getParent();
if ($parent != null && ($parent->isShared() || $parent->hasSharedParent())) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q466 | StringHelper.replaceLinks | train | public function replaceLinks($string)
{
preg_match_all('/(\[content_url\](.*?)\[\/content_url\]|\[content_url\](.*?)\[\\\\\/content_url\])/', $string, $matches);
if (!count($matches)) {
return $string;
}
if (!empty($matches[3][0])) {
$matches[1] = $matches[3... | php | {
"resource": ""
} |
q467 | BoxModelDataTransformer.transform | train | public function transform($original)
{
if (!$original) {
return $original;
}
$string = substr($original, 1);
$split = explode('-', $string);
return [
'side' => $split[0],
'size' => $split[1],
];
} | php | {
"resource": ""
} |
q468 | BlockListener.getService | train | public function getService(LifecycleEventArgs $args)
{
$service = $args->getObject();
if (!$service) {
throw new \Exception('Please set a provider on the entity before persisting any media');
}
return $this->getBlockManager()->getService($service);
} | php | {
"resource": ""
} |
q469 | ContentController.createAction | train | public function createAction(Request $request, $siteId = null, $type = 0, $layoutId = null)
{
/** @var ContentManager $manager */
$manager = $this->get('opifer.content.content_manager');
if ($type) {
$contentType = $this->get('opifer.content.content_type_manager')->getRepository... | php | {
"resource": ""
} |
q470 | ContentController.editAction | train | public function editAction(Request $request, $id)
{
/** @var ContentManager $manager */
$manager = $this->get('opifer.content.content_manager');
$em = $manager->getEntityManager();
$content = $manager->getRepository()->find($id);
$content = $manager->createMissingValueSet($co... | php | {
"resource": ""
} |
q471 | MediaEventSubscriber.onPostSerialize | train | public function onPostSerialize(ObjectEvent $event)
{
// getSubscribedEvents doesn't seem to support parent classes
if (!$event->getObject() instanceof MediaInterface) {
return;
}
/** @var MediaInterface $media */
$media = $event->getObject();
$provider ... | php | {
"resource": ""
} |
q472 | MediaEventSubscriber.getImages | train | public function getImages(MediaInterface $media, array $filters)
{
$key = $media->getImagesCacheKey();
if (!$images = $this->cache->fetch($key)) {
$provider = $this->getProvider($media);
$reference = $provider->getThumb($media);
$images = [];
foreach... | php | {
"resource": ""
} |
q473 | RelatedCollectionBlockService.getAttributes | train | protected function getAttributes(ContentInterface $owner)
{
/** @var AttributeInterface $attributes */
$attributes = $owner->getValueSet()->getAttributes();
$choices = [];
foreach ($attributes as $attribute) {
if (!in_array($attribute->getValueType(), ['select', 'radio',... | php | {
"resource": ""
} |
q474 | PostController.viewAction | train | public function viewAction($id)
{
$post = $this->get('opifer.form.post_manager')->getRepository()->find($id);
if (!$post) {
return $this->createNotFoundException();
}
return $this->render($this->getParameter('opifer_form.post_view_view'), [
'post' => $post,
... | php | {
"resource": ""
} |
q475 | PostController.notificationAction | train | public function notificationAction($id)
{
/** @var PostInterface $post */
$post = $this->get('opifer.form.post_manager')->getRepository()->find($id);
if (!$post) {
return $this->createNotFoundException();
}
$form = $post->getForm();
/** @var Mailer $mai... | php | {
"resource": ""
} |
q476 | ConfigManager.keyValues | train | public function keyValues($form = null)
{
if (null === $this->configs) {
$this->loadConfigs();
}
$keys = ($form) ? call_user_func([$form, 'getFields']) : [];
$array = [];
foreach ($this->configs as $key => $config) {
if ($form && !in_array($key, $key... | php | {
"resource": ""
} |
q477 | ConfigManager.loadConfigs | train | public function loadConfigs()
{
$configs = [];
foreach ($this->getRepository()->findAll() as $config) {
$configs[$config->getName()] = $config;
}
$this->configs = $configs;
return $configs;
} | php | {
"resource": ""
} |
q478 | FormController.indexAction | train | public function indexAction()
{
$forms = $this->get('opifer.form.form_manager')->getRepository()
->findAllWithPosts();
return $this->render($this->getParameter('opifer_form.form_index_view'), [
'forms' => $forms,
]);
} | php | {
"resource": ""
} |
q479 | FormController.createAction | train | public function createAction(Request $request)
{
$formManager = $this->get('opifer.form.form_manager');
$form = $formManager->create();
$formType = $this->createForm(FormType::class, $form);
$formType->handleRequest($request);
if ($formType->isSubmitted() && $formType->isV... | php | {
"resource": ""
} |
q480 | FormController.editAction | train | public function editAction(Request $request, $id)
{
$formManager = $this->get('opifer.form.form_manager');
$em = $this->get('doctrine.orm.entity_manager');
$form = $formManager->getRepository()->find($id);
if (!$form) {
return $this->createNotFoundException();
}... | php | {
"resource": ""
} |
q481 | ContentController.homeAction | train | public function homeAction(Request $request)
{
/** @var BlockManager $manager */
$manager = $this->get('opifer.content.content_manager');
$host = $request->getHost();
$em = $this->getDoctrine()->getManager();
$siteCount = $em->getRepository(Site::class)->createQueryBuilder(... | php | {
"resource": ""
} |
q482 | Parser.parse | train | public function parse($jwt)
{
$data = $this->splitJwt($jwt);
$header = $this->parseHeader($data[0]);
$claims = $this->parseClaims($data[1]);
$signature = $this->parseSignature($header, $data[2]);
foreach ($claims as $name => $value) {
if (isset($header[$name])) {... | php | {
"resource": ""
} |
q483 | Parser.splitJwt | train | protected function splitJwt($jwt)
{
if (!is_string($jwt)) {
throw new \InvalidArgumentException('The JWT string must have two dots');
}
$data = explode('.', $jwt);
if (count($data) != 3) {
throw new \InvalidArgumentException('The JWT string must have two dot... | php | {
"resource": ""
} |
q484 | Parser.parseHeader | train | protected function parseHeader($data)
{
$header = (array) $this->deserializer->fromJSON($this->deserializer->fromBase64URL($data));
if (isset($header['enc'])) {
throw new \InvalidArgumentException('Encryption is not supported yet');
}
return $header;
} | php | {
"resource": ""
} |
q485 | Parser.parseClaims | train | protected function parseClaims($data)
{
$claims = (array) $this->deserializer->fromJSON($this->deserializer->fromBase64URL($data));
foreach ($claims as $name => &$value) {
$value = $this->claimFactory->create($name, $value);
}
return $claims;
} | php | {
"resource": ""
} |
q486 | Parser.parseSignature | train | protected function parseSignature(array $header, $data)
{
if ($data == '' || !isset($header['alg']) || $header['alg'] == 'none') {
return null;
}
$hash = $this->deserializer->fromBase64URL($data);
return new Signature($hash);
} | php | {
"resource": ""
} |
q487 | Content.getBaseSlug | train | public function getBaseSlug()
{
$slug = $this->slug;
if (substr($slug, -6) == '/index') {
$slug = rtrim($slug, 'index');
}
return $slug;
} | php | {
"resource": ""
} |
q488 | Content.getBreadCrumbs | train | public function getBreadCrumbs()
{
$crumbs = [];
if (null !== $this->parent) {
$crumbs = $this->getParent()->getBreadCrumbs();
}
$crumbs[$this->slug] = $this->getShortTitle();
return $crumbs;
} | php | {
"resource": ""
} |
q489 | Content.getParents | train | public function getParents($includeSelf = true)
{
$parents = [];
if (null !== $this->parent) {
$parents = $this->getParent()->getParents();
}
if ($includeSelf) {
$parents[] = $this;
}
return $parents;
} | php | {
"resource": ""
} |
q490 | Content.getCoverImage | train | public function getCoverImage()
{
if ($this->getValueSet() !== null) {
foreach ($this->getValueSet()->getValues() as $value) {
if ($value instanceof MediaValue &&
false !== $media = $value->getMedias()->first()) {
return $media->getReferenc... | php | {
"resource": ""
} |
q491 | Field.getCustomFieldOption | train | public static function getCustomFieldOption(JiraClient $client, $id)
{
$path = "/customFieldOption/{$id}";
try {
$data = $client->callGet($path)->getData();
$data['id'] = $id;
return new CustomFieldOption($client, $data);
} catch (Exception $e) {
... | php | {
"resource": ""
} |
q492 | CmsKernel.registerBundles | train | public function registerBundles()
{
$bundles = [
// Symfony standard bundles
new \Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new \Symfony\Bundle\SecurityBundle\SecurityBundle(),
new \Symfony\Bundle\TwigBundle\TwigBundle(),
new \Symfony\Bundl... | php | {
"resource": ""
} |
q493 | FormManager.createForm | train | public function createForm(FormInterface $form, PostInterface $post)
{
return $this->formFactory->create(PostType::class, $post, ['form_id' => $form->getId()]);
} | php | {
"resource": ""
} |
q494 | PaymentMethods.toOptionArray | train | public function toOptionArray()
{
$return = [];
$paymentMethodCodes = $this->_installmentsHelper->getAllInstallmentPaymentMethodCodes();
foreach ($paymentMethodCodes as $paymentMethodCode) {
$return[] = [
'value' => $paymentMethodCode,
'label' => ... | php | {
"resource": ""
} |
q495 | Image.appendTiff | train | public function appendTiff($appendFile = "")
{
//check whether file is set or not
if ($appendFile == '')
throw new Exception('No file name specified');
$strURI = Product::$baseProductUri . '/imaging/tiff/' . $this->getFileName() . '/appendTiff?appendFile=' . $appendFile;
... | php | {
"resource": ""
} |
q496 | Image.resizeImage | train | public function resizeImage($inputPath, $newWidth, $newHeight, $outputFormat)
{
//check whether files are set or not
if ($inputPath == '')
throw new Exception('Base file not specified');
if ($newWidth == '')
throw new Exception('New image width not specified');
... | php | {
"resource": ""
} |
q497 | Image.cropImage | train | public function cropImage($x, $y, $width, $height, $outputFormat, $outPath)
{
//check whether files are set or not
if ($this->getFileName() == '')
throw new Exception('Base file not specified');
if ($x == '')
throw new Exception('X position not specified');
... | php | {
"resource": ""
} |
q498 | Image.rotateImage | train | public function rotateImage($method, $outputFormat, $outPath)
{
if ($method == '')
throw new Exception('RotateFlip method not specified');
if ($outputFormat == '')
throw new Exception('Format not specified');
if ($outPath == '')
throw new Exception('Out... | php | {
"resource": ""
} |
q499 | Image.updateImage | train | public function updateImage($rotateFlipMethod, $newWidth, $newHeight, $xPosition, $yPosition, $rectWidth, $rectHeight, $saveFormat, $outPath)
{
if ($rotateFlipMethod == '')
throw new Exception('Rotate Flip Method not specified');
if ($newWidth == '')
throw new Except... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.