_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q245600 | Utf8.addSpecial | validation | public static function addSpecial($special)
{
$special = (array) $special;
foreach ($special as $char) {
self::$special[] = $char;
}
} | php | {
"resource": ""
} |
q245601 | Utf8.dump | validation | public static function dump($str, $useHtml = false, $sanitizeNonBinary = false)
{
self::$useHtml = $useHtml;
self::$sanitizeNonBinary = $sanitizeNonBinary;
self::setStr($str);
$controlCharAs = 'other'; // how should we treat ascii control chars?
$curBlockType = 'utf8'; // utf... | php | {
"resource": ""
} |
q245602 | Utf8.isUtf8 | validation | public static function isUtf8($str, &$special = false)
{
self::setStr($str);
$special = false;
while (self::$curI < self::$stats['strLen']) {
$isUtf8 = self::isOffsetUtf8($isSpecial); // special is only checking control chars
if (!$isUtf8) {
return fal... | php | {
"resource": ""
} |
q245603 | Utf8.ordUtf8 | validation | public static function ordUtf8($str, &$offset = 0, &$char = null)
{
$code = \ord($str[$offset]);
$numBytes = 1;
if ($code >= 0x80) { // otherwise 0xxxxxxx
if ($code < 0xe0) { // 110xxxxx
$numBytes = 2;
$code -= 0xC0;
... | php | {
"resource": ""
} |
q245604 | Utf8.toUtf8 | validation | public static function toUtf8($str)
{
if (\extension_loaded('mbstring') && \function_exists('iconv')) {
$encoding = \mb_detect_encoding($str, \mb_detect_order(), true);
if (!$encoding) {
$str_conv = false;
if (\function_exists('iconv')) {
... | php | {
"resource": ""
} |
q245605 | Utf8.setStr | validation | private static function setStr($str)
{
self::$str = $str;
self::$curI = 0;
self::$stats = array(
'bytesOther' => 0,
'bytesSpecial' => 0, // special UTF-8
'bytesUtf8' => 0, // includes ASCII
'strLen' => \strlen($str),
);... | php | {
"resource": ""
} |
q245606 | ErrorEmailer.onErrorHighPri | validation | public function onErrorHighPri(Event $error)
{
$this->throttleDataRead();
$hash = $error['hash'];
$error['email'] = ($error['type'] & $this->cfg['emailMask'])
&& $error['isFirstOccur']
&& $this->cfg['emailTo'];
$error['stats'] = array(
'tsEmailed' ... | php | {
"resource": ""
} |
q245607 | ErrorEmailer.backtraceStr | validation | protected function backtraceStr(Event $error)
{
$backtrace = $error['backtrace']
? $error['backtrace'] // backtrace provided
: $error->getSubject()->backtrace();
if (\count($backtrace) < 2) {
return '';
}
if ($backtrace && $error['vars']) {
... | php | {
"resource": ""
} |
q245608 | ErrorEmailer.emailErr | validation | protected function emailErr(Event $error)
{
$dateTimeFmt = 'Y-m-d H:i:s (T)';
$errMsg = $error['message'];
if ($error['isHtml']) {
$errMsg = \strip_tags($errMsg);
$errMsg = \htmlspecialchars_decode($errMsg);
}
$countSince = $error['stats']['countSince'... | php | {
"resource": ""
} |
q245609 | Event.& | validation | public function &offsetGet($key)
{
if ($this->hasValue($key)) {
return $this->values[$key];
}
$null = null;
return $null;
} | php | {
"resource": ""
} |
q245610 | Html.buildTable | validation | public function buildTable($rows, $options = array())
{
$options = \array_merge(array(
'attribs' => array(),
'caption' => null,
'columns' => array(),
'totalCols' => array(),
), $options);
if (\is_string($options['attribs'])) {
$opti... | php | {
"resource": ""
} |
q245611 | Html.dump | validation | public function dump($val, $sanitize = true, $tagName = 'span')
{
$this->wrapAttribs = array(
'class' => array(),
'title' => null,
);
$this->sanitize = $sanitize;
$val = parent::dump($val);
if ($tagName && !\in_array($this->dumpType, array('recursion')... | php | {
"resource": ""
} |
q245612 | Html.markupClassname | validation | public function markupClassname($str, $tagName = 'span', $attribs = array())
{
if (\preg_match('/^(.+)(::|->)(.+)$/', $str, $matches)) {
$classname = $matches[1];
$opMethod = '<span class="t_operator">'.\htmlspecialchars($matches[2]).'</span>'
. '<span class="meth... | php | {
"resource": ""
} |
q245613 | Html.onOutput | validation | public function onOutput(Event $event)
{
$this->data = $this->debug->getData();
$this->channels = array();
$str = '<div'.$this->debug->utilities->buildAttribString(array(
'class' => 'debug',
// channel list gets built as log processed... we'll str_replace this...
... | php | {
"resource": ""
} |
q245614 | Html.buildArgString | validation | protected function buildArgString($args, $sanitize = true)
{
$glue = ', ';
$glueAfterFirst = true;
if (\is_string($args[0])) {
if (\preg_match('/[=:] ?$/', $args[0])) {
// first arg ends with "=" or ":"
$glueAfterFirst = false;
} elseif... | php | {
"resource": ""
} |
q245615 | Html.buildChannelTree | validation | protected function buildChannelTree()
{
if ($this->channels == array($this->channelNameRoot)) {
return array();
}
\sort($this->channels);
// move root to the top
$rootKey = \array_search($this->channelNameRoot, $this->channels);
if ($rootKey !== false) {
... | php | {
"resource": ""
} |
q245616 | Html.buildGroupMethod | validation | protected function buildGroupMethod($method, $args = array(), $meta = array())
{
$str = '';
if (\in_array($method, array('group','groupCollapsed'))) {
$label = \array_shift($args);
$levelClass = isset($meta['level'])
? 'level-'.$meta['level']
:... | php | {
"resource": ""
} |
q245617 | Html.buildTableFooter | validation | protected function buildTableFooter($keys)
{
$haveTotal = false;
$cells = array();
foreach ($keys as $key) {
$colHasTotal = isset($this->tableInfo['totals'][$key]);
$cells[] = $colHasTotal
? $this->dump(\round($this->tableInfo['totals'][$key], 6), true... | php | {
"resource": ""
} |
q245618 | Html.buildTableHeader | validation | protected function buildTableHeader($keys)
{
$headers = array();
foreach ($keys as $key) {
$headers[$key] = $key === MethodTable::SCALAR
? 'value'
: \htmlspecialchars($key);
if ($this->tableInfo['colClasses'][$key]) {
$headers[$... | php | {
"resource": ""
} |
q245619 | Html.buildTableRow | validation | protected function buildTableRow($row, $keys, $rowKey)
{
$str = '';
$values = $this->debug->methodTable->keyValues($row, $keys, $objInfo);
$parsed = $this->debug->utilities->parseTag($this->dump($rowKey));
$str .= '<tr>';
$str .= $this->debug->utilities->buildTag(
... | php | {
"resource": ""
} |
q245620 | Html.dumpArray | validation | protected function dumpArray($array)
{
if (empty($array)) {
$html = '<span class="t_keyword">array</span>'
.'<span class="t_punct">()</span>';
} else {
$displayKeys = $this->debug->getCfg('output.displayListKeys') || !$this->debug->utilities->isList($array);
... | php | {
"resource": ""
} |
q245621 | Html.visualWhiteSpace | validation | protected function visualWhiteSpace($str)
{
// display \r, \n, & \t
$str = \preg_replace_callback('/(\r\n|\r|\n)/', array($this, 'visualWhiteSpaceCallback'), $str);
$str = \preg_replace('#(<br />)?\n$#', '', $str);
$str = \str_replace("\t", '<span class="ws_t">'."\t".'</span>', $str)... | php | {
"resource": ""
} |
q245622 | Html.visualWhiteSpaceCallback | validation | protected function visualWhiteSpaceCallback($matches)
{
$strBr = $this->debug->getCfg('addBR') ? '<br />' : '';
$search = array("\r","\n");
$replace = array('<span class="ws_r"></span>','<span class="ws_n"></span>'.$strBr."\n");
return \str_replace($search, $replace, $matches[1]);
... | php | {
"resource": ""
} |
q245623 | Text.onOutput | validation | public function onOutput(Event $event)
{
$this->channelName = $this->debug->getCfg('channel');
$this->data = $this->debug->getData();
$str = '';
$str .= $this->processAlerts();
$str .= $this->processSummary();
$str .= $this->processLog();
$this->data = array()... | php | {
"resource": ""
} |
q245624 | Text.buildArgString | validation | protected function buildArgString($args)
{
$numArgs = \count($args);
if ($numArgs == 1 && \is_string($args[0])) {
$args[0] = \strip_tags($args[0]);
}
foreach ($args as $k => $v) {
if ($k > 0 || !\is_string($v)) {
$args[$k] = $this->dump($v);
... | php | {
"resource": ""
} |
q245625 | Text.dumpArray | validation | protected function dumpArray($array)
{
$isNested = $this->valDepth > 0;
$this->valDepth++;
$array = parent::dumpArray($array);
$str = \trim(\print_r($array, true));
$str = \preg_replace('#^Array\n\(#', 'array(', $str);
$str = \preg_replace('#^array\s*\(\s+\)#', 'array... | php | {
"resource": ""
} |
q245626 | Text.dumpObject | validation | protected function dumpObject($abs)
{
$isNested = $this->valueDepth > 0;
$this->valueDepth++;
if ($abs['isRecursion']) {
$str = '(object) '.$abs['className'].' *RECURSION*';
} elseif ($abs['isExcluded']) {
$str = '(object) '.$abs['className'].' (not inspected)... | php | {
"resource": ""
} |
q245627 | Text.dumpMethods | validation | protected function dumpMethods($methods)
{
$str = '';
if (!empty($methods)) {
$counts = array(
'public' => 0,
'protected' => 0,
'private' => 0,
'magic' => 0,
);
foreach ($methods as $info) {
... | php | {
"resource": ""
} |
q245628 | NovalnetSepa.getConfigFE | validation | public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket )
{
$list = [];
$feconfig = $this->feConfig;
try
{
$code = $this->getServiceItem()->getCode();
$service = $basket->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, $code );
foreach( $service->getAttributeIt... | php | {
"resource": ""
} |
q245629 | NovalnetSepa.setConfigFE | validation | public function setConfigFE( \Aimeos\MShop\Order\Item\Base\Service\Iface $orderServiceItem, array $attributes )
{
$this->setAttributes( $orderServiceItem, $attributes, 'session' );
} | php | {
"resource": ""
} |
q245630 | Datatrans.repay | validation | public function repay( \Aimeos\MShop\Order\Item\Iface $order )
{
$base = $this->getOrderBase( $order->getBaseId() );
if( ( $cfg = $this->getCustomerData( $base->getCustomerId(), 'repay' ) ) === null )
{
$msg = sprintf( 'No reoccurring payment data available for customer ID "%1$s"', $base->getCustomerId() );
... | php | {
"resource": ""
} |
q245631 | Datatrans.getXmlProvider | validation | protected function getXmlProvider()
{
$provider = OPay::create('Datatrans\Xml');
$provider->initialize( $this->getServiceItem()->getConfig() );
return $provider;
} | php | {
"resource": ""
} |
q245632 | OmniPay.getConfigBE | validation | public function getConfigBE()
{
$list = [];
foreach( $this->beConfig as $key => $config ) {
$list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( $config );
}
return $list;
} | php | {
"resource": ""
} |
q245633 | OmniPay.checkConfigBE | validation | public function checkConfigBE( array $attributes )
{
return array_merge( parent::checkConfigBE( $attributes ), $this->checkConfig( $this->beConfig, $attributes ) );
} | php | {
"resource": ""
} |
q245634 | OmniPay.cancel | validation | public function cancel( \Aimeos\MShop\Order\Item\Iface $order )
{
$provider = $this->getProvider();
if( !$provider->supportsVoid() ) {
return;
}
$base = $this->getOrderBase( $order->getBaseId() );
$data = array(
'transactionReference' => $this->getTransactionReference( $base ),
'currency' => $bas... | php | {
"resource": ""
} |
q245635 | OmniPay.capture | validation | public function capture( \Aimeos\MShop\Order\Item\Iface $order )
{
$provider = $this->getProvider();
if( !$provider->supportsCapture() ) {
return;
}
$base = $this->getOrderBase( $order->getBaseId() );
$data = array(
'transactionReference' => $this->getTransactionReference( $base ),
'currency' => ... | php | {
"resource": ""
} |
q245636 | OmniPay.isImplemented | validation | public function isImplemented( $what )
{
$provider = $this->getProvider();
switch( $what )
{
case \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CAPTURE:
return $provider->supportsCapture();
case \Aimeos\MShop\Service\Provider\Payment\Base::FEAT_CANCEL:
return $provider->supportsVoid();
case... | php | {
"resource": ""
} |
q245637 | OmniPay.refund | validation | public function refund( \Aimeos\MShop\Order\Item\Iface $order )
{
$provider = $this->getProvider();
if( !$provider->supportsRefund() ) {
return;
}
$base = $this->getOrderBase( $order->getBaseId() );
$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;
$service = $this->getBasketService( $... | php | {
"resource": ""
} |
q245638 | OmniPay.getRedirectForm | validation | protected function getRedirectForm( \Omnipay\Common\Message\RedirectResponseInterface $response )
{
$list = [];
foreach( (array) $response->getRedirectData() as $key => $value )
{
$list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( array(
'label' => $key,
'code' => $key,
'type' => 'string',... | php | {
"resource": ""
} |
q245639 | OmniPay.getTransactionReference | validation | protected function getTransactionReference( \Aimeos\MShop\Order\Item\Base\Iface $base )
{
$code = $this->getServiceItem()->getCode();
$service = $base->getService( \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT, $code );
return $service->getAttribute( 'TRANSACTIONID', 'payment/omnipay' );
} | php | {
"resource": ""
} |
q245640 | OmniPay.saveRepayData | validation | protected function saveRepayData( \Omnipay\Common\Message\ResponseInterface $response, $customerId )
{
$data = [];
if( method_exists( $response, 'getCardReference' ) ) {
$data['token'] = $response->getCardReference();
}
if( method_exists( $response, 'getExpiryMonth' ) ) {
$data['month'] = $response->ge... | php | {
"resource": ""
} |
q245641 | OmniPay.saveTransationRef | validation | protected function saveTransationRef( \Aimeos\MShop\Order\Item\Base\Iface $baseItem, $ref )
{
$type = \Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT;
$serviceItem = $this->getBasketService( $baseItem, $type, $this->getServiceItem()->getCode() );
$attr = array( 'TRANSACTIONID' => $ref );
$this->setAt... | php | {
"resource": ""
} |
q245642 | OmniPay.translateStatus | validation | protected function translateStatus( $status )
{
if( !interface_exists( '\Omnipay\Common\Message\NotificationInterface' ) ) {
return \Aimeos\MShop\Order\Item\Base::PAY_REFUSED;
}
switch( $status )
{
case \Omnipay\Common\Message\NotificationInterface::STATUS_COMPLETED:
return \Aimeos\MShop\Order\Item\... | php | {
"resource": ""
} |
q245643 | Stripe.getProvider | validation | protected function getProvider()
{
$config = $this->getServiceItem()->getConfig();
$config['apiKey'] = $this->getServiceItem()->getConfigValue( 'stripe.apiKey' );
if( !isset( $this->provider ) )
{
$this->provider = OPay::create( 'Stripe' );
$this->provider->setTestMode( (bool) $this->getValue( 'testmode... | php | {
"resource": ""
} |
q245644 | RelatedLayoutsLoader.loadRelatedLayouts | validation | public function loadRelatedLayouts(Location $location)
{
$query = $this->databaseConnection->createQueryBuilder();
$valueColumnName = class_exists('Netgen\BlockManager\Version') && Version::VERSION_ID < 1100
? 'value_id' :
'value';
$query->select('DISTINCT b.layout_... | php | {
"resource": ""
} |
q245645 | PathHelper.getPath | validation | public function getPath($locationId)
{
$pathArray = array();
$startingLocation = $this->locationService->loadLocation($locationId);
$path = $startingLocation->path;
// Shift of location "1" from path as it is not
// a fully valid location and not readable by most users
... | php | {
"resource": ""
} |
q245646 | ConfigurationGenerator.generate | validation | public function generate(InputInterface $input, OutputInterface $output)
{
$fileSystem = $this->container->get('filesystem');
$configResolver = $this->container->get('ezpublish.config.resolver');
$kernelRootDir = $this->container->getParameter('kernel.root_dir');
$siteAccessGroup = ... | php | {
"resource": ""
} |
q245647 | LegacyMenuPlugin.matches | validation | public function matches(Request $request)
{
return in_array(
$request->attributes->get('_route'),
array(FallbackRouter::ROUTE_NAME, UrlAliasRouter::URL_ALIAS_ROUTE_NAME),
true
);
} | php | {
"resource": ""
} |
q245648 | GlobalVariable.getCurrentMenuPlugin | validation | public function getCurrentMenuPlugin()
{
$currentRequest = $this->requestStack->getCurrentRequest();
if (!$currentRequest instanceof Request) {
return false;
}
foreach ($this->menuPluginRegistry->getMenuPlugins() as $identifier => $menuPlugin) {
if ($menuPlug... | php | {
"resource": ""
} |
q245649 | ControllerListener.onKernelController | validation | public function onKernelController(FilterControllerEvent $event)
{
if ($event->getRequestType() !== HttpKernelInterface::MASTER_REQUEST) {
return;
}
if (!$this->isAdminSiteAccess) {
return;
}
$currentRoute = $event->getRequest()->attributes->get('_ro... | php | {
"resource": ""
} |
q245650 | Generator.render | validation | protected function render($template, $parameters)
{
$twig = new Twig_Environment(
new Twig_Loader_Filesystem($this->skeletonDirs),
array(
'debug' => true,
'cache' => false,
'strict_variables' => true,
'autoescape' => fal... | php | {
"resource": ""
} |
q245651 | IsEnterpriseVersionListener.onBuildView | validation | public function onBuildView(CollectViewParametersEvent $event)
{
$view = $event->getView();
if (!$view instanceof LayoutViewInterface && !$view instanceof RuleViewInterface) {
return;
}
if ($view->getContext() !== 'ngadminui') {
return;
}
$ev... | php | {
"resource": ""
} |
q245652 | MenuPluginRegistryPass.process | validation | public function process(ContainerBuilder $container)
{
if (!$container->has('netgen_admin_ui.menu_plugin.registry')) {
return;
}
$menuPluginRegistry = $container->findDefinition('netgen_admin_ui.menu_plugin.registry');
$menuPlugins = $container->findTaggedServiceIds('net... | php | {
"resource": ""
} |
q245653 | NetgenAdminUIExtension.getLegacyPreference | validation | public function getLegacyPreference($name)
{
$legacyKernel = $this->legacyKernel;
return $legacyKernel()->runCallback(
function () use ($name) {
return eZPreferences::value($name);
}
);
} | php | {
"resource": ""
} |
q245654 | LegacyExceptionListener.onException | validation | public function onException(GetResponseForExceptionEvent $event)
{
if (!$this->isAdminSiteAccess) {
return;
}
$routeName = $event->getRequest()->attributes->get('_route');
if ($routeName !== FallbackRouter::ROUTE_NAME) {
return;
}
$exception ... | php | {
"resource": ""
} |
q245655 | SetInformationCollectionAdminPageLayoutListener.onKernelRequest | validation | public function onKernelRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
if (!$this->isAdminSiteAccess) {
return;
}
$currentRoute = $event->getRequest()->attributes->get('_route');
if (mb_stripos($currentRoute, '... | php | {
"resource": ""
} |
q245656 | NgAdminUiTagsBundleOperator.modify | validation | public static function modify( $tpl, $operatorName, $operatorParameters, $rootNamespace, $currentNamespace, &$operatorValue, $namedParameters, $placement )
{
if ( $operatorName === 'has_tags_bundle' ) {
$operatorValue = class_exists('Netgen\TagsBundle\Version') && TagsBundleVersion::VERSION_ID >... | php | {
"resource": ""
} |
q245657 | LegacyResponseListener.onKernelResponse | validation | public function onKernelResponse(FilterResponseEvent $event)
{
$routeName = $event->getRequest()->attributes->get('_route');
if ($routeName !== FallbackRouter::ROUTE_NAME) {
return;
}
$response = $event->getResponse();
if (!$response instanceof LegacyResponse) {
... | php | {
"resource": ""
} |
q245658 | LayoutsController.showLocationLayouts | validation | public function showLocationLayouts($locationId)
{
$repository = $this->getRepository();
$location = $repository->getLocationService()->loadLocation($locationId);
$content = $repository->getContentService()->loadContent($location->contentInfo->id);
$request = $this->createRequest($... | php | {
"resource": ""
} |
q245659 | LayoutsController.createRequest | validation | protected function createRequest(Content $content, Location $location)
{
$request = Request::create('');
$request->attributes->set('content', $content);
$request->attributes->set('location', $location);
if (interface_exists('eZ\Publish\Core\MVC\Symfony\View\ContentValueView')) {
... | php | {
"resource": ""
} |
q245660 | LayoutsController.checkPermissions | validation | protected function checkPermissions()
{
if ($this->isGranted('ROLE_NGBM_EDITOR')) {
return;
}
if ($this->isGranted('nglayouts:ui:access')) {
return;
}
$exception = $this->createAccessDeniedException();
$exception->setAttributes('nglayouts:ui:... | php | {
"resource": ""
} |
q245661 | SecurityListener.onKernelBuilt | validation | public function onKernelBuilt(PostBuildKernelEvent $event)
{
$currentRequest = $this->requestStack->getCurrentRequest();
// Ignore if not in web context, if legacy_mode is active or if user is not authenticated
if (
$currentRequest === null
|| !$event->getKernelHandl... | php | {
"resource": ""
} |
q245662 | LegacySiteAccessGenerator.generate | validation | public function generate(InputInterface $input, OutputInterface $output)
{
$fileSystem = $this->container->get('filesystem');
$legacyRootDir = $this->container->getParameter('ezpublish_legacy.root_dir');
$siteAccessName = $input->getOption('site-access-name');
$languageCode = $input... | php | {
"resource": ""
} |
q245663 | InstallCommand.interact | validation | protected function interact(InputInterface $input, OutputInterface $output)
{
$this->input = $input;
$this->output = $output;
$this->questionHelper = $this->getHelper('question');
if (Kernel::VERSION_ID < 20700) {
throw new RuntimeException(
'Installation... | php | {
"resource": ""
} |
q245664 | InstallCommand.doInteract | validation | protected function doInteract()
{
$siteAccess = $this->askForData(
'site-access-name',
'Enter the name of the Netgen Admin UI siteaccess',
'ngadminui',
function ($siteaccess) {
if (!preg_match('/^[a-z][a-z0-9_]*$/', $siteaccess)) {
... | php | {
"resource": ""
} |
q245665 | InstallCommand.execute | validation | protected function execute(InputInterface $input, OutputInterface $output)
{
if (!$input->isInteractive()) {
$output->writeln('<error>This command only supports interactive execution</error>');
return 1;
}
$this->writeSection('Installation');
// Generate le... | php | {
"resource": ""
} |
q245666 | InstallCommand.generateLegacyAutoloads | validation | protected function generateLegacyAutoloads()
{
$this->output->writeln('');
$this->output->write('Generating legacy autoloads... ');
$currentWorkingDirectory = getcwd();
try {
chdir($this->getContainer()->getParameter('ezpublish_legacy.root_dir'));
$processB... | php | {
"resource": ""
} |
q245667 | InstallCommand.askForData | validation | protected function askForData($optionIdentifier, $optionName, $defaultValue, $validator = null)
{
$optionValue = $this->input->getOption($optionIdentifier);
$optionValue = !empty($optionValue) ? $optionValue :
$defaultValue;
$question = $this->getQuestion($optionName, $optionVal... | php | {
"resource": ""
} |
q245668 | InstallCommand.askForChoiceData | validation | protected function askForChoiceData($optionIdentifier, $optionName, array $choices, $defaultValue)
{
$optionValue = $this->input->getOption($optionIdentifier);
$optionValue = !empty($optionValue) ? $optionValue :
$defaultValue;
$question = $this->getChoiceQuestion($optionName, $... | php | {
"resource": ""
} |
q245669 | InstallCommand.getQuestion | validation | protected function getQuestion($questionName, $defaultValue = null, $validator = null)
{
$questionName = $defaultValue
? '<info>' . $questionName . '</info> [<comment>' . $defaultValue . '</comment>]: '
: '<info>' . $questionName . '</info>: ';
$question = new Question($ques... | php | {
"resource": ""
} |
q245670 | InstallCommand.getChoiceQuestion | validation | protected function getChoiceQuestion($questionName, $defaultValue = null, array $choices = array())
{
$questionName = $defaultValue
? '<info>' . $questionName . '</info> [<comment>' . $defaultValue . '</comment>]: '
: '<info>' . $questionName . '</info>: ';
return new Choice... | php | {
"resource": ""
} |
q245671 | InstallCommand.writeInstallerSummary | validation | protected function writeInstallerSummary($errors)
{
if (!$errors) {
$this->writeSection('You can now continue installation as per instructions in the README.md file!');
return;
}
$this->writeSection(
array(
'The command was not able to in... | php | {
"resource": ""
} |
q245672 | InstallCommand.writeSection | validation | protected function writeSection($text, $style = 'bg=blue;fg=white')
{
$this->output->writeln(
array(
'',
$this->getHelper('formatter')->formatBlock($text, $style, true),
'',
)
);
} | php | {
"resource": ""
} |
q245673 | InstallCommand.getRunner | validation | protected function getRunner(&$errors)
{
$output = $this->output;
$runner = function ($err) use ($output, &$errors) {
if (!empty($err)) {
$output->writeln('<fg=red>FAILED</>');
$errors = array_merge($errors, $err);
} else {
$out... | php | {
"resource": ""
} |
q245674 | Client.createSubscriber | validation | public function createSubscriber(array $channels): WatchdogSubscriber
{
$redis = clone $this->redis;
$redis->disconnect();
$redis->connect();
return new WatchdogSubscriber($redis, $channels);
} | php | {
"resource": ""
} |
q245675 | Client.call | validation | public function call(string $command, ...$arguments)
{
$arguments = func_get_args();
array_shift($arguments);
return $this->__call($command, $arguments);
} | php | {
"resource": ""
} |
q245676 | ExceptionFactory.fromErrorMessage | validation | public static function fromErrorMessage(string $error): QlessException
{
$area = null;
$message = $error;
if (preg_match(self::ERROR_MESSAGE_RE, $error, $matches) > 0) {
$area = $matches['area'];
$message = $matches['message'];
}
switch (true) {
... | php | {
"resource": ""
} |
q245677 | Config.get | validation | public function get(string $name, $default = null)
{
$res = $this->client->call('config.get', $name);
return $res === null ? $default : $res;
} | php | {
"resource": ""
} |
q245678 | Config.set | validation | public function set(string $name, $value): void
{
$this->client->call('config.set', $name, $value);
} | php | {
"resource": ""
} |
q245679 | JobFactory.create | validation | public function create(string $className, string $performMethod = 'perform')
{
if (class_exists($className) == false) {
throw new InvalidArgumentException("Could not find job class {$className}.");
}
if (method_exists($className, $performMethod) == false) {
throw new... | php | {
"resource": ""
} |
q245680 | SignalHandler.unregister | validation | public static function unregister(?array $signals = null): void
{
if (empty($signals)) {
$signals = self::KNOWN_SIGNALS;
}
foreach ($signals as $signal) {
if (is_string($signal)) {
// skip missing signals, for example OSX does not have all signals
... | php | {
"resource": ""
} |
q245681 | SignalHandler.sigName | validation | public static function sigName(int $signal): string
{
$signals = [
'SIGHUP', 'SIGINT', 'SIGQUIT', 'SIGILL', 'SIGTRAP', 'SIGABRT', 'SIGIOT', 'SIGBUS',
'SIGFPE', 'SIGKILL', 'SIGUSR1', 'SIGSEGV', 'SIGUSR2', 'SIGPIPE', 'SIGALRM', 'SIGTERM',
'SIGSTKFLT', 'SIGCLD', 'SIGCHLD', '... | php | {
"resource": ""
} |
q245682 | Collection.fromSubscriptions | validation | public function fromSubscriptions(string $topic): array
{
$response = [];
if (empty($topic)) {
return $response;
}
$subscriptions = $this->client->call('subscription', 'default', 'all', $topic);
$subscriptions = json_decode($subscriptions, true) ?: [];
... | php | {
"resource": ""
} |
q245683 | Collection.completed | validation | public function completed(int $offset = 0, int $count = 25)
{
return $this->client->jobs('complete', null, $offset, $count);
} | php | {
"resource": ""
} |
q245684 | Collection.multiget | validation | public function multiget(array $jids): array
{
if (empty($jids)) {
return [];
}
$results = call_user_func_array([$this->client, 'multiget'], $jids);
$jobs = json_decode($results, true) ?: [];
$ret = [];
foreach ($jobs as $data) {
$job = new ... | php | {
"resource": ""
} |
q245685 | Collection.failedForGroup | validation | public function failedForGroup($group, int $start = 0, int $limit = 25): array
{
$results = json_decode($this->client->failed($group, $start, $limit), true);
if (isset($results['jobs']) && !empty($results['jobs'])) {
$results['jobs'] = $this->multiget($results['jobs']);
}
... | php | {
"resource": ""
} |
q245686 | Collection.failed | validation | public function failed(): array
{
$results = json_decode($this->client->failed(), true);
return is_array($results) ? $results : [];
} | php | {
"resource": ""
} |
q245687 | Collection.tagged | validation | public function tagged(string $tag, int $offset = 0, int $limit = 25): array
{
$response = json_decode($this->client->call('tag', 'get', $tag, $offset, $limit), true);
if (empty($response['jobs'])) {
$response['jobs'] = [];
}
return $response['jobs'];
} | php | {
"resource": ""
} |
q245688 | Collection.fromWorker | validation | public function fromWorker(string $worker, string $subTimeInterval = ''): array
{
try {
$now = new \DateTime();
$interval = date_interval_create_from_date_string($subTimeInterval);
$timestamp = $now->sub($interval)->getTimestamp();
} catch (\Exception $e) {
... | php | {
"resource": ""
} |
q245689 | Queue.put | validation | public function put(
string $className,
array $data,
?string $jid = null,
?int $delay = null,
?int $retries = null,
?int $priority = null,
?array $tags = null,
?array $depends = null
) {
try {
$jid = $jid ?: str_replace('-', '', Uui... | php | {
"resource": ""
} |
q245690 | Queue.pop | validation | public function pop(?string $worker = null, ?int $numJobs = null)
{
$workerName = $worker ?: $this->client->getWorkerName();
$jids = json_decode($this->client->pop($this->name, $workerName, $numJobs ?: 1), true);
$jobs = [];
array_map(function (array $data) use (&$jobs) {
... | php | {
"resource": ""
} |
q245691 | Queue.popByJid | validation | public function popByJid(string $jid, ?string $worker = null): ?BaseJob
{
$workerName = $worker ?: $this->client->getWorkerName();
$data = json_decode($this->client->popByJid($this->name, $jid, $workerName), true);
$jobData = array_reduce($data, 'array_merge', []); //unwrap nested array
... | php | {
"resource": ""
} |
q245692 | Queue.recur | validation | public function recur(
string $className,
array $data,
?int $interval = null,
?int $offset = null,
?string $jid = null,
?int $retries = null,
?int $priority = null,
?int $backlog = null,
?array $tags = null
) {
try {
$jid = ... | php | {
"resource": ""
} |
q245693 | Queue.stats | validation | public function stats(?int $date = null): array
{
$date = $date ?: time();
return json_decode($this->client->stats($this->name, $date), true);
} | php | {
"resource": ""
} |
q245694 | Queue.isPaused | validation | public function isPaused(): bool
{
$stat = json_decode($this->client->queues($this->name), true);
return isset($stat['name']) && $stat['name'] === $this->name && $stat['paused'] == true;
} | php | {
"resource": ""
} |
q245695 | Queue.registerSyncCompleteEvent | validation | private function registerSyncCompleteEvent(): void
{
$this->getEventsManager()
->attach(QueueEvent\AfterEnqueue::getName(), function (QueueEvent\AfterEnqueue $event) {
if (!$this->client->config->get('sync-enabled')) {
return;
}
... | php | {
"resource": ""
} |
q245696 | EventsManager.attach | validation | public function attach(string $eventName, $handler, int $priority = 100): void
{
if (is_object($handler) == false && is_callable($handler) == false) {
throw new InvalidArgumentException(
sprintf('Event handler must be either an object or a callable %s given.', gettype($handler))
... | php | {
"resource": ""
} |
q245697 | EventsManager.fetchQueue | validation | protected function fetchQueue(string $eventName): SplPriorityQueue
{
if (isset($this->events[$eventName]) == false) {
$this->events[$eventName] = $this->createQueue();
}
return $this->events[$eventName];
} | php | {
"resource": ""
} |
q245698 | EventsManager.detach | validation | public function detach(string $eventName, $handler): void
{
if (is_object($handler) == false && is_callable($handler) == false) {
throw new InvalidArgumentException(
sprintf('Event handler must be either an object or a callable %s given.', gettype($handler))
);
... | php | {
"resource": ""
} |
q245699 | EventsManager.fire | validation | public function fire(AbstractUserEvent $event)
{
$status = null;
$type = $event::getEntityName();
if (isset($this->events[$type])) {
$queue = $this->events[$type];
$status = $this->fireQueue($queue, $event);
}
$eventName = $event->getName();
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.