_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235500 | Html.addScript | train | public function addScript ($src, $prepend = false)
{
if ($prepend) {
array_unshift($this->scriptUrls, $src);
} else {
$this->scriptUrls[] = $src;
}
$html = '<script type="text/javascript" src="' . $this->sanitize($src) . '"></script>';
$this->addHeader($html, $prepend);
} | php | {
"resource": ""
} |
q235501 | Html.addStylesheet | train | public function addStylesheet ($src, $prepend = false)
{
if ($prepend) {
array_unshift($this->stylesheetUrls, $src);
} else {
$this->stylesheetUrls[] = $src;
}
$html = '<link rel="stylesheet" type="text/css" href="' . $this->sanitize($src) . '" />';
$this->addHeader($html, $prepend);
} | php | {
"resource": ""
} |
q235502 | ReportViewerController.historyAction | train | public function historyAction($reportUri = null) {
//Determine whether to show or hide the report home button
$hideHome = $this->container->get('request')->query->get('hideHome') ?: 'false';
//Render and return
$response = new Response($this->container->get('templating')->render(
... | php | {
"resource": ""
} |
q235503 | ReportViewerController.loadPage | train | protected function loadPage($requestId, $page) {
//Create an array that will be converted into the json response
$response = array('success' => true, 'output' => '');
//Load the report
$rl = $this->container->get('mesd.jasper.report.loader')->getReportLoader();
try {
... | php | {
"resource": ""
} |
q235504 | ReportViewerController.executeAction | train | public function executeAction($reportUri, Request $request) {
//Decode the report uri
$decodedReportUri = urldecode($reportUri);
//Get the form again
$form = $this->container->get('mesd.jasper.report.client')->buildReportInputForm(
$decodedReportUri, null, array('data' => $r... | php | {
"resource": ""
} |
q235505 | ReportViewerController.listJsonAction | train | public function listJsonAction() {
//Get the folder
$folderUri = $this->container->get('request')->query->get('id');
//Set folder uri to null to use the default if the root is requested ('#')
if ('#' === $folderUri) {
$folder = null;
} else {
$folder = $f... | php | {
"resource": ""
} |
q235506 | ReportViewerController.reportHistoryJsonAction | train | public function reportHistoryJsonAction($reportUri = null) {
//Get the sent parameters from datatables
$limit = $this->container->get('request')->query->get('length');
$offset = $this->container->get('request')->query->get('start');
//Create a new repsonse array that will be converte... | php | {
"resource": ""
} |
q235507 | ValidateResourceListener.onKernelControllerArguments | train | public function onKernelControllerArguments(FilterControllerArgumentsEvent $event): void
{
$arguments = $event->getArguments();
foreach ($arguments as $argument) {
if ($argument instanceof ResourceInterface) {
$violationList = $this->validator->validate($argument);
... | php | {
"resource": ""
} |
q235508 | Jm_Autoloader.addPath | train | public function addPath($path, $namespace = '', $prepend = FALSE) {
if ($prepend === TRUE) {
return $this->prependPath($path, $namespace);
} else {
if (!empty($namespace)) {
$path = array (
$path, str_replace('_', '/', $namespace)
... | php | {
"resource": ""
} |
q235509 | Gdn_Router.SetRoute | train | public function SetRoute($Route, $Destination, $Type, $Save = TRUE) {
$Key = $this->_EncodeRouteKey($Route);
SaveToConfig('Routes.'.$Key, array($Destination, $Type), $Save);
$this->_LoadRoutes();
} | php | {
"resource": ""
} |
q235510 | PagesTable.getForFrontend | train | public function getForFrontend($pageId)
{
return $this->find()
->contain(['Current', 'Attributes'])
->formatResults([$this, 'formatAttributes'])
->where([$this->aliasField('id') => $pageId])
->first();
} | php | {
"resource": ""
} |
q235511 | Injection.encode | train | public static function encode(String $string) : String
{
$secBadChars = Properties::$injectionBadChars;
if( ! empty($secBadChars) )
{
foreach( $secBadChars as $badChar => $changeChar )
{
if( is_numeric($badChar) )
{
... | php | {
"resource": ""
} |
q235512 | Injection.nailEncode | train | public static function nailEncode(String $str) : String
{
$str = str_replace(array_keys(self::$nailChars), array_values(self::$nailChars), $str);
return $str;
} | php | {
"resource": ""
} |
q235513 | Injection.nailDecode | train | public static function nailDecode(String $str) : String
{
$str = str_replace(array_values(self::$nailChars), array_keys(self::$nailChars), $str);
return $str;
} | php | {
"resource": ""
} |
q235514 | Mapper.parseProxyData | train | protected function parseProxyData( & $data )
{
if ( empty( $data ) )
{
return array();
}
$result = array();
foreach ( json_decode( $data, true ) as $field )
{
if ( empty( $field['name'] ) )
{
continue;
}... | php | {
"resource": ""
} |
q235515 | Mapper.findRenderList | train | public function findRenderList( $id = null )
{
$platform = $this->getDbAdapter()
->getPlatform();
$columns = $this->getSelectColumns();
$columns['_depth'] = new Sql\Expression( '(' .
$this->sql( null )
->select( array( 'parent' => static... | php | {
"resource": ""
} |
q235516 | Mapper.saveSingleProperty | train | private function saveSingleProperty( $id, $name, $value )
{
$sql = $this->sql( $this->getTableInSchema(
static::$propertyTableName
) );
$update = $sql->update()
->set( array(
'value' => $value,
) )
... | php | {
"resource": ""
} |
q235517 | Mapper.saveProperty | train | protected function saveProperty( $id, $name, $value )
{
$rows = 0;
$sql = $this->sql( $this->getTableInSchema(
static::$propertyTableName
) );
$like = strtr( $name, array(
'\\' => '\\\\',
'%' => '\%',
'_' => '\_',
) ) . '.... | php | {
"resource": ""
} |
q235518 | Mapper.saveLabel | train | protected function saveLabel( $id, $label )
{
$locale = $this->getLocale();
$sql = $this->sql( $this->getTableInSchema(
static::$labelTableName
) );
$update = $sql->update()
->set( array(
'label' => $label,
... | php | {
"resource": ""
} |
q235519 | Mapper.interleaveParagraphs | train | public function interleaveParagraphs( $updateNode, $likeNode )
{
return $this->sql()
->menu_interleave_paragraph( (int) $updateNode,
(int) $likeNode );
} | php | {
"resource": ""
} |
q235520 | FileSystemExport.export | train | public function export(Logger $logger = null)
{
foreach ($this->site->process() as $path => $content)
{
$dest = "{$this->path}/$path";
$folder = substr($dest, 0, strrpos($dest, '/'));
if (!is_dir($folder))
{
mkdir($folder,... | php | {
"resource": ""
} |
q235521 | Fabric.getTranslator | train | public function getTranslator($type, array $params = [])
{
$result = null;
if (!isset($params['language'])) {
throw new \Exception('Need \'language\' param');
}
switch ($type) {
case interfaces\Translator::TRANSLATOR_FILE:
$result = new FileTr... | php | {
"resource": ""
} |
q235522 | SanitizableTrait.getFilteredValue | train | public function getFilteredValue() {
if(!$this->getSanitizer() instanceof Sanitizer) {
throw new \Exception('You have to assign a sanitizer first!');
}
return $this->getSanitizer()->filter($this->getRawValue());
} | php | {
"resource": ""
} |
q235523 | Emails.send | train | public function send(\BearFramework\Emails\Email $email): void
{
$app = App::get();
$email = clone($email);
if ($this->hasEventListeners('beforeSendEmail')) {
$eventDetails = new \BearFramework\Emails\BeforeSendEmailEventDetails($email);
$this->dispatchEvent('beforeS... | php | {
"resource": ""
} |
q235524 | AbstractAggregate.mutate | train | private function mutate($event)
{
$method = 'on' . (string) new EventName($event);
if (method_exists($this, $method)) {
$this->$method($event);
} else {
throw new \RuntimeException(sprintf('Method %s does not exist on aggregate %s', $method, get_class($this)));
... | php | {
"resource": ""
} |
q235525 | Utility.divide | train | public function divide($number): Utility
{
$divisible = new static($number);
if ($divisible->value() == 0 || $this->number == 0) {
throw new DivisionByZeroError();
}
$value = $this->number / $divisible->value();
return new static($value);
} | php | {
"resource": ""
} |
q235526 | Utility.factors | train | public function factors(): array
{
// 0 has infinite factors
if ($this->number === 0 || !is_int($this->number)) {
throw new InvalidNumberException();
}
$x = abs($this->number);
$sqrx = floor(sqrt($x));
$factors = [];
for ($i = 1; $i <= $sqrx; $i+... | php | {
"resource": ""
} |
q235527 | Utility.isNegative | train | public function isNegative(): bool
{
if ($this->number === 0 ){
throw new IsZeroException('0 is neither positive or negative');
}
return (!is_int($this->number) && $this->number < 0 || $this->number < 0);
} | php | {
"resource": ""
} |
q235528 | Utility.magnitude | train | public function magnitude(): Utility
{
if ($this->number == 0) {
$magnitude = 0;
} else {
$magnitude = floor(log10(abs($this->number)));
}
return new static($magnitude);
} | php | {
"resource": ""
} |
q235529 | Utility.pad | train | private function pad($padding = 1, $direction = STR_PAD_BOTH): string
{
return str_pad($this->number, $padding, 0, $direction);
} | php | {
"resource": ""
} |
q235530 | Utility.round | train | private function round($number, $precision, int $mode): Utility
{
if ($precision < 0) {
throw new InvalidNumberException('Precision value should be greater or equal to zero');
}
$value = round($number, $precision, $mode);
return new static($value);
} | php | {
"resource": ""
} |
q235531 | Utility.roundDown | train | public function roundDown(int $precision = 0): Utility
{
return $this->round($this->number, $precision, PHP_ROUND_HALF_DOWN);
} | php | {
"resource": ""
} |
q235532 | Utility.roundUp | train | public function roundUp(int $precision = 0): Utility
{
return $this->round($this->number, $precision, PHP_ROUND_HALF_UP);
} | php | {
"resource": ""
} |
q235533 | User.setUsername | train | public function setUsername(string $username): void
{
if (Strings::match($username, '/[^A-Za-z0-9_]/')) {
throw new InvalidArgumentException('Username contains invalid characters');
}
/* @var $repository UsersRepository */
$repository = $this->getRepository();
$user = $repository->getByUsername($username... | php | {
"resource": ""
} |
q235534 | User.getterRoleConstants | train | public function getterRoleConstants(): array
{
$result = [];
$roles = $this->roles->get();
/* @var $role AclRole */
foreach ($roles as $role) {
$result[] = $role->name;
}
return $result;
} | php | {
"resource": ""
} |
q235535 | User.getterRoleTitles | train | protected function getterRoleTitles(): array
{
$result = [];
$roles = $this->roles->get();
/* @var $role AclRole */
foreach ($roles as $role) {
$result[] = $role->title;
}
return $result;
} | php | {
"resource": ""
} |
q235536 | Styles.inline | train | public function inline($style, array $attr = null)
{
$attr = $this->escaper->attr(
$this->fixInlineAttr($attr)
);
return "<style {$attr}>{$style}</style>";
} | php | {
"resource": ""
} |
q235537 | Styles.inlineCond | train | public function inlineCond($cond, $style, array $attr = null)
{
$style = $this->inline($style, $attr);
$cond = $this->escaper->html($cond);
return "<!--[if {$cond}]>{$style}<![endif]-->";
} | php | {
"resource": ""
} |
q235538 | Styles.addInline | train | public function addInline($style, array $attr = null, $position = 1000)
{
$this->addElement(
$position,
$this->inline($style, $attr)
);
return $this;
} | php | {
"resource": ""
} |
q235539 | Styles.addInlineCond | train | public function addInlineCond(
$cond,
$style,
array $attr = null,
$position = 1000
) {
$this->addElement(
$position,
$this->inlineCond($cond, $style, $attr)
);
return $this;
} | php | {
"resource": ""
} |
q235540 | Styles.inlineCaptureStart | train | public function inlineCaptureStart(array $attr = null, $position = 1000)
{
$this->capture[] = [
'func' => 'addInline',
'args' => [
'style' => '',
$attr,
$position
]
];
ob_start();
return $this;
} | php | {
"resource": ""
} |
q235541 | Styles.inlineCondCaptureStart | train | public function inlineCondCaptureStart(
$cond,
array $attr = null,
$position = 1000
) {
$this->capture[] = [
'func' => 'addInlineCond',
'args' => [
$cond,
'style' => '',
$attr,
$position
... | php | {
"resource": ""
} |
q235542 | AdminStoreTables.init | train | public static function init(AdminStore $admin_store) {
self::$admin_store = $admin_store;
self::$sql = $admin_store->store;
self::$logger = $admin_store->logger;
} | php | {
"resource": ""
} |
q235543 | AdminStoreTables.drop | train | public static function drop() {
foreach([
"DROP VIEW IF EXISTS v_usess",
"DROP TABLE IF EXISTS usess",
"DROP TABLE IF EXISTS udata",
"DROP TABLE IF EXISTS meta",
] as $drop) {
// @codeCoverageIgnoreStart
try {
self::$sql->query_raw($drop);
} catch(SQLError $e) {
$msg = "Cannot drop data... | php | {
"resource": ""
} |
q235544 | AdminStoreTables.exists | train | public static function exists($force_create_table=null) {
$sql = self::$sql;
$sql::$logger->deactivate();
try {
$sql->query("SELECT 1 FROM udata LIMIT 1");
$sql::$logger->activate();
if ($force_create_table) {
self::drop();
self::$logger->info("Zapmin: Recreating tables.");
return false;
}... | php | {
"resource": ""
} |
q235545 | AdminStoreTables.fragments | train | public static function fragments($expiration=7200) {
$sql = self::$sql;
$args = [];
$args['index'] = $sql->stmt_fragment('index');
$args['engine'] = $sql->stmt_fragment('engine');
$args['dtnow'] = $sql->stmt_fragment('datetime');
$args['expire'] = $sql->stmt_fragment(
'datetime', ['delta' => $expiration... | php | {
"resource": ""
} |
q235546 | AdminStoreTables.install | train | public static function install($expiration=7200) {
$dtnow = $expire = null;
extract(self::fragments($expiration));
$sql = self::$sql;
# user table
$user_table = ("
CREATE TABLE udata (
uid %s,
uname VARCHAR(64) UNIQUE,
upass VARCHAR(64),
usalt VARCHAR(16),
since TIMESTAMP NOT NULL DE... | php | {
"resource": ""
} |
q235547 | AdminStoreTables.upgrade | train | public static function upgrade() {
$sql = self::$sql;
$sql::$logger->deactivate();
try {
$version = $sql->query(
"SELECT version FROM meta LIMIT 1")['version'];
} catch(SQLError $e) {
$sql::$logger->activate();
return self::upgrade_tables();
}
$sql::$logger->activate();
if (0 <= version_com... | php | {
"resource": ""
} |
q235548 | AdminStoreTables.upgrade_tables | train | private static function upgrade_tables($from_version=null) {
$sql = self::$sql;
if (!$from_version) {
$from_version = '0.0';
$sql->query_raw("
CREATE TABLE meta (
version VARCHAR(24) NOT NULL DEFAULT '0.0'
);
");
$sql->insert('meta', [
'version' => self::TABLE_VERSION,
]);
} else... | php | {
"resource": ""
} |
q235549 | Json.input | train | public function input($file_content)
{
$this->file_content = $file_content;
$this->parsed_content = json_decode($this->file_content, true);
} | php | {
"resource": ""
} |
q235550 | Fileable.files | train | public function files()
{
return $this->morphToMany(
config('media.model', \Routegroup\Media\File::class),
'mediables',
null,
null,
'media_id'
)
->withPivot('type')
->whereNotNull('mediables.type')
->with... | php | {
"resource": ""
} |
q235551 | User.profileRules | train | public function profileRules()
{
return [
[['username', 'password', 'email'], 'required', 'on' => self::SCENARIO_CREATE],
['username', 'match', 'pattern' => '/^[A-Za-z][A-Za-z0-9\-\.\ ]+$/i',
'message' => Yii::t($this->tcModule, 'Only latin letters, digits, hyphen, p... | php | {
"resource": ""
} |
q235552 | SingleFieldSubscriptions.getVisitor | train | public function getVisitor(ValidationContext $context)
{
return [
NodeKind::OPERATION_DEFINITION => function (OperationDefinitionNode $node) use ($context) {
if ($node->operation === 'subscription') {
if (count($node->selectionSet->selections) !== 1) {
... | php | {
"resource": ""
} |
q235553 | TrixionaryModule.getSkillsPath | train | public function getSkillsPath(Sport $sport) {
return $this->getSportPath($sport)->append($this->getSkillsSegment($sport));
} | php | {
"resource": ""
} |
q235554 | TrixionaryModule.getSkillPath | train | public function getSkillPath(Skill $skill) {
return $this->getSkillsPath($skill->getSport())->append($this->getSkillSegment($skill));
} | php | {
"resource": ""
} |
q235555 | TrixionaryModule.getSkillUrl | train | public function getSkillUrl(Skill $skill) {
return $this->getSkillsUrl($skill->getSport()) . '/' . $this->getSkillSegment($skill);
} | php | {
"resource": ""
} |
q235556 | UtilityController.locatorAction | train | public function locatorAction()
{
$arg = $this->request->get('args');
// task execute.
if (($task = $this->request->get('tasks')) || ($task = $this->request->get('option.T'))) {
return [self::FORWARD_ACTION, 'task.list'];
} elseif ($this->isTask($arg)) {
retu... | php | {
"resource": ""
} |
q235557 | UtilityController.versionAction | train | public function versionAction()
{
$this->assign('version', Samurai::getVersion());
$this->assign('state', Samurai::getState());
return self::VIEW_TEMPLATE;
} | php | {
"resource": ""
} |
q235558 | UtilityController.usageAction | train | public function usageAction()
{
$this->assign('version', Samurai::getVersion());
$this->assign('state', Samurai::getState());
$this->assign('script', './app'); // TODO: $this->request->getScript()
return self::VIEW_TEMPLATE;
} | php | {
"resource": ""
} |
q235559 | UtilityController.serverAction | train | public function serverAction()
{
chdir($this->application->config('directory.document_root'));
$host = $this->request->get('host', 'localhost');
$port = $this->request->get('port', 8888);
passthru(sprintf('php -S %s:%s index.php', $host, $port));
} | php | {
"resource": ""
} |
q235560 | KeyValueByteGenerator.readNextKeyValuePair | train | public function readNextKeyValuePair( $truncatedString ) : ContainerElement {
$keyBytes = $this->extractKeyBytes( $truncatedString );
$remainingBytes = substr( $truncatedString, $keyBytes->getLength() );
$data = $this->readData( $remainingBytes );
return new ContainerElement($keyBytes, $... | php | {
"resource": ""
} |
q235561 | FileMailer.send | train | public function send(Message $message)
{
$content = $message->generateMessage();
preg_match('~Message-ID: <(?<message_id>\w+)[^>]+>~', $content, $matches);
$path = $this->tempDir . '/'. $this->prefix . $matches['message_id'] . '.' . self::FILE_EXTENSION;
if (($bytes = file_put_contents($path, $content)) === ... | php | {
"resource": ""
} |
q235562 | CategoryController.actionIndex | train | public function actionIndex($slug, $page = 1, $sort = '')
{
$this->trigger(self::EVENT_BEFORE_CATEGORY_SHOW);
$data['slug'] = $slug;
$data['sort'] = $sort;
$data['page'] = (int) $page;
$data['route'] = '/' . $this->getRoute();
// Ищем категорию
$data['categ... | php | {
"resource": ""
} |
q235563 | Arr.pluck | train | public static function pluck (array $array, $keys)
{
if (!is_array($keys))
{
$keys = func_get_args();
array_shift($keys);
}
return array_intersect_key($array, array_flip($keys));
} | php | {
"resource": ""
} |
q235564 | Arr.is_associative | train | public static function is_associative (array $array)
{
foreach ($array as $k => $v)
{
$t = str_replace((int)$k, '', $k);
if (!empty($t))
{
if (!static::is_int($k))
{
return true;
}
}
}
return false;
} | php | {
"resource": ""
} |
q235565 | ClassMocker.enable | train | public function enable()
{
spl_autoload_register([$this, 'autoload'], true, true);
spl_autoload_register([$this, 'autoloadOptional'], true, false);
return $this;
} | php | {
"resource": ""
} |
q235566 | ClassMocker.mock | train | public function mock($pattern, $ifNotExist = false)
{
if ($ifNotExist) {
$this->_optionalMockPatterns[] = $pattern;
} else {
$this->_mockPatterns[] = $pattern;
}
return $this;
} | php | {
"resource": ""
} |
q235567 | ClassMocker.generateAndLoadClass | train | public function generateAndLoadClass($className)
{
if (class_exists($className, false)) {
throw new \RuntimeException("Unable to generate and load already existing class '$className'");
}
$filename = $this->findFile($className);
if (!$filename || !file_exists($filename)... | php | {
"resource": ""
} |
q235568 | ClassMocker._autoload | train | protected function _autoload($patterns, $className)
{
foreach ($patterns as $pattern) {
if (!fnmatch($pattern, $className, FNM_NOESCAPE)) {
continue;
}
$this->generateAndLoadClass($className);
return true;
}
return false;
} | php | {
"resource": ""
} |
q235569 | ClassMocker.evalContent | train | private function evalContent(FileGenerator $classFileGenerator)
{
$code = $classFileGenerator->generate();
$code = substr($code, 6); // remove <?php
eval($code);
} | php | {
"resource": ""
} |
q235570 | ClassMocker.findFile | train | protected function findFile($className)
{
$genDir = $this->getGenerationDir();
if (!$genDir) {
return null;
}
$path = [$genDir];
$path[] = str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
$path = implode(DIRECTORY_SEPARATOR, $path);
... | php | {
"resource": ""
} |
q235571 | FilterLatte.addTag | train | public static function addTag(string $string, string $tag): string
{
$lastPoint = strrpos($string, '.');
return ($tag ? substr_replace($string, sprintf('.%s.', $tag), $lastPoint, 1) : $string);
} | php | {
"resource": ""
} |
q235572 | FilterLatte.dateDiff | train | public static function dateDiff(DateTime $from = null, DateTime $to = null, string $format = 'Y-m-d H:i:s'): string
{
if (!$from) {
return '';
}
if (!$to) { // if not define to then to date is set today
$to = new DateTime();
}
return $from->diff($to)->... | php | {
"resource": ""
} |
q235573 | FilterLatte.googleMapsLink | train | public static function googleMapsLink(string $query): string
{
$result = $query;
if ($query) {
$result = 'https://www.google.com/maps/search/?api=1&query=' . $query;
}
return $result;
} | php | {
"resource": ""
} |
q235574 | FilterLatte.toUrl | train | public static function toUrl(string $url, string $scheme = 'http://'): string
{
$http = preg_match('/^http[s]?:\/\//', $url);
return (!$http ? $scheme : '') . $url;
} | php | {
"resource": ""
} |
q235575 | FilterLatte.realUrl | train | public static function realUrl(string $value)
{
list($scheme, $url) = explode('//', $value);
$reverse = explode('/', $url);
$arr = [];
foreach ($reverse as $item) {
$arr[] = $item;
if ($item == '..') {
array_pop($arr); // remove 2x from arra... | php | {
"resource": ""
} |
q235576 | AuthenticationChain.authenticate | train | public function authenticate(ServerRequestInterface $request): ?UserInterface
{
foreach ($this->authenticationServices as $authenticationService) {
$user = $authenticationService->authenticate($request);
if ($user !== null) {
return $user;
}
}
... | php | {
"resource": ""
} |
q235577 | ServiceProvider.registerProvider | train | public function registerProvider($provider){
$providers = (array) $provider;
foreach($providers as $provider){
$this->app()['config']->add('general.providers', $provider);
}
} | php | {
"resource": ""
} |
q235578 | iauApcs13.Apcs13 | train | public static function Apcs13($date1, $date2, array $pv, iauASTROM $astrom) {
$ehpv = [];
$ebpv = [];
/* Earth barycentric & heliocentric position/velocity (au, au/d). */
IAU::Epv00($date1, $date2, $ehpv, $ebpv);
/* Compute the star-independent astrometry parameters. */
IAU::Apcs($date1, $date... | php | {
"resource": ""
} |
q235579 | AuthService.auth | train | public function auth(LoginForm $form): User
{
$this->checkFailure();
$user = $this->user->findByUsernameOrEmail($form->username);
if (!$user || !$user->validatePassword($form->password)) {
$this->setFailure();
throw new \DomainException($this->i18n->t('setrun/user', '... | php | {
"resource": ""
} |
q235580 | AuthService.checkFailure | train | private function checkFailure() : void
{
$failure = (int) $this->session->get('failure', 0);
$time = (int) $this->session->get('failure_time', time());
if ($failure >= static::FAILURE) {
if ($time >= time()) {
throw new \DomainException($this->i18n->t(
... | php | {
"resource": ""
} |
q235581 | AuthService.setFailure | train | private function setFailure() : void
{
$this->session->set('failure', $this->session->get('failure') + 1);
$this->session->set('failure_time', time() + (int) static::FAILURE_TIME);
} | php | {
"resource": ""
} |
q235582 | AbstractAdapter.createApiException | train | protected function createApiException(Request $request, Response $response)
{
//$errors = json_decode((string) $response->getBody());
return new HttpRequestException(
$response->getCode(),
$response->getBody(),
$request,
$response
);
} | php | {
"resource": ""
} |
q235583 | Account.detachFromDuty | train | public function detachFromDuty($id = null, $identifier = null, $username = null, $duty_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $use... | php | {
"resource": ""
} |
q235584 | Account.attachToDuty | train | public function attachToDuty($id = null, $identifier = null, $username = null, $duty_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $usern... | php | {
"resource": ""
} |
q235585 | Account.detachFromSchool | train | public function detachFromSchool($id = null, $identifier = null, $username = null, $school_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = ... | php | {
"resource": ""
} |
q235586 | Account.attachToSchool | train | public function attachToSchool($id = null, $identifier = null, $username = null, $school_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $u... | php | {
"resource": ""
} |
q235587 | Account.detachFromCourse | train | public function detachFromCourse($id = null, $identifier = null, $username = null, $course_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = ... | php | {
"resource": ""
} |
q235588 | Account.attachToCourse | train | public function attachToCourse($id = null, $identifier = null, $username = null, $course_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $u... | php | {
"resource": ""
} |
q235589 | Account.detachFromDepartment | train | public function detachFromDepartment($id = null, $identifier = null, $username = null, $department_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['usern... | php | {
"resource": ""
} |
q235590 | Account.attachToDepartment | train | public function attachToDepartment($id = null, $identifier = null, $username = null, $department_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['usernam... | php | {
"resource": ""
} |
q235591 | Account.detachFromRoom | train | public function detachFromRoom($id = null, $identifier = null, $username = null, $room_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $use... | php | {
"resource": ""
} |
q235592 | Account.attachToRoom | train | public function attachToRoom($id = null, $identifier = null, $username = null, $room_id = null, $code = null)
{
$fields = [];
if (!is_null($id)) $fields['id'] = $id;
if (!is_null($identifier)) $fields['identifier'] = $identifier;
if (!is_null($username)) $fields['username'] = $usern... | php | {
"resource": ""
} |
q235593 | BackendAppController._allow | train | protected function _allow()
{
$url = Wasabi::getCurrentUrlArray();
if ($this->Guardian->isGuestAction($url)) {
$this->Auth->allow($this->request->params['action']);
}
} | php | {
"resource": ""
} |
q235594 | Partition.getList | train | public function getList(string $path)
{
$entity = $this->getEntity($path);
if (null !== $entity && $entity->file_exists() && $entity->is_dir()) {
$files = [];
$changes = $this->getChanges();
$own = $changes->own($path);
if (!($entity instanceof Virtu... | php | {
"resource": ""
} |
q235595 | Partition.tempnam | train | public function tempnam(): string
{
$root = $this->getFsRoot();
do {
++$this->fsCounter;
$name = $root.'/'.$this->fsCounter;
} while (file_exists($name));
return $name;
} | php | {
"resource": ""
} |
q235596 | Partition.commit | train | public function commit(): void
{
if (null !== $this->changes) {
$this->commitInternal($this->changes);
$this->changes = null;
}
} | php | {
"resource": ""
} |
q235597 | Partition.setRoot | train | protected function setRoot(EntityInterface $entity): void
{
if (!$entity->file_exists() || !$entity->is_dir()) {
throw new Exception('Root directory is not valid');
}
$this->root = $entity;
} | php | {
"resource": ""
} |
q235598 | Partition.getChanges | train | protected function getChanges(): Changes
{
if (null === $this->changes) {
$this->changes = new Changes();
}
return $this->changes;
} | php | {
"resource": ""
} |
q235599 | Partition.commitInternal | train | private function commitInternal(Changes $changes, string $path = ''): void
{
$root = $this->getRoot();
$rootpath = $root->path();
if ($path) {
$path .= '/';
}
$own = $changes->own();
foreach ($own as $filename => $vEntity) {
$filepath = $path... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.