_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q29700 | TwigTemplateWriter.writeTemplate | train | public function writeTemplate($dir)
{
// Writes down the file
$fileDir = $dir . '/' . $this->language->getLanguageName() . $this->baseFolder;
if (!is_dir($fileDir)) {
mkdir($fileDir);
}
return @file_put_contents($fileDir . '/' . $this->fileName . '.html.twig', $t... | php | {
"resource": ""
} |
q29701 | Command.verboseIfFileExists | train | protected function verboseIfFileExists(ConsoleIo $io, $path)
{
if (!file_exists($path)) {
return false;
}
$io->verbose(__d('me_tools', 'File or directory `{0}` already exists', rtr($path)));
return true;
} | php | {
"resource": ""
} |
q29702 | Command.createLink | train | public function createLink(ConsoleIo $io, $source, $dest)
{
if ($this->verboseIfFileExists($io, $dest)) {
return false;
}
//Checks if the source is readable and the destination directory is writable
try {
is_readable_or_fail($source);
is_writable_... | php | {
"resource": ""
} |
q29703 | Command.folderChmod | train | public function folderChmod(ConsoleIo $io, $path, $chmod = 0777)
{
if (!(new Folder())->chmod($path, $chmod, true)) {
$io->error(__d('me_tools', 'Failed to set permissions on `{0}`', rtr($path)));
return false;
}
$io->verbose(__d('me_tools', 'Setted permissions on `... | php | {
"resource": ""
} |
q29704 | CssParserFilterClass._isClassInList | train | private function _isClassInList($class, $classes)
{
$items = explode(" ", trim($classes));
if (count($items) > 0) {
foreach ($items as $item) {
if (strcasecmp($class, trim($item)) == 0) {
return true;
}
}
}
r... | php | {
"resource": ""
} |
q29705 | MustAuthenticateUser.loginWithEmail | train | public function loginWithEmail(Request $request)
{
$request->rules = [
'email' => 'required'
];
$request->validate();
$provider = $this->provider;
$info = MagicLink::notify($request, $provider, $this->musk());
$this->sendMagicLinkNotification($info['email'], $info['token']);
$thi... | php | {
"resource": ""
} |
q29706 | MustAuthenticateUser.loginEmailCallback | train | public function loginEmailCallback()
{
if (Get::has('token')) {
$provider = $this->provider;
$varified = MagicLink::verify(Get::key('token'), $provider, $this->musk());
if (isset($varified->id)) {
if (Auth::provider($provider)->login($varified)->status == 'success') {
return ... | php | {
"resource": ""
} |
q29707 | MustAuthenticateUser.login | train | public function login(Request $request)
{
$hidden = $this->hidden;
$request->rules = $this->rules();
$provider = $this->provider;
$user = $request->validate(function($response) use ($request, $hidden, $provider) {
return Auth::attempt($request->all(), $hidden, $provider);
});
if (Auth:... | php | {
"resource": ""
} |
q29708 | Route.buildRegexp | train | protected function buildRegexp($pattern, array $matches)
{
$src = [];
$trg = [];
foreach ($matches as $match) {
list($key, $regexp) = $this->splitSegment($match[3]);
if (in_array(substr($regexp, -1), ['+', '*', '?'])) {
throw new RouteException('Route... | php | {
"resource": ""
} |
q29709 | Route.buildRequirements | train | protected function buildRequirements(array $matches)
{
$result = [];
foreach ($matches as $match) {
list($key, $regexp) = $this->splitSegment($match[3]);
$result[$key] = $regexp . ($match[1] == '(' ? '*' : '+');
}
return $result;
} | php | {
"resource": ""
} |
q29710 | Route.buildBuilders | train | protected function buildBuilders($pattern, array $matches)
{
$result = [
'pattern' => $pattern,
'segments' => []
];
foreach ($matches as $match) {
list($key,) = $this->splitSegment($match[3]);
$result['pattern'] = str_replace($match[0], '{' . ... | php | {
"resource": ""
} |
q29711 | Route.arguments | train | public function arguments(array $arguments = [])
{
if (empty($arguments)) {
return $this->arguments;
}
foreach ($arguments as $key => $value) {
if (!isset($this->requirements[$key])) {
$this->arguments[$key] = $value;
continue;
... | php | {
"resource": ""
} |
q29712 | Route.host | train | public function host($host = null)
{
$this->host = empty($host) ? null : $host;
return $this->host;
} | php | {
"resource": ""
} |
q29713 | Route.schema | train | public function schema($schema = null)
{
$this->schema = empty($schema) ? null : $schema;
return $this->schema;
} | php | {
"resource": ""
} |
q29714 | Route.match | train | public function match(RequestInterface $request)
{
return (
$this->matchSchema($request->schema()) &&
$this->matchMethods($request->method()) &&
$this->matchHost($request->host()) &&
$this->matchPath($request->path())
);
} | php | {
"resource": ""
} |
q29715 | Route.matchSchema | train | protected function matchSchema($schema)
{
if (empty($this->schema)) {
return true;
}
if (strpos($schema, $this->schema) !== false) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q29716 | Route.matchMethods | train | protected function matchMethods($method)
{
if (empty($this->methods)) {
return true;
}
if (in_array($method, $this->methods)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q29717 | Route.matchHost | train | protected function matchHost($host)
{
if (empty($this->host)) {
return true;
}
$host = preg_replace('/^[^:]+:\/\//i', '', $host);
$regex = str_replace('\{basename\}', '.*', preg_quote($this->host));
return preg_match('/^' . $regex . '$/i', $host);
} | php | {
"resource": ""
} |
q29718 | Route.matchPath | train | protected function matchPath($path)
{
if (!preg_match_all($this->regex, $path, $matches, \PREG_SET_ORDER)) {
return false;
}
foreach ($matches[0] as $k => $v) {
if (is_numeric($k)) {
continue;
}
$this->arguments[$k] = $v;
... | php | {
"resource": ""
} |
q29719 | Route.check | train | public function check($controller, array $arguments = [])
{
if ($this->controller !== $controller) {
return false;
}
foreach ($this->requirements as $key => $regex) {
$value = isset($arguments[$key]) ? $arguments[$key] : null;
if (!preg_match('/^' . $reg... | php | {
"resource": ""
} |
q29720 | Route.make | train | public function make($host, array $arguments = [])
{
return $host === null ? $this->makeRelative($arguments) : $this->makeAbsolute($host, $arguments);
} | php | {
"resource": ""
} |
q29721 | Route.makeAbsolute | train | protected function makeAbsolute($host, array $arguments = [])
{
list($schema, $host) = $this->resolveHost($host);
$url = $this->buildUrl($arguments);
$regex = '/^' . str_replace('\{basename\}', '.*', preg_quote($this->host)) . '$/';
if ($this->host && !preg_match($regex, $host)) {
... | php | {
"resource": ""
} |
q29722 | Route.resolveHost | train | protected function resolveHost($host)
{
if (strpos($host, '://') !== false) {
list($schema, $host) = explode('://', $host, 2);
}
if ($this->schema) {
$schema = $this->schema;
}
if (empty($schema)) {
$schema = 'http';
}
re... | php | {
"resource": ""
} |
q29723 | Route.buildUrl | train | protected function buildUrl(array $arguments)
{
$url = strtr($this->builders['pattern'], $this->buildUrlRequirements($arguments));
$url = str_replace('//', '/', $url);
$query = array_filter($arguments);
if (!empty($query)) {
$url .= '?' . http_build_query($query, null, '... | php | {
"resource": ""
} |
q29724 | Route.buildUrlRequirements | train | protected function buildUrlRequirements(array &$arguments)
{
$url = [];
foreach ($this->requirements as $key => $regex) {
$this->assertArgumentRequirement($key, $regex, $arguments);
if (array_key_exists($key, $arguments) && isset($this->builders['segments']['{' . $key . '}']... | php | {
"resource": ""
} |
q29725 | Route.assertArgumentRequirement | train | protected function assertArgumentRequirement($key, $regex, $arguments)
{
if (substr($regex, -1) === '+' && !array_key_exists($key, $arguments)) {
throw new RouteException(sprintf('Missing value for argument "%s" in route "%s"', $key, $this->pattern));
}
} | php | {
"resource": ""
} |
q29726 | Route.assertArgumentValue | train | protected function assertArgumentValue($key, $regex, $value)
{
if (!preg_match('/^' . $regex . '$/i', $value)) {
throw new RouteException(sprintf('Invalid value for argument "%s" in route "%s", got "%s" need "/^%s\$/"', $key, $this->pattern, $value, $regex));
}
} | php | {
"resource": ""
} |
q29727 | Route.strip | train | protected function strip($urlString, $separator = '-')
{
if (is_numeric($urlString)) {
return $urlString;
}
$urlString = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $urlString);
$urlString = preg_replace('#[^\w \-\.]+#i', null, $urlString);
$urlString = preg_replac... | php | {
"resource": ""
} |
q29728 | Response.make | train | public static function make(Upstart $app)
{
/**
* Get application response
*/
$response = $app->getResponse();
/**
* Convert to array
*/
if (method_exists($response, 'toArray')) {
$response = $response->toArray();
}
/**
* Create a rest response
*/
if (... | php | {
"resource": ""
} |
q29729 | Router.matchCommand | train | public function matchCommand(Args $args)
{
$this->args = $args;
return $this->getTarget($args->getCommand());
} | php | {
"resource": ""
} |
q29730 | Router.getTarget | train | public function getTarget($command)
{
if (empty($this->routes[$command])) {
return null;
}
/* @var $route Route */
$route = $this->routes[$command];
return $route->getTarget($this->args);
} | php | {
"resource": ""
} |
q29731 | CssParserFilterPseudoFactory.getInstance | train | public static function getInstance(
$classname, $input = "", $userDefFunction = null
) {
$fullname = "soloproyectos\\css\\parser\\filter\\"
. $classname;
return new $fullname($input, $userDefFunction);
} | php | {
"resource": ""
} |
q29732 | Action.actionExists | train | public function actionExists($id)
{
$inlineActionMethodName = 'action' . Inflector::camelize($id);
if (method_exists($this->controller, $inlineActionMethodName)) {
return true;
}
if (array_key_exists($id, $this->controller->actions())) {
return true;
}... | php | {
"resource": ""
} |
q29733 | Action.setReturnAction | train | public function setReturnAction($actionId = null)
{
if ($actionId === null) {
$actionId = $this->id;
}
if (strpos($actionId, '/') === false) {
$actionId = $this->controller->getUniqueId() . '/' . $actionId;
}
$sessionKey = '__adminReturnAction';
... | php | {
"resource": ""
} |
q29734 | Action.getReturnAction | train | public function getReturnAction($defaultActionId = 'index')
{
if ($this->returnAction !== null) {
return $this->returnAction;
}
$sessionKey = '__adminReturnAction';
$actionId = Yii::$app->getSession()->get($sessionKey, $defaultActionId);
$actionId = trim($actionI... | php | {
"resource": ""
} |
q29735 | SlotRendererExtension.renderSlot | train | public function renderSlot($slotName = null, $extraAttributes = "")
{
$this->checkSlotName($slotName);
try {
$slotContents = array();
$pageTree = $this->container->get('red_kite_cms.page_tree');
$blockManagers = $pageTree->getBlockManagers($slotName);
... | php | {
"resource": ""
} |
q29736 | SlotRendererExtension.renderBlock | train | public function renderBlock(BlockManager $blockManager, $template = null, $included = false, $extraAttributes = '', array $extraOptions = null)
{
try {
$block = $blockManager->toArray();
if (empty($block)) {
return "";
}
$templating = $this->c... | php | {
"resource": ""
} |
q29737 | SlotRendererExtension.blockContentToHtml | train | public function blockContentToHtml($content, array $extraOptions = null)
{
$result = $content;
if (is_array($content)) {
$result = "";
if (\array_key_exists('RenderView', $content)) {
if (null !== $extraOptions) {
$content['RenderView']['op... | php | {
"resource": ""
} |
q29738 | Filesystem.guessMimeTypeFromFilename | train | public static function guessMimeTypeFromFilename(string $file, string $default = self::MIMETYPE_DEFAULT): string
{
$file = \strtolower($file);
if (($pos = \strrpos($file, '.')) !== false) {
$file = \substr($file, $pos + 1);
}
if (\array_key_exists($file,... | php | {
"resource": ""
} |
q29739 | Filesystem.suggestExtensionByMediaType | train | public static function suggestExtensionByMediaType(string $mediaType): string
{
if (false !== ($ext = \array_search(\strtolower($mediaType), self::$mimeTypes))) {
return $ext;
}
if (\func_num_args() > 1) {
return (string) \func_get_arg(1);
}
... | php | {
"resource": ""
} |
q29740 | Filesystem.readFile | train | public static function readFile(string $file): string
{
$contents = @\file_get_contents($file);
if ($contents === false) {
throw new \RuntimeException(\sprintf('File not found: "%s"', $file));
}
return $contents;
} | php | {
"resource": ""
} |
q29741 | Filesystem.changePermissions | train | public static function changePermissions(string $file, int $permissions)
{
if (!\is_file($file)) {
throw new \InvalidArgumentException(\sprintf('No such file found: "%s"', $file));
}
if (DIRECTORY_SEPARATOR == '\\') {
return $file;
}
... | php | {
"resource": ""
} |
q29742 | Filesystem.touchFile | train | public static function touchFile(string $file, int $permissions = 0777): string
{
self::createDirectory(\dirname($file));
if (!@\touch($file)) {
throw new \RuntimeException(\sprintf('Unable to touch file "%s"%s', $file, self::getErrorInfo()));
}
self::ch... | php | {
"resource": ""
} |
q29743 | Filesystem.writeFile | train | public static function writeFile(string $file, string $contents, int $permissions = 0777): string
{
self::createDirectory(\dirname($file));
$tempFile = \tempnam(\sys_get_temp_dir(), self::TEMP_FILE_PREFIX);
\file_put_contents($tempFile, $contents);
if (\DIR... | php | {
"resource": ""
} |
q29744 | Filesystem.removeFile | train | public static function removeFile(string $file): void
{
if (\is_file($file)) {
if (!@\unlink($file)) {
throw new \RuntimeException(\sprintf('Unable to delete file "%s"%s', $file, self::getErrorInfo()));
}
}
\clearstatcache(true, $file);
} | php | {
"resource": ""
} |
q29745 | GridFieldBulkDeleteForm.getFilteredRecordList | train | public function getFilteredRecordList($gridfield)
{
$list = $gridfield->getList();
foreach ($gridfield->getComponents() as $item) {
if ($item instanceof GridField_DataManipulator && !$item instanceof GridFieldPaginator) {
$list = $item->getManipulatedData($gridfield, $li... | php | {
"resource": ""
} |
q29746 | ImageThumbnailer.create | train | public function create($image, $thumbnailWidth = 100, $thumbnailHeight = 100)
{
$this->setupTargetPath($image);
$this->setupTargetImage($image);
$this->transformation->thumbnail(new Image\Box($thumbnailWidth, $thumbnailHeight))
->apply($this->imagine->open($imag... | php | {
"resource": ""
} |
q29747 | ImageThumbnailer.setupTargetPath | train | protected function setupTargetPath($image)
{
$this->thumbnailPath = dirname($image) . '/' . $this->thumbnailsFolder . '/';
if (!is_dir($this->thumbnailPath)) {
$filesystem = new Filesystem();
$filesystem->mkdir($this->thumbnailPath);
}
} | php | {
"resource": ""
} |
q29748 | View.translate | train | protected function translate($name)
{
preg_match_all('/^(?P<bundle>[^:]+):(?P<directory>[^:]*:)?(?P<file>.+)$/', $name, $matches, \PREG_SET_ORDER);
foreach (['bundle', 'file'] as $offset) {
if (empty($matches[0][$offset])) {
throw new ViewException(sprintf('Invalid or mi... | php | {
"resource": ""
} |
q29749 | RecordsActivity.bootRecordsActivity | train | protected static function bootRecordsActivity()
{
foreach (static::getModelEvents() as $event)
{
static::$event(function ($model) use ($event)
{
$model->recordActivity($event);
});
}
if (static::deleteActivityOnCascade())
{... | php | {
"resource": ""
} |
q29750 | RecordsActivity.recordActivity | train | public function recordActivity($event)
{
return chronicle()->record(
$this,
$this->getActivityName($event),
$this->getUserId()
);
} | php | {
"resource": ""
} |
q29751 | RecordsActivity.getUserId | train | protected function getUserId()
{
if (property_exists($this, 'userKey'))
{
$userKey = $this->userKey;
return $this->$userKey;
}
if ( ! is_null($this->user_id))
{
return $this->user_id;
}
return null;
} | php | {
"resource": ""
} |
q29752 | DeclarativeProps.withProps | train | protected function withProps($model, array $props): array
{
if (!(\is_array($model) || $model instanceof \ArrayAccess)) {
throw new \InvalidArgumentException('Expect array or object implementing \ArrayAccess');
}
// Given an array of props (which may include a definition value),... | php | {
"resource": ""
} |
q29753 | DeclarativeProps.convertTimeZone | train | protected function convertTimeZone(DateTimeInterface $date, $timezone)
{
$timezone = ($timezone instanceof DateTimeZone) ? $timezone : new DateTimeZone($timezone);
if ($date->getTimezone() !== $timezone) {
if ($date instanceof DateTime) {
// DateTime is not immutable, so... | php | {
"resource": ""
} |
q29754 | DeclarativeProps.formatDatetime | train | protected function formatDatetime(DateTimeInterface $date, PropDefinition $definition): string
{
$timezone = $definition->get('timezone', $this->getDefaultTimezone());
if ($timezone !== null) {
$date = $this->convertTimeZone($date, $timezone);
}
return $date->format($def... | php | {
"resource": ""
} |
q29755 | DeclarativeProps.formatDatetimeUtc | train | protected function formatDatetimeUtc(DateTimeInterface $date, PropDefinition $propDefinition): string
{
return $this->formatDatetime($date, $propDefinition->set('timezone', 'UTC'));
} | php | {
"resource": ""
} |
q29756 | FilterSubscriber.onPostRender | train | public function onPostRender(FilterPostRenderEvent $event): void
{
foreach ($this->registry->getTemplateFilters() as $filter) {
if (null !== ($mailRendered = $event->getMailRendered())
&& $filter->supports($mailRendered)) {
$filter->filter($mailRendered);
... | php | {
"resource": ""
} |
q29757 | FilterSubscriber.onPreSend | train | public function onPreSend(FilterPreSendEvent $event): void
{
foreach ($this->registry->getTransportFilters() as $filter) {
if ($filter->supports($event->getTransport(), $event->getMessage(), $event->getMailRendered())) {
$filter->filter($event->getTransport(), $event->getMessage(... | php | {
"resource": ""
} |
q29758 | PHPStreamTransport.guessError | train | protected function guessError($err, $uri, $method) {
$regex = '/HTTP\/1\.[01]? ([0-9]+) ([ a-zA-Z]+)/';
$matches = array();
preg_match($regex, $err, $matches);
if (count($matches) < 3) {
throw new \HPCloud\Exception($err);
}
Response::failure($matches[1], $matches[0], $uri, $method);
... | php | {
"resource": ""
} |
q29759 | PHPStreamTransport.smashHeaders | train | protected function smashHeaders($headers) {
if (empty($headers)) {
return;
}
$buffer = array();
foreach ($headers as $name => $value) {
// $buffer[] = sprintf("%s: %s", $name, urlencode($value));
$buffer[] = sprintf("%s: %s", $name, $value);
}
$headerStr = implode("\r\n", $bu... | php | {
"resource": ""
} |
q29760 | PHPStreamTransport.buildStreamContext | train | protected function buildStreamContext($method, $headers, $body) {
// Construct the stream options.
$headers['Connection'] = 'close';
$config = array(
'http' => array(
'protocol_version' => $this->httpVersion,
'method' => strtoupper($method),
'header' => $this->smashHeaders($hea... | php | {
"resource": ""
} |
q29761 | Utf8.normalize | train | public static function normalize($string, $canonicalForm = self::NORMALIZE_NFC)
{
if (static::$supportNormalizer) {
return \Normalizer::normalize($string, $canonicalForm);
}
return $string;
} | php | {
"resource": ""
} |
q29762 | RedirectsUsers.getDesiredUrl | train | public function getDesiredUrl(?string $url = null)
{
if (isset($_GET['url'])) {
$url = $_GET['url'] . (count($_GET) > 0 ? '?' : '');
unset($_GET['url']);
foreach ($_GET as $key => $value) {
$url .= (ends_with($url, '?') ? '' : '&') . $key . '=' . $value;
}
}
if ($url != n... | php | {
"resource": ""
} |
q29763 | BaseFileStream.openHandle | train | protected function openHandle()
{
$fileName = $this->getFileName();
$this->_handle = fopen($fileName, 'w');
if (!$this->_handle) {
throw new \Exception('Cannot open file ' . $fileName);
}
} | php | {
"resource": ""
} |
q29764 | BaseFileStream.write | train | public function write($string)
{
$fileName = $this->getFileName();
$handle = $this->getHandle();
if (fwrite($handle, $string) === false) {
throw new \Exception('Cannot write to file ' . $fileName);
}
} | php | {
"resource": ""
} |
q29765 | BaseFileStream.closeHandle | train | protected function closeHandle()
{
$handle = $this->getHandle();
fclose($handle);
$this->_handle = false;
$this->runCommand($this->getFileName());
} | php | {
"resource": ""
} |
q29766 | ControlPacket.readString | train | public static function readString(&$buffer)
{
$tmp = unpack('n', $buffer);
$length = array_pop($tmp);
if ($length + 2 > strlen($buffer)) {
throw new \RuntimeException("buffer:".bin2hex($buffer)." lenth:$length not enough for unpackString");
}
$string = substr($bu... | php | {
"resource": ""
} |
q29767 | ControlPacket.readShortInt | train | public static function readShortInt(&$buffer)
{
$tmp = unpack('n', $buffer);
$buffer = substr($buffer, 2);
return array_pop($tmp);
} | php | {
"resource": ""
} |
q29768 | IdBrokerClient.authenticateNewUser | train | public function authenticateNewUser(string $invite)
{
$result = $this->authenticateNewUserInternal([
'invite' => $invite,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
... | php | {
"resource": ""
} |
q29769 | IdBrokerClient.createUser | train | public function createUser(array $config = [ ])
{
$result = $this->createUserInternal($config);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->reportUnexpe... | php | {
"resource": ""
} |
q29770 | IdBrokerClient.deactivateUser | train | public function deactivateUser(string $employeeId)
{
$result = $this->deactivateUserInternal([
'employee_id' => $employeeId,
'active' => 'no',
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode !== 200) {
$this->reportUnexpect... | php | {
"resource": ""
} |
q29771 | IdBrokerClient.getUser | train | public function getUser(string $employeeId)
{
$result = $this->getUserInternal([
'employee_id' => $employeeId,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
... | php | {
"resource": ""
} |
q29772 | IdBrokerClient.mfaCreate | train | public function mfaCreate($employee_id, $type, $label = null)
{
$result = $this->mfaCreateInternal([
'employee_id' => $employee_id,
'type' => $type,
'label' => $label,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
... | php | {
"resource": ""
} |
q29773 | IdBrokerClient.mfaDelete | train | public function mfaDelete($id, $employeeId)
{
$result = $this->mfaDeleteInternal([
'id' => $id,
'employee_id' => $employeeId,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 204) {
return null;
}
$this->reportU... | php | {
"resource": ""
} |
q29774 | IdBrokerClient.mfaList | train | public function mfaList($employee_id)
{
$result = $this->mfaListInternal([
'employee_id' => $employee_id,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$... | php | {
"resource": ""
} |
q29775 | IdBrokerClient.mfaUpdate | train | public function mfaUpdate($id, $employeeId, $label)
{
$result = $this->mfaUpdateInternal([
'id' => $id,
'employee_id' => $employeeId,
'label' => $label,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return ... | php | {
"resource": ""
} |
q29776 | IdBrokerClient.mfaVerify | train | public function mfaVerify($id, $employeeId, $value)
{
$result = $this->mfaVerifyInternal([
'id' => $id,
'employee_id' => $employeeId,
'value' => $value,
]);
$statusCode = (int)$result[ 'statusCode' ];
/*
* Accept a 204 for compatibility w... | php | {
"resource": ""
} |
q29777 | IdBrokerClient.createMethod | train | public function createMethod($employee_id, $value, $created = '')
{
$params = compact('employee_id', 'value');
if (! empty($created)) {
$params['created'] = $created;
}
$result = $this->createMethodInternal($params);
$statusCode = (int)$result[ 'statusCode' ];
... | php | {
"resource": ""
} |
q29778 | IdBrokerClient.deleteMethod | train | public function deleteMethod($uid, $employee_id)
{
$result = $this->deleteMethodInternal(compact('uid', 'employee_id'));
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 204 || $statusCode === 200) {
return null;
}
$this->reportUnexpectedResponse(... | php | {
"resource": ""
} |
q29779 | IdBrokerClient.getMethod | train | public function getMethod($uid, $employee_id)
{
$result = $this->getMethodInternal(compact('uid', 'employee_id'));
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->reportUne... | php | {
"resource": ""
} |
q29780 | IdBrokerClient.listMethod | train | public function listMethod($employee_id)
{
$result = $this->listMethodInternal(compact('employee_id'));
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->reportUnexpectedResp... | php | {
"resource": ""
} |
q29781 | IdBrokerClient.verifyMethod | train | public function verifyMethod($uid, $employee_id, $code)
{
$result = $this->verifyMethodInternal(compact('uid', 'employee_id', 'code'));
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
... | php | {
"resource": ""
} |
q29782 | IdBrokerClient.resendMethod | train | public function resendMethod($uid, $employee_id)
{
$result = $this->resendMethodInternal(compact('uid', 'employee_id'));
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 204 || $statusCode === 200) {
return true;
}
$this->reportUnexpectedResponse(... | php | {
"resource": ""
} |
q29783 | IdBrokerClient.setPassword | train | public function setPassword(string $employeeId, string $password)
{
$result = $this->setPasswordInternal([
'employee_id' => $employeeId,
'password' => $password,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $th... | php | {
"resource": ""
} |
q29784 | IdBrokerClient.assessPassword | train | public function assessPassword(string $employeeId, string $password)
{
$result = $this->assessPasswordInternal([
'employee_id' => $employeeId,
'password' => $password,
]);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode >= 200 && $statusCode <= 29... | php | {
"resource": ""
} |
q29785 | IdBrokerClient.updateUser | train | public function updateUser(array $config = [ ])
{
$result = $this->updateUserInternal($config);
$statusCode = (int)$result[ 'statusCode' ];
if ($statusCode === 200) {
return $this->getResultAsArrayWithoutStatusCode($result);
}
$this->reportUnexpe... | php | {
"resource": ""
} |
q29786 | IdBrokerClient.assertTrustedBrokerIp | train | private function assertTrustedBrokerIp()
{
$baseHost = parse_url($this->idBrokerUri, PHP_URL_HOST);
$idBrokerIp = gethostbyname(
$baseHost
);
if (! $this->isTrustedIpAddress($idBrokerIp)) {
throw new Exception(
'The Id Broker has an IP that is... | php | {
"resource": ""
} |
q29787 | LinkObserver.initializeProductLink | train | protected function initializeProductLink(array $attr)
{
// load the product/linked product/link type ID
$productId = $attr[MemberNames::PRODUCT_ID];
$linkTypeId = $attr[MemberNames::LINK_TYPE_ID];
$linkedProductId = $attr[MemberNames::LINKED_PRODUCT_ID];
// try to load the ... | php | {
"resource": ""
} |
q29788 | Parser.parse | train | public function parse(string $input): Type
{
$this->lexer->setInput($input);
$this->lexer->moveNext();
return $this->parseInternal();
} | php | {
"resource": ""
} |
q29789 | Parser.match | train | private function match(int $type)
{
if (! $this->lexer->isNextToken($type)) {
$this->syntaxError();
}
$value = $this->lexer->lookahead['value'];
$this->lexer->moveNext();
return $value;
} | php | {
"resource": ""
} |
q29790 | Parser.parseInternal | train | private function parseInternal(): Type
{
$typeName = $this->match(Lexer::T_IDENTIFIER);
if (! $this->lexer->isNextToken(Lexer::T_OPEN_BRACKET)) {
return new Type($typeName);
}
$this->match(Lexer::T_OPEN_BRACKET);
$params = [];
do {
if ($this-... | php | {
"resource": ""
} |
q29791 | Parser.syntaxError | train | private function syntaxError(): void
{
throw new SyntaxErrorException(
$this->lexer->getInputUntilPosition(PHP_INT_MAX),
$this->lexer->lookahead['value'] ?: 'end of string',
(int) $this->lexer->lookahead['position']
);
} | php | {
"resource": ""
} |
q29792 | JobRunner.getInstance | train | public static function getInstance($id = null, $phpExecutable = 'php', $tmpPath = 'tmp/')
{
if (is_null(self::$_instance)) {
self::$_phpExecutable = $phpExecutable;
self::$_tmpPath = $tmpPath;
$jobRunner = new JobRunner($id);
self::$_instance = $jobRunner;
... | php | {
"resource": ""
} |
q29793 | JobRunner._getJobDirectory | train | protected function _getJobDirectory(Job $job)
{
$jobDir = $this->getDirectory() . DIRECTORY_SEPARATOR . $job->getId();
$this->_prepareDirectory($jobDir);
return $jobDir;
} | php | {
"resource": ""
} |
q29794 | JobRunner.start | train | public function start(Job $job)
{
$jobData = new JobData();
if ($this->exec) {
$jobDir = $this->_getJobDirectory($job);
$logFile = realpath($this->getDirectory()) . '/run.log';
$lockFile = $this->_lockJob($jobDir);
if ($lockFile) {
//... | php | {
"resource": ""
} |
q29795 | JobRunner._getJobResult | train | protected function _getJobResult(Job $job)
{
$jobHash = spl_object_hash($job);
if (isset($this->runningJobs[$jobHash])) {
$jobDir = $this->_getJobDirectory($job);
if (file_exists("$jobDir/out.serialize")) {
$data = unserialize(file_get_contents("$jobDir/out.se... | php | {
"resource": ""
} |
q29796 | JobRunner.proccess | train | public function proccess()
{
foreach ($this->runningJobs as $jobData) {
$this->isRunning($jobData->job);
}
foreach ($this->pendingJobs as $job) {
$this->start($job);
}
} | php | {
"resource": ""
} |
q29797 | JobRunner.waitForAll | train | public function waitForAll($sleepTime = 1)
{
while (!empty($this->runningJobs)) {
$this->proccess();
$this->sleep($sleepTime);
}
} | php | {
"resource": ""
} |
q29798 | LibraryHelper.buildDatetimepicker | train | protected function buildDatetimepicker($input, array $options = [])
{
$this->Asset->script([
'/vendor/moment/moment-with-locales.min',
'MeTools.bootstrap-datetimepicker.min',
], ['block' => 'script_bottom']);
$this->Asset->css(
'/vendor/bootstrap-datetime... | php | {
"resource": ""
} |
q29799 | LibraryHelper.beforeLayout | train | public function beforeLayout(Event $event, $layoutFile)
{
if (!$this->output) {
return;
}
//Writes the output
$output = array_map(function ($v) {
return " " . $v;
}, $this->output);
$this->Html->scriptBlock(
sprintf('$(function... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.