_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q264100 | ResolvedColumnType.buildHeaderView | test | public function buildHeaderView(HeaderView $view, ColumnInterface $column, array $options)
{
if (null !== $this->parent) {
$this->parent->buildHeaderView($view, $column, $options);
}
$this->innerType->buildHeaderView($view, $column, $options);
foreach ($this->typeExtens... | php | {
"resource": ""
} |
q264101 | ResolvedColumnType.buildCellView | test | public function buildCellView(CellView $view, ColumnInterface $column, array $options)
{
if (null !== $this->parent) {
$this->parent->buildCellView($view, $column, $options);
}
$this->innerType->buildCellView($view, $column, $options);
foreach ($this->typeExtensions as ... | php | {
"resource": ""
} |
q264102 | ResolvedColumnType.newColumn | test | protected function newColumn($name, array $options): ColumnInterface
{
// Special case of CompoundColumnType which requires that child columns
// are set afterwards. Whenever you extend this class, make sure to honor this
// special use-case.
if (null === $this->compound) {
... | php | {
"resource": ""
} |
q264103 | ResolvedColumnType.isCompound | test | protected function isCompound(): bool
{
if ($this->innerType instanceof CompoundColumnType) {
return true;
}
for ($type = $this->parent; null !== $type; $type = $type->getParent()) {
if ($type->getInnerType() instanceof CompoundColumnType) {
return tr... | php | {
"resource": ""
} |
q264104 | AbstractRequest.getBaseData | test | protected function getBaseData()
{
$data = array();
$data['GatewayUserName'] = $this->getUsername();
$data['GatewayPassword'] = $this->getPassword();
$data['PaymentType'] = $this->paymentType;
if (isset($this->transactionType)) {
$data['TransactionType'] = $this-... | php | {
"resource": ""
} |
q264105 | AbstractRequest.getShippingData | test | protected function getShippingData()
{
$data = array();
// Customer shipping details
if ($card = $this->getCard()) {
// Customer shipping details
if ($card->getShippingFirstName()) {
$data['ShippingFirstName'] = $card->getShippingFirstName();
... | php | {
"resource": ""
} |
q264106 | AbstractRequest.getInvoiceData | test | protected function getInvoiceData()
{
$data = array();
$data['Amount'] = $this->getAmount();
if ($this->getDescription()) {
$data['OrderDescription'] = $this->getDescription();
}
return $data;
} | php | {
"resource": ""
} |
q264107 | AbstractRequest.sendData | test | public function sendData($data)
{
$xml = $this->buildRequest($data);
$headers = array(
'content-type' => 'text/xml; charset=utf-8',
'SOAPAction' => 'https://gateway.agms.com/roxapi/ProcessTransaction'
);
$httpResponse = $this->httpClient->post($this... | php | {
"resource": ""
} |
q264108 | StringUtil.trim | test | public static function trim(string $string): string
{
if (null !== $result = @preg_replace('/^[\pZ\p{Cc}]+|[\pZ\p{Cc}]+$/u', '', $string)) {
return $result;
}
return trim($string);
} | php | {
"resource": ""
} |
q264109 | StringUtil.fqcnToBlockPrefix | test | public static function fqcnToBlockPrefix(string $fqcn): string
{
// Non-greedy ("+?") to match "type" suffix, if present
if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
return strtolower(
preg_replace(['/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'], ['\\1_\\... | php | {
"resource": ""
} |
q264110 | MoneyToLocalizedStringTransformer.transform | test | public function transform($value)
{
if (null === $value) {
return '';
}
if (is_array($value)) {
return $this->doTransformation($value['currency'] ?: $this->defaultCurrency, (string) $value['amount']);
}
// Convert fixed spaces to normal ones.
... | php | {
"resource": ""
} |
q264111 | XmlArray.parseValue | test | protected function parseValue($value)
{
if (is_numeric($value)) {
return strpos($value, '.') !== false ? (float) $value : (int) $value;
} elseif ($value === 'true' || $value === '1') {
return true;
} elseif ($value === 'false' || $value === '0') {
return f... | php | {
"resource": ""
} |
q264112 | CompoundColumnBuilder.add | test | public function add(string $name, string $type = null, array $options = []): CompoundColumnBuilderInterface
{
$this->unresolvedColumns[$name] = [
'type' => $type,
'options' => $options,
];
return $this;
} | php | {
"resource": ""
} |
q264113 | File.isValidUpload | test | protected function isValidUpload()
{
$error = $this->error ?: UPLOAD_ERR_NO_FILE;
switch ($error) {
case UPLOAD_ERR_OK:
return $this->isUploadedFile();
break;
case UPLOAD_ERR_INI_SIZE:
throw new \RuntimeException('The uploaded... | php | {
"resource": ""
} |
q264114 | AssetHelper.resolve | test | public static function resolve(string $filename, string $basePath = ''): string
{
if (strpos($filename, '://')) {
//Absolute path
return $filename;
}
$localFilename = directory('public') . $filename;
//Add query parameter to uniquely identify file version
... | php | {
"resource": ""
} |
q264115 | EditLockControllerExtension.updateForm | test | public function updateForm($form, $record)
{
if (!$record) {
return;
}
// if the current user can't edit the record anyway, we don't need to do anything
if ($record && !$record->canEdit()) {
return $form;
}
// check if all classes shou... | php | {
"resource": ""
} |
q264116 | EditLockControllerExtension.updateEditForm | test | public function updateEditForm($form)
{
if ($record = $form->getRecord()) {
$form = $this->updateForm($form, $record);
}
} | php | {
"resource": ""
} |
q264117 | EditLockControllerExtension.updateItemEditForm | test | public function updateItemEditForm($form)
{
if ($record = $form->getRecord()) {
$form = $this->updateForm($form, $record);
}
} | php | {
"resource": ""
} |
q264118 | EditLockControllerExtension.lock | test | public function lock($request)
{
$id = (int)$request->postVar('RecordID');
$class = $request->postVar('RecordClass');
$existing = RecordBeingEdited::get()->filter(array(
'RecordID' => $id,
'RecordClass' => $class,
'EditorID' => Member::currentUserID()
... | php | {
"resource": ""
} |
q264119 | PubControl.apply_config | test | public function apply_config($config)
{
if (!is_array(reset($config)))
$config = array($config);
foreach ($config as $entry)
{
$pub = new PubControlClient($entry['uri']);
if (array_key_exists('iss', $entry))
$pub->set_auth_jwt(array('iss' =... | php | {
"resource": ""
} |
q264120 | PubControl.publish | test | public function publish($channel, $item)
{
foreach ($this->clients as $client)
$client->publish($channel, $item);
} | php | {
"resource": ""
} |
q264121 | TranslateLoader.load | test | public function load($locale): array
{
// if file not exists
if (!\file_exists($this->getFilePath($locale))) {
// if local support build in get translate from package.
if ($this->isSupportLocal($locale)) {
return include $this->getFilePath($locale, true);
... | php | {
"resource": ""
} |
q264122 | Client.send | test | public function send(RequestInterface $request)
{
$this->request = $request;
if ($this->httpClient instanceof ClientInterface || method_exists($this->httpClient, 'send')) {
$this->response = $this->httpClient->send($request);
} else {
throw new \RuntimeException('HTT... | php | {
"resource": ""
} |
q264123 | Uri.buildFromParts | test | private function buildFromParts(array $parts)
{
$this->withScheme(isset($parts['scheme']) ? $parts['scheme'] : '')
->withUserInfo(
isset($parts['user']) ? $parts['user'] : '',
isset($parts['pass']) ? ':'.$parts['pass'] : null
)
->withHost(i... | php | {
"resource": ""
} |
q264124 | UserController.store | test | public function store(CreateUserRequest $request)
{
$input = $request->all();
$user = $this->userRepository->create($input);
Flash::success(trans('l5starter::messages.create.success'));
return redirect(route('admin.users.index'));
} | php | {
"resource": ""
} |
q264125 | UserController.edit | test | public function edit($id)
{
$user = $this->userRepository->findWithoutFail($id);
if (empty($user)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.users.index'));
}
return view('l5starter::admin.users.edit')->with('u... | php | {
"resource": ""
} |
q264126 | UserController.update | test | public function update($id, UpdateUserRequest $request)
{
$user = $this->userRepository->findWithoutFail($id);
if (empty($user)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.users.index'));
}
$user = $this->userRe... | php | {
"resource": ""
} |
q264127 | UserController.destroy | test | public function destroy($id)
{
$user = $this->userRepository->findWithoutFail($id);
if (empty($user)) {
Flash::error(trans('l5starter::messages.404_not_found'));
return redirect(route('admin.users.index'));
}
$this->userRepository->delete($id);
Fla... | php | {
"resource": ""
} |
q264128 | MpdfService.createMpdfInstance | test | public function createMpdfInstance(
$format = 'A4',
$fontSize = 0,
$fontFamily = '',
$marginLeft = 15,
$marginRight = 15,
$marginTop = 16,
$marginBottom = 16,
$marginHeader = 9,
$marginFooter = 9,
$orientation = 'P'
)
{
if (... | php | {
"resource": ""
} |
q264129 | Request.addHostHeader | test | protected function addHostHeader(UriInterface $uri)
{
$host = $uri->getHost();
if ($port = $uri->getPort()) {
$host = sprintf('%s:%s', $host, $port);
}
$this->headers['host'] = array($host);
} | php | {
"resource": ""
} |
q264130 | RequestBuilder.buildGuzzleRequest | test | public function buildGuzzleRequest(RequestInterface $request)
{
$this->addCallable(function () use ($request) {
return $this->buildForVersionThree($request);
});
$this->addCallable(function () use ($request) {
return $this->buildForVersionFourOrFive($request);
... | php | {
"resource": ""
} |
q264131 | RequestBuilder.executeCallableChain | test | protected function executeCallableChain()
{
$callableResult = null;
foreach ($this->callableChain as $callable) {
$callableResult = call_user_func($callable);
if (null !== $callableResult) {
break;
}
}
return $callableResult;
... | php | {
"resource": ""
} |
q264132 | GuzzleClient.checkClassExists | test | protected function checkClassExists($className, $throwException = true)
{
if (class_exists($className)) {
return true;
}
if ($throwException) {
throw new \BadMethodCallException(
sprintf('%s not found. Please check your dependencies in composer.json',... | php | {
"resource": ""
} |
q264133 | ThreadSafeClient.run | test | public function run()
{
$quit = false;
while (!$quit)
{
\Mutex::lock($this->thread_mutex);
if (count($this->req_queue) == 0)
{
\Cond::wait($this->thread_cond, $this->thread_mutex);
if (count($this->req_queue) == 0)
... | php | {
"resource": ""
} |
q264134 | ThreadSafeClient.ensure_thread | test | public function ensure_thread()
{
if (!$this->is_thread_running)
{
$this->is_thread_running = true;
$this->thread_cond = \Cond::create();
$this->thread_mutex = \Mutex::create();
$this->start();
}
} | php | {
"resource": ""
} |
q264135 | ThreadSafeClient.queue_req | test | public function queue_req($req)
{
\Mutex::lock($this->thread_mutex);
$this->req_queue[] = $req;
\Cond::signal($this->thread_cond);
\Mutex::unlock($this->thread_mutex);
} | php | {
"resource": ""
} |
q264136 | ThreadSafeClient.pubbatch | test | public function pubbatch($reqs)
{
if (count($reqs) == 0)
throw new \RuntimeException('reqs length == 0');
$uri = $reqs[0][0];
$auth_header = $reqs[0][1];
$items = array();
$callbacks = array();
foreach ($reqs as $req)
{
$items[] = $req[... | php | {
"resource": ""
} |
q264137 | ArrayAccessIterator.getKey | test | public function getKey( $cursor )
{
$this->calculateKeyMap();
if( !array_key_exists( $cursor, $this->keyMap ) ) {
return null;
}
return $this->keyMap[ $cursor ];
} | php | {
"resource": ""
} |
q264138 | ArrayAccessIterator.rewind | test | public function rewind()
{
$this->cursor = 0;
$data = $this->collection->getArrayCopy();
reset( $data );
$this->collection->exchangeArray( $data );
return $this->current();
} | php | {
"resource": ""
} |
q264139 | Item.export | test | public function export()
{
$format_types = array();
foreach ($this->formats as $format)
{
$format_class_name = get_class($format);
if (in_array($format_class_name, $format_types))
throw new \RuntimeException('Multiple ' .
$forma... | php | {
"resource": ""
} |
q264140 | AbstractOptionTrait.setFromArray | test | public function setFromArray($options)
{
if ($options instanceof self) {
$options = $options->toArray();
}
if (!is_array($options) && !$options instanceof Traversable) {
throw new InvalidArgumentException(sprintf(
'Parameter provided to %s must be an... | php | {
"resource": ""
} |
q264141 | PccUtilities.pubcall | test | public function pubcall($uri, $auth_header, $items)
{
$uri .= '/publish/';
$content = array();
$content['items'] = $items;
$headers = array('Content-Type: application/json');
if (!is_null($auth_header))
$headers[] = 'Authorization: ' . $auth_header;
$resul... | php | {
"resource": ""
} |
q264142 | PccUtilities.make_http_request | test | public function make_http_request($uri, $headers, $content)
{
$post = curl_init($uri);
curl_setopt_array($post, array(
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => $headers,
CURLOPT_POSTFIELDS => json_encode($content)
... | php | {
"resource": ""
} |
q264143 | PubControlClient.publish | test | public function publish($channel, $item)
{
$export = $item->export();
$export['channel'] = $channel;
$uri = null;
$auth = null;
$uri = $this->uri;
$auth = $this->pcc_utilities->gen_auth_header($this->auth_jwt_claim,
$this->auth_jwt_key, $this->auth_bas... | php | {
"resource": ""
} |
q264144 | AbstractHttpAdapter.importHeaders | test | public function importHeaders(MessageInterface $from, $to)
{
foreach ($from->getHeaders() as $key => $headers) {
foreach ($headers as $header) {
$to->addHeader($key, $from->getHeaderLine($key));
}
}
} | php | {
"resource": ""
} |
q264145 | AbstractHttpAdapter.getProtocolVersion | test | public function getProtocolVersion()
{
if ($this->protocolVersion) {
return $this->protocolVersion;
}
$protocolAndVersion = $_SERVER['SERVER_PROTOCOL'];
list($protocol, $version) = explode('/', $protocolAndVersion);
return $version;
} | php | {
"resource": ""
} |
q264146 | HasValidator.valid | test | protected function valid(array $data, array $rules, array $messages = [], array $aliases = [])
{
// load translate.
$this->loadTranslate();
$this->validation = $this->getValidator()->make($data, $rules, $messages);
if (\count($aliases) > 0) {
$this->setAliases($aliases);... | php | {
"resource": ""
} |
q264147 | HasValidator.loadTranslate | test | protected function loadTranslate(): self
{
$this->getValidator()->setMessages($this->getTranslateLoader()->load($this->getValidatorLocal()));
return $this;
} | php | {
"resource": ""
} |
q264148 | HasValidator.setValidatorLocal | test | public function setValidatorLocal($local, $path = null): self
{
$this->validatorLocal = $local;
if (!empty($path)) {
$this->getTranslateLoader()->setPath($path);
}
return $this;
} | php | {
"resource": ""
} |
q264149 | HasValidator.getValidErrors | test | protected function getValidErrors($firstOfAll = false)
{
return $firstOfAll ? $this->getValidation()->errors()->firstOfAll() : $this->getValidation()->errors();
} | php | {
"resource": ""
} |
q264150 | PubControlClientCallbackHandler.update | test | public function update($num_calls, $callback)
{
$this->completed = false;
$this->num_calls = $num_calls;
$this->callback = $callback;
$this->success = true;
} | php | {
"resource": ""
} |
q264151 | RecordBeingEdited.getLockedMessage | test | public function getLockedMessage()
{
$editor = $this->Editor();
$editorString = $editor->getTitle();
if ($editor->Email) {
$editorString .= " <<a href='mailto:$editor->Email'>$editor->Email</a>>";
}
$message = sprintf(
_t('RecordBeingEdited.LOCKE... | php | {
"resource": ""
} |
q264152 | RecordBeingEdited.isEditingAnyway | test | public function isEditingAnyway()
{
if (!$this->canEditAnyway()) {
return false;
}
$sessionVar = 'EditAnyway_' . Member::currentUserID() . '_' . $this->ID;
if (Controller::curr()->getRequest()->getVar('editanyway') == '1') {
Session::set($sessionVar, true);
... | php | {
"resource": ""
} |
q264153 | ArrayAccess.offsetExists | test | public function offsetExists( $offset )
{
// Can not retrieve a key based on a value other than a string, integer or boolean
if( !is_string( $offset ) && !is_int( $offset ) && !is_bool( $offset ) ) {
return false;
}
return array_key_exists( $offset, $this->data );
} | php | {
"resource": ""
} |
q264154 | ArrayAccess.usort | test | public function usort( \Closure $callback )
{
usort( $this->data, $callback );
reset( $this->data );
return $this;
} | php | {
"resource": ""
} |
q264155 | Birthday.parse | test | protected function parse(): void
{
list('year' => $year, 'month' => $month, 'day' => $day) = self::validate($this->birthday);
$this->birthday = sprintf('%d-%02d-%02d', $year, $month, $day); // normalize the date
$this->age = self::calculateAge($year, $month, $day);
$this->constellati... | php | {
"resource": ""
} |
q264156 | Birthday.format | test | public function format($format = null): string
{
if (empty($format)) {
return $this->birthday;
}
return date($format, strtotime($this->birthday));
} | php | {
"resource": ""
} |
q264157 | Birthday.validate | test | public static function validate($birthday): array
{
$date = strtotime($birthday);
if ($date === false) {
throw new \InvalidArgumentException("Invalid birthday: $birthday");
}
$year = date('Y', $date);
$month = date('n', $date);
$day = date('j', $date);
... | php | {
"resource": ""
} |
q264158 | Birthday.parseConstellation | test | public static function parseConstellation($month, $day): string
{
switch ($month) {
case 1:
return $day >= 20 ? 'Aquarius' : 'Capricorn';
case 2:
return $day >= 19 ? 'Pisces' : 'Aquarius';
case 3:
return $day >= 21 ? 'Aries'... | php | {
"resource": ""
} |
q264159 | Birthday.translate | test | protected function translate($constellation, $lang = 'en'): string
{
$arr = $this->loadTranslation($lang);
return isset($arr[$constellation]) ? $arr[$constellation] : '';
} | php | {
"resource": ""
} |
q264160 | AuthorizationController.updateSucceed | test | public function updateSucceed()
{
$this->synchronizer->handle();
app('antares.memory')->make('component.default')->update();
$message = trans('antares/acl::response.acls.update');
return (app('request')->ajax()) ? Response::json(['message' => $message], 200) : $this->redirectWithMess... | php | {
"resource": ""
} |
q264161 | AuthorizationController.syncSucceed | test | public function syncSucceed(Fluent $acl)
{
$message = trans('antares/acl::response.acls.sync-roles', [
'name' => $acl->get('name'),
]);
return $this->redirectWithMessage(handles("antares::acl/acl?name={$acl->get('name')}"), $message);
} | php | {
"resource": ""
} |
q264162 | Breadcrumb.onList | test | public function onList()
{
$this->onInit();
Breadcrumbs::register('roles-list', function($breadcrumbs) {
$breadcrumbs->parent('staff');
$breadcrumbs->push(trans('antares/acl::title.breadcrumbs.groups'), handles('antares::acl/index/roles'));
});
view()->share('... | php | {
"resource": ""
} |
q264163 | Breadcrumb.onRoleCreateOrEdit | test | public function onRoleCreateOrEdit(Model $model = null)
{
$this->onList();
Breadcrumbs::register('edit-role', function($breadcrumbs) use($model) {
$breadcrumbs->parent('roles-list');
$exists = is_null($model) ? false : $model->exists;
$name = ($exists) ? 'Edit G... | php | {
"resource": ""
} |
q264164 | Breadcrumb.onUserCreateOrEdit | test | public function onUserCreateOrEdit(Model $model)
{
$this->onUsersList();
$name = $model->exists ? 'User Edit ' . $model->fullname : 'User Add';
Breadcrumbs::register('user', function($breadcrumbs) use($name) {
$breadcrumbs->parent('users-list');
$breadcrumbs->push($na... | php | {
"resource": ""
} |
q264165 | Breadcrumb.onAreaCreate | test | public function onAreaCreate()
{
$this->onAreasList();
Breadcrumbs::register('area-create', function($breadcrumbs) {
$breadcrumbs->parent('areas-list');
$breadcrumbs->push(trans('antares/acl::messages.area_add'), '#');
});
view()->share('breadcrumbs', Breadcru... | php | {
"resource": ""
} |
q264166 | User.form | test | public function form($model)
{
$this->breadcrumb->onUserCreateOrEdit($model);
return $this->form->of('antares.users', function (FormGrid $form) use ($model) {
$form->name('user.form');
$form->resource($this, 'antares::acl/index/users', $model);
... | php | {
"resource": ""
} |
q264167 | GroupsBreadcrumbMenu.handle | test | public function handle()
{
$acl = app('antares.acl')->make('antares/acl');
$canCreateRole = $acl->can('create-role');
if (!$canCreateRole) {
return;
}
$this->createMenu();
if ($canCreateRole) {
$this->handler
->ad... | php | {
"resource": ""
} |
q264168 | RepositoryTrait.findOneByOrGetNew | test | public function findOneByOrGetNew(array $criteria)
{
$object = $this->findOneBy($criteria);
if ($object === null) {
$object = $this->getNew();
}
return $object;
} | php | {
"resource": ""
} |
q264169 | RepositoryTrait.getNew | test | public function getNew()
{
$object = \call_user_func($this->getObjectFactory());
if (!$this->canBeManaged($object)) {
throw new \RuntimeException(
\sprintf(
'Object factory must return an instance of %s. "%s" returned',
$this->getC... | php | {
"resource": ""
} |
q264170 | RepositoryTrait.getObjectFactory | test | private function getObjectFactory(): callable
{
if ($this->objectFactory === null) {
$className = $this->getClassName();
$this->objectFactory = function () use ($className) {
return new $className();
};
}
return $this->objectFactory;
... | php | {
"resource": ""
} |
q264171 | RepositoryTrait.removeBy | test | public function removeBy(array $criteria, bool $flush = false)
{
$this->runManagerAction('remove', $this->findBy($criteria), $flush);
} | php | {
"resource": ""
} |
q264172 | RepositoryTrait.removeOneBy | test | public function removeOneBy(array $criteria, bool $flush = false)
{
$this->runManagerAction('remove', $this->findOneBy($criteria), $flush);
} | php | {
"resource": ""
} |
q264173 | RepositoryTrait.remove | test | public function remove($objects, bool $flush = false)
{
if (!\is_object($objects) && !is_iterable($objects)) {
$objects = $this->find($objects);
}
$this->runManagerAction('remove', $objects, $flush);
} | php | {
"resource": ""
} |
q264174 | RepositoryTrait.refresh | test | public function refresh($objects)
{
$backupAutoFlush = $this->autoFlush;
$this->autoFlush = false;
$this->runManagerAction('refresh', $objects, false);
$this->autoFlush = $backupAutoFlush;
} | php | {
"resource": ""
} |
q264175 | RepositoryTrait.detach | test | public function detach($objects)
{
$backupAutoFlush = $this->autoFlush;
$this->autoFlush = false;
$this->runManagerAction('detach', $objects, false);
$this->autoFlush = $backupAutoFlush;
} | php | {
"resource": ""
} |
q264176 | RepositoryTrait.getSupportedMethod | test | private function getSupportedMethod(string $method): string
{
foreach (static::$supportedMethods as $supportedMethod) {
if (\strpos($method, $supportedMethod) === 0) {
return $supportedMethod;
}
}
throw new \BadMethodCallException(\sprintf(
... | php | {
"resource": ""
} |
q264177 | RepositoryTrait.callSupportedMethod | test | protected function callSupportedMethod(string $method, string $fieldName, array $arguments)
{
$classMetadata = $this->getClassMetadata();
if (!$classMetadata->hasField($fieldName) && !$classMetadata->hasAssociation($fieldName)) {
throw new \BadMethodCallException(\sprintf(
... | php | {
"resource": ""
} |
q264178 | RepositoryTrait.runManagerAction | test | protected function runManagerAction(string $action, $objects, bool $flush)
{
$manager = $this->getManager();
if (!is_iterable($objects)) {
$objects = \array_filter([$objects]);
}
foreach ($objects as $object) {
if (!$this->canBeManaged($object)) {
... | php | {
"resource": ""
} |
q264179 | RepositoryTrait.flushObjects | test | protected function flushObjects(array $objects, bool $flush)
{
if ($flush || $this->autoFlush) {
$this->getManager()->flush($objects);
}
} | php | {
"resource": ""
} |
q264180 | Collection.prepareTagFromBits | test | protected function prepareTagFromBits($additional_identifier, $visitor_identifier, $hash)
{
return implode(',', [$this->getApplicationIdentifier(), 'collection', get_class($this), $additional_identifier, $visitor_identifier, $hash]);
} | php | {
"resource": ""
} |
q264181 | Collection.& | test | public function &pagination($current_page = 1, $items_per_page = 100)
{
$this->is_paginated = true;
$this->currentPage($current_page);
$this->items_per_page = (int) $items_per_page;
if ($this->items_per_page < 1) {
$this->items_per_page = 100;
}
return... | php | {
"resource": ""
} |
q264182 | Collection.& | test | public function ¤tPage($value)
{
if (!$this->is_paginated) {
throw new LogicException('Page can be set only for paginated collections');
}
$this->current_page = (int) $value;
if ($this->current_page < 1) {
$this->current_page = 1;
}
re... | php | {
"resource": ""
} |
q264183 | PermissionController.update | test | public function update(PermissionRequest $request, $id)
{
$this->authorize('edit_permission');
$permission = Permissions::where('id', $id)->firstOrFail();
$permission->update($request->all());
$request->session()->flash('message', 'Permission Updated Successfully');
return re... | php | {
"resource": ""
} |
q264184 | PaginatorTrait.getPaginator | test | protected function getPaginator(AdapterInterface $adapter, int $itemsPerPage): Paginator
{
$paginator = new Paginator($adapter);
$paginator->setItemCountPerPage(max(-1, $itemsPerPage));
return $paginator;
} | php | {
"resource": ""
} |
q264185 | PaginatorTrait.findPaginatedByOrFail | test | public function findPaginatedByOrFail(array $criteria, array $orderBy = null, int $itemsPerPage = 10): Paginator
{
$paginator = $this->findPaginatedBy($criteria, $orderBy, $itemsPerPage);
if ($paginator->count() === 0) {
throw new FindException('FindPaginatedBy did not return any result... | php | {
"resource": ""
} |
q264186 | AclServiceProvider.bootExtensionComponents | test | protected function bootExtensionComponents()
{
$path = __DIR__ . '/../resources';
$this->addConfigComponent('antares/acl', 'antares/acl', "{$path}/config");
$this->addLanguageComponent('antares/acl', 'antares/acl', "{$path}/lang");
$this->addViewComponent('antares/acl', 'antares/acl'... | php | {
"resource": ""
} |
q264187 | AclServiceProvider.bootMemory | test | protected function bootMemory()
{
$this->app->make('antares.acl')->make($this->routeGroup)->attach(
$this->app->make('antares.platform.memory')
);
} | php | {
"resource": ""
} |
q264188 | RoleManagerProvider._loadParts | test | private function _loadParts()
{
$this->loadRoutesFrom(__DIR__ . '/routes.php');
$this->loadMigrationsFrom(__DIR__ . '/migrations');
$this->loadTranslationsFrom(__DIR__ . '/translations', 'RoleManager');
$this->loadViewsFrom(__DIR__ . '/views', 'RoleManager');
} | php | {
"resource": ""
} |
q264189 | RoleManagerProvider._extendedValidation | test | private function _extendedValidation()
{
Validator::extend(
'classExist', function ($attribute, $value, $parameters, $validator) {
if (empty($value)) {
return true;
}
return class_exists($value);
}
);
... | php | {
"resource": ""
} |
q264190 | Magniloquent.save | test | public function save(array $new_attributes = array(), $forceSave = false)
{
$options = array();
if (array_key_exists('touch', $new_attributes))
{
$options['touch'] = $new_attributes['touch'];
$new_attributes = array_except($new_attributes, array('touch'));
}
... | php | {
"resource": ""
} |
q264191 | Magniloquent.validate | test | public function validate()
{
// Merge the rules arrays into one array
$this->mergeRules();
// Exclude this object from unique checks if object exists
if ($this->exists)
{
$this->excludeFromUniqueChecks();
}
$validation = Validator::make($this->at... | php | {
"resource": ""
} |
q264192 | Magniloquent.mergeRules | test | protected function mergeRules()
{
$rules = static::$rules;
$output = array();
if ($this->exists)
$merged = array_merge_recursive($rules['save'], $rules['update']);
else
$merged = array_merge_recursive($rules['save'], $rules['create']);
foreach ($merg... | php | {
"resource": ""
} |
q264193 | Magniloquent.purgeUnneeded | test | private function purgeUnneeded()
{
$clean = array();
foreach ($this->attributes as $key => $value)
{
if (! Str::endsWith($key, '_confirmation') && ! Str::startsWith($key, '_') && ! in_array($key, static::$purgeable))
$clean[$key] = $value;
}
$this-... | php | {
"resource": ""
} |
q264194 | Magniloquent.autoHash | test | private function autoHash()
{
$attributes = array_merge(static::$needsHash, array('password'));
foreach ($attributes as $name) {
if (isset($this->attributes[$name]) && $this->isDirty($name))
{
if ( ! Hash::check($this->attributes[$name], $this->getOriginal($... | php | {
"resource": ""
} |
q264195 | FiltersTrait.disableFilters | test | public function disableFilters()
{
foreach (\array_keys($this->getFilterCollection()->getEnabledFilters()) as $filter) {
$this->disableFilter($filter);
}
} | php | {
"resource": ""
} |
q264196 | FiltersTrait.disableFilter | test | public function disableFilter(string $filter)
{
if (\in_array($filter, $this->disabledFilters, true)) {
return;
}
$this->getFilterCollection()->disable($filter);
$this->disabledFilters[] = $filter;
} | php | {
"resource": ""
} |
q264197 | FiltersTrait.restoreFilters | test | public function restoreFilters()
{
$filterCollection = $this->getFilterCollection();
foreach ($this->disabledFilters as $filter) {
$filterCollection->enable($filter);
}
$this->disabledFilters = [];
} | php | {
"resource": ""
} |
q264198 | FiltersTrait.restoreFilter | test | public function restoreFilter(string $filter)
{
$position = \array_search($filter, $this->disabledFilters, true);
if ($position === false) {
return;
}
$this->getFilterCollection()->enable($filter);
\array_splice($this->disabledFilters, $position, 1);
} | php | {
"resource": ""
} |
q264199 | Roles.getActionsColumn | test | protected function getActionsColumn($roleId, $canEditRole, $canDeleteRole)
{
return function ($row) use($roleId, $canEditRole, $canDeleteRole) {
$btns = [];
$html = app('html');
if ($canEditRole) {
array_push($btns, $html->create('li', $html->link(handle... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.