_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239500 | Routes.getRoutes | train | protected function getRoutes(): array
{
uasort($this->routes, function (RouteInterface $left, RouteInterface $right) {
if ($left instanceof GroupRoute || $right instanceof GroupRoute) {
return 1;
}
return 0;
});
return $this->routes;
... | php | {
"resource": ""
} |
q239501 | HydrationFailed.encountered | train | public static function encountered(
Throwable $exception,
object $target
): CannotHydrate {
return new HydrationFailed(withMessage(
'Could not hydrate the `%s`: %s',
theClassOfThe($target),
$exception->getMessage()
), 0, $exception);
} | php | {
"resource": ""
} |
q239502 | Configuration.getWebResourceClassName | train | public function getWebResourceClassName($contentType)
{
return ($this->hasMappedWebResourceClassName($contentType))
? $this->contentTypeWebResourceMap[(string)$contentType]
: self::DEFAULT_WEB_RESOURCE_MODEL;
} | php | {
"resource": ""
} |
q239503 | Loader.setConfig | train | public function setConfig($config)
{
$configObject = $this->getConfig();
if (is_object($config)) {
$config = get_object_vars($config);
}
foreach ((array)$config as $key => $value) {
$configObject->$key = $value;
}
return $this;
} | php | {
"resource": ""
} |
q239504 | Loader.registerAssetBundle | train | public function registerAssetBundle($name)
{
if (($bundle = $this->getAssetBundleFromView($name)) === false) {
return $bundle;
}
$config = $this->getConfig();
if (!($module = $config->getModule($name))) {
$module = $config->addModule($name);
}
... | php | {
"resource": ""
} |
q239505 | Loader.processAssets | train | public function processAssets()
{
$jsExpressions = [];
foreach ([
View::POS_HEAD,
View::POS_BEGIN,
View::POS_END,
View::POS_LOAD,
View::POS_READY
] as $position
) {
... | php | {
"resource": ""
} |
q239506 | ArrayCache.set | train | public function set($key, $data, $ttl = null)
{
if ($ttl) {
$now = new \DateTime('now', new \DateTimeZone('UTC'));
$expire = (int) $now->format('U') + $ttl;
} else {
$expire = 0;
}
$entry = array(
'expire' => $expire,
'valu... | php | {
"resource": ""
} |
q239507 | Stop.json | train | public static function json($var, $continue = false, $hide = false, $return = false){
$Stop = new \Stop\Dumper\Json($hide, $continue, $return, Dumper\AbstractDumper::FORMAT_JSON);
$Stop->var_dump($var);
} | php | {
"resource": ""
} |
q239508 | StatementAbstract.buildSql | train | protected function buildSql(array $settings)/*# : string */
{
$result = $this->getType(); // type
$settings['join'] = $settings['seperator'] . $settings['indent'];
$result .= $this->buildBeforeAfter('AFTER', 'TYPE', $settings); // hint
foreach ($this->getConfigs() as $pos => $prefix... | php | {
"resource": ""
} |
q239509 | CrudController.getFormEntity | train | protected function getFormEntity(Request $request)
{
if ($this->formEntity === null) {
$entityId = $request->get('id');
$repository = $this->getRepository();
$entity = null;
$id = 0;
if (!empty($entityId) && $entityId !== null) {
$... | php | {
"resource": ""
} |
q239510 | BaseFlysystemProvider.getFilesystem | train | protected function getFilesystem()
{
if (!isset($this->filesystem)) {
$this->filesystem = new Filesystem($this->getAdapter());
}
return $this->filesystem;
} | php | {
"resource": ""
} |
q239511 | GnuplotFactory.create | train | public function create($template)
{
if (!isset($this->plotters[$template])) {
throw new \InvalidArgumentException("Unknown template [$template]");
}
$className = $this->plotters[$template];
return new $className($this->finderFactory);
} | php | {
"resource": ""
} |
q239512 | TypedUtils.groupByType | train | public static function groupByType(array $objects)
{
$perType = [];
foreach ($objects as $object) {
$type = $object->getType();
if (!isset($perType[$type])) {
$perType[$type] = [];
}
$perType[$type][] = $object;
}
return... | php | {
"resource": ""
} |
q239513 | RESTLyte.request | train | public function request($verb, $path, $accept, array $customCURLOptions=[])
{
$verb = strtoupper(
trim(
$verb
)
);
$instantiateClass = "\\Lamoni\\RESTLyte\\RESTLyteRequest\\RESTLyteRequest{$this->getResponseType()}";
$request = new $instanti... | php | {
"resource": ""
} |
q239514 | RESTLyte.post | train | public function post($path, $postData, $accept="")
{
return $this->request(
'POST',
$path,
$accept,
[
CURLOPT_POSTFIELDS => $postData
]
);
} | php | {
"resource": ""
} |
q239515 | RESTLyte.put | train | public function put($path, $postData, $accept="")
{
return $this->request(
'PUT',
$path,
$accept,
[
CURLOPT_POSTFIELDS => $postData
]
);
} | php | {
"resource": ""
} |
q239516 | RESTLyte.patch | train | public function patch($path, $postData, $accept="")
{
return $this->request(
'PATCH',
$path,
$accept,
[
CURLOPT_POSTFIELDS => $postData
]
);
} | php | {
"resource": ""
} |
q239517 | RESTLyte.delete | train | public function delete($path, $postData, $accept="")
{
return $this->request(
'DELETE',
$path,
$accept,
[
CURLOPT_POSTFIELDS => $postData
]
);
} | php | {
"resource": ""
} |
q239518 | DecodedRawOutput.isWellFormed | train | public function isWellFormed()
{
if (!is_array($this->decodedRawOutput)) {
return false;
}
if (!isset($this->decodedRawOutput[0]) || !is_string($this->decodedRawOutput[0])) {
return false;
}
if (!isset($this->decodedRawOutput[1]) || !is_array($this->... | php | {
"resource": ""
} |
q239519 | Result.setStatus | train | public function setStatus(Result\ResultStatus $status)
{
if (Result\ResultStatus::UNPROCESSED !== $status->getValue()) {
$this->transacted = true;
$this->dateTransacted = new DateTime();
}
if (!$this->transaction->isParent()
&& Result\ResultStatus::ERROR ... | php | {
"resource": ""
} |
q239520 | GroupTableMap.doInsert | train | public static function doInsert($criteria, ConnectionInterface $con = null)
{
if (null === $con) {
$con = Propel::getServiceContainer()->getWriteConnection(GroupTableMap::DATABASE_NAME);
}
if ($criteria instanceof Criteria) {
$criteria = clone $criteria; // rename fo... | php | {
"resource": ""
} |
q239521 | EmailService.queueEmail | train | public function queueEmail(
$type,
$to,
$fromEmail,
$fromName,
$subject,
$body = null,
$contentType = 'text/html',
$template = null,
$parameters = [],
$cc = [],
$bcc = [],
$delaySeconds = 0
) {
$payload = [
... | php | {
"resource": ""
} |
q239522 | BackupCommandController.restoreCommand | train | public function restoreCommand($selectedBackup = null)
{
$this->initialize();
if (is_null($selectedBackup)) {
$availableVersions = $this->backupService->getAvailableVersions();
if ( count($availableVersions)<=0 ) {
$this->output->outputLine();
... | php | {
"resource": ""
} |
q239523 | BackupCommandController.listCommand | train | public function listCommand()
{
$this->output->outputLine();
$this->output->outputLine('<b>Available Backups</b>');
$this->output->outputLine();
$this->output->outputLine('<b>Identifier Date Time</b>');
$this->initialize();
$availableVersions = $this->backupSe... | php | {
"resource": ""
} |
q239524 | BackupCommandController.clearCommand | train | public function clearCommand($force = null)
{
$this->initialize();
$this->backupService->removeAllBackups();
if ( $force===true ) {
$this->backupService->removeKeyfile();
}
} | php | {
"resource": ""
} |
q239525 | RouteService.attach | train | public function attach($methods, $match, $callable)
{
if (is_string($methods)) {
$methods = [$methods];
}
$route = new Route($methods, $callable);
$this->storage[$match] = $route;
return $route;
} | php | {
"resource": ""
} |
q239526 | Services.registerCoreClass | train | public static function registerCoreClass(string $class): bool
{
if (class_exists($class) === false) {
return false;
}
$check = new ReflectionClass($class);
if ($check->implementsInterface("TheCMSThread\\Classes\\Core") === true) {
self::$core_class = $class;
... | php | {
"resource": ""
} |
q239527 | Services.registerModulesClass | train | public static function registerModulesClass(string $class): bool
{
if (class_exists($class) === false) {
return false;
}
$check = new ReflectionClass($class);
if ($check->implementsInterface("TheCMSThread\\Classes\\Modules") === true) {
self::$modules_class = ... | php | {
"resource": ""
} |
q239528 | Services.registerThemeClass | train | public static function registerThemeClass(string $class): bool
{
if (class_exists($class) === false) {
return false;
}
$check = new ReflectionClass($class);
if ($check->implementsInterface("TheCMSThread\\Classes\\Theme") === true) {
self::$theme_class = $class... | php | {
"resource": ""
} |
q239529 | Services.registerPluginClass | train | public static function registerPluginClass(string $name, string $class): bool
{
if (class_exists($class) === false) {
return false;
}
if (self::$plugin_classes === null) {
self::$plugin_classes = [];
}
$check = new ReflectionClass($class);
if (... | php | {
"resource": ""
} |
q239530 | Services.getPluginClass | train | public static function getPluginClass(string $name): string
{
$class = "";
if (empty($name) === false && empty(self::$plugin_classes[$name]) === false) {
$class = self::$plugin_classes[$name];
}
return $class;
} | php | {
"resource": ""
} |
q239531 | Services.registerExtensionClass | train | public static function registerExtensionClass(string $name, string $class): bool
{
if (class_exists($class) === false) {
return false;
}
if (self::$extension_classes === null) {
self::$extension_classes = [];
}
$check = new ReflectionClass($class);
... | php | {
"resource": ""
} |
q239532 | Services.getExtensionClass | train | public static function getExtensionClass(string $name): string
{
$class = "";
if (empty($name) === false && empty(self::$extension_classes[$name]) === false) {
$class = self::$extension_classes[$name];
}
return $class;
} | php | {
"resource": ""
} |
q239533 | Services.registerAdminClass | train | public static function registerAdminClass(string $name, string $class): bool
{
if (class_exists($class) === false) {
return false;
}
if (self::$admin_classes === null) {
self::$admin_classes = [];
}
$check = new ReflectionClass($class);
if ($ch... | php | {
"resource": ""
} |
q239534 | Services.getAdminClass | train | public static function getAdminClass(string $name): string
{
$class = "";
if (empty($name) === false && empty(self::$admin_classes[$name]) === false) {
$class = self::$admin_classes[$name];
}
return $class;
} | php | {
"resource": ""
} |
q239535 | Event.register | train | public static function register()
{
$namespace = "Vinala\App\Events";
foreach (get_declared_classes() as $value) {
if (Strings::contains($value, $namespace)) {
$name = self::getName($value);
$events = $value::getEvents();
if (!is_null($e... | php | {
"resource": ""
} |
q239536 | Event.trigger | train | public static function trigger()
{
$args = func_get_args();
//Check if trigger have parrams
$haveParams = count($args) > 1 ? true : false;
//Get events
$events = self::splite($args[0]);
if ($haveParams && count($events) > 1) {
throw new ManyListenersArg... | php | {
"resource": ""
} |
q239537 | Event.splite | train | protected static function splite($pattern)
{
if (is_array($pattern)) {
$events = [];
foreach ($pattern as $value) {
$events = array_collapse([$events, self::extract($value)]);
}
return $events;
} elseif (is_string($pattern)) {
... | php | {
"resource": ""
} |
q239538 | Event.extract | train | protected static function extract($pattern)
{
if (str_contains($pattern, '|')) {
$segements = explode('|', $pattern);
$events[$segements[0]] = explode('.', $segements[1]);
} else {
$segements = explode('.', $pattern);
$events[$segements[0]] = $segeme... | php | {
"resource": ""
} |
q239539 | Event.runMany | train | public static function runMany($events)
{
foreach ($events as $key => $value) {
$name = '\Vinala\App\Events\\'.$key;
$object = new $name();
if (is_array($value)) {
foreach ($value as $function) {
$function = self::$listners[$key.'.'.$... | php | {
"resource": ""
} |
q239540 | Event.runOne | train | public static function runOne($events, $args)
{
foreach ($events as $key => $value) {
$name = '\Vinala\App\Events\\'.$key;
$object = new $name();
$function = self::$listners[$key.'.'.$value];
call_user_func_array([$object, $function], $args);
}
... | php | {
"resource": ""
} |
q239541 | Filesystem.rawLog | train | public function rawLog(string $type = '', string $message = '', ?string $source = null, ?string $excp = null): bool
{
$src = $source !== null
? \sprintf('[%s] ', \is_object($source) ? '\\'.\get_class($source) : (string)$source)
: '';
$exc = $excp !== null && ($excp instanceof... | php | {
"resource": ""
} |
q239542 | Filesystem.logDebug | train | public function logDebug(string $message = '', ?string $source = null, ?string $exception = null): bool
{
$ret = false;
if ($this->logLevel & Log::LOG_DEBUG) {
$ret = $this->rawLog('[ DEBUG]', $message, $source, $exception);
}
return $ret;
} | php | {
"resource": ""
} |
q239543 | InfoAugment.methods | train | public function methods() {
return $this->cache(__METHOD__, function() {
return array_unique(array_merge(
$this->publicMethods(),
$this->protectedMethods(),
$this->privateMethods(),
$this->staticMethods()
));
});
... | php | {
"resource": ""
} |
q239544 | InfoAugment.properties | train | public function properties() {
return $this->cache(__METHOD__, function() {
return array_unique(array_merge(
$this->publicProperties(),
$this->protectedProperties(),
$this->privateProperties(),
$this->staticProperties()
));
... | php | {
"resource": ""
} |
q239545 | InfoAugment.traits | train | public function traits() {
$traits = $this->reflection()->getTraitNames();
$parent = get_parent_class($this->_class);
while ($parent) {
$traits = array_merge($traits, class_uses($parent));
$parent = get_parent_class($parent);
}
return array_values($trait... | php | {
"resource": ""
} |
q239546 | InfoAugment._methods | train | protected function _methods($key, $scope) {
return $this->cache($key, function() use ($scope) {
$methods = [];
foreach ($this->reflection()->getMethods($scope) as $method) {
$methods[] = $method->getName();
}
return $methods;
});
} | php | {
"resource": ""
} |
q239547 | InfoAugment._properties | train | protected function _properties($key, $scope) {
return $this->cache($key, function() use ($scope) {
$props = [];
foreach ($this->reflection()->getProperties($scope) as $prop) {
$props[] = $prop->getName();
}
return $props;
});
} | php | {
"resource": ""
} |
q239548 | Controller.check_access | train | protected function check_access($action = null)
{
is_null($action) and $action = $this->request->action;
if ($this->has_access($action) === false)
{
$context = array(
'form' => array(
'%action%' => $action,
'%items%' => $this->get_name(999),
)
);
\Logger::instance('alert')->error(ge... | php | {
"resource": ""
} |
q239549 | Controller.find | train | protected function find($id = null)
{
$query = $this->query();
$query->where('id', $id);
if (is_null($id) or is_null($model = $query->get_one()))
{
throw new \HttpNotFoundException();
}
return $model;
} | php | {
"resource": ""
} |
q239550 | Controller.forge | train | protected function forge($data = [], $new = true, $view = null, $cache = true)
{
return call_user_func([$this->get_model(), 'forge'], $data, $new, $view, $cache);
} | php | {
"resource": ""
} |
q239551 | Exception.create | train | public static function create($name, $message, $view)
{
$root = Process::root;
$name = ucfirst($name);
$path = $root."app/exceptions/$name.php";
//
if (!File::exists($path)) {
File::put($path, self::set($name, $message, $view));
return true;
... | php | {
"resource": ""
} |
q239552 | TransformerTrait.includeDefaultIncludes | train | protected function includeDefaultIncludes($model, $data)
{
// Create an return array
$returnData = [];
// If we have default includes
if ( ! empty( $this->defaultIncludes ) ) {
// Loop through all includes
foreach ($this->defaultIncludes as $include) {
... | php | {
"resource": ""
} |
q239553 | TransformerTrait.includeAvailableIncludes | train | protected function includeAvailableIncludes($model, $data )
{
// Get available includes from url parameters
$includes = $this->getAvailableIncludesFromUrlParameters();
// Create an return array
$returnData = [];
// Check if we have includes and include parameter values
... | php | {
"resource": ""
} |
q239554 | TransformerTrait.includeByName | train | protected function includeByName( $name, $model )
{
$functionName = sprintf( 'include%s', ucfirst( $name ) );
if ( ! method_exists( static::class, $functionName ) ) {
throw new \Exception(sprintf( 'The function name "%s" does not exists on %s', $functionName, static::class ));
... | php | {
"resource": ""
} |
q239555 | IconFileRepository.findByHashes | train | public function findByHashes(array $hashes): array
{
$result = [];
if (count($hashes) > 0) {
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder->select('if')
->from(IconFile::class, 'if')
->andWhere('if.... | php | {
"resource": ""
} |
q239556 | IconFileRepository.removeOrphans | train | public function removeOrphans(): void
{
$hashes = $this->findOrphanedHashes();
if (count($hashes) > 0) {
$this->removeHashes($hashes);
}
} | php | {
"resource": ""
} |
q239557 | IconFileRepository.findOrphanedHashes | train | protected function findOrphanedHashes(): array
{
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder->select('if.hash AS hash')
->from(IconFile::class, 'if')
->leftJoin('if.icons', 'i')
->andWhere('i.id IS NULL');
... | php | {
"resource": ""
} |
q239558 | IconFileRepository.removeHashes | train | protected function removeHashes(array $hashes): void
{
$queryBuilder = $this->entityManager->createQueryBuilder();
$queryBuilder->delete(IconFile::class, 'if')
->andWhere('if.hash IN (:hashes)')
->setParameter('hashes', array_values($hashes));
$quer... | php | {
"resource": ""
} |
q239559 | LoopsAdmin.exec | train | public function exec($arguments) {
//parse
$options = $this->parse();
// check if help was requested
if(is_integer($options)) {
return $options;
}
// extract and remove special vars
$instance = $options["__instance"];
$method = $options["__... | php | {
"resource": ""
} |
q239560 | LoopsAdmin.adjustOptions | train | private static function adjustOptions(array $options) {
$result = [];
foreach($options as $key => $value) {
$result[str_replace("-", "_", $key)] = $value;
}
return $result;
} | php | {
"resource": ""
} |
q239561 | LoopsAdmin.ident | train | private function ident($text, $length = 4, $chunk = 76, $break = "\n") {
$lines = [];
foreach(explode($break, $text) as $line) {
$text = trim(wordwrap($line, $chunk - $length, $break));
foreach(explode($break, $text) as $part) {
$lines[] = str_repeat(" ", $length... | php | {
"resource": ""
} |
q239562 | TranslateMethods.translatePlural | train | public function translatePlural($singular, $plural, $number)
{
$this->checkTranslator();
return $this->translator->translatePlural($singular, $plural, $number);
} | php | {
"resource": ""
} |
q239563 | AdminMeasureUnitController.showAction | train | public function showAction(MeasureUnit $measureunit)
{
$editForm = $this->createForm(MeasureUnitType::class, $measureunit, array(
'action' => $this->generateUrl('admin_shop_measure_unit_update', array('id' => $measureunit->getid())),
'method' => 'PUT',
));
$deleteForm... | php | {
"resource": ""
} |
q239564 | AdminMeasureUnitController.newAction | train | public function newAction()
{
$measureunit = new MeasureUnit();
$form = $this->createForm(MeasureUnitType::class, $measureunit);
return array(
'measureunit' => $measureunit,
'form' => $form->createView(),
);
} | php | {
"resource": ""
} |
q239565 | AdminMeasureUnitController.createAction | train | public function createAction(Request $request)
{
$measureunit = new MeasureUnit();
$form = $this->createForm(new MeasureUnitType(), $measureunit);
if ($form->handleRequest($request)->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($measureunit);
... | php | {
"resource": ""
} |
q239566 | AdminMeasureUnitController.updateAction | train | public function updateAction(MeasureUnit $measureunit, Request $request)
{
$editForm = $this->createForm(new MeasureUnitType(), $measureunit, array(
'action' => $this->generateUrl('admin_shop_measure_unit_update', array('id' => $measureunit->getid())),
'method' => 'PUT',
));
... | php | {
"resource": ""
} |
q239567 | AdminMeasureUnitController.sortAction | train | public function sortAction($field, $type)
{
$this->setOrder('measureunit', $field, $type);
return $this->redirect($this->generateUrl('admin_shop_measure_unit'));
} | php | {
"resource": ""
} |
q239568 | AdminMeasureUnitController.deleteAction | train | public function deleteAction(MeasureUnit $measureunit, Request $request)
{
$form = $this->createDeleteForm($measureunit->getId(), 'admin_shop_measure_unit_delete');
if ($form->handleRequest($request)->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->remove($measure... | php | {
"resource": ""
} |
q239569 | Html.getScript | train | protected function getScript()
{
if (null === $this->getScriptName()) {
$request = $this->frontController->getRequest();
$this->setScriptName($request->getControllerName() . DIRECTORY_SEPARATOR . $request->getActionName());
}
return $this->getScriptName() . '.' . $th... | php | {
"resource": ""
} |
q239570 | Html.setData | train | public function setData(array $data)
{
foreach ($data as $name => $value) {
if (is_string($name)) {
$this->__set($name, $value);
}
}
return $this;
} | php | {
"resource": ""
} |
q239571 | Configuration.getSenderClass | train | public function getSenderClass($options)
{
if (empty($options['sender'])) {
if (function_exists('extension_loaded') && extension_loaded('curl') && PHP_VERSION_ID >= 50300) {
return /**/
'Consumerr\Sender\CurlSender' /**/ /*5.2*'Consumerr_CurlSender'*/
;
} else {
return /**/
'Consumerr\Se... | php | {
"resource": ""
} |
q239572 | Router.add | train | public function add(string $path, $callable): Route{
$route = new Route($path, $callable);
$this->routes[] = $route;
return $route;
} | php | {
"resource": ""
} |
q239573 | PathNormalizer.configureSlashPrefix | train | private function configureSlashPrefix(array $pieces): self
{
$first = array_shift($pieces);
$pattern = sprintf('#^%s#', DIRECTORY_SEPARATOR);
if (preg_match($pattern, $first)) {
$this->prefix .= DIRECTORY_SEPARATOR;
}
return $this;
} | php | {
"resource": ""
} |
q239574 | PathNormalizer.getPartsFromSegment | train | private function getPartsFromSegment(string $segment): array
{
$parts = explode(DIRECTORY_SEPARATOR, $segment);
return array_filter($parts, function ($part) {
return $this->isNotEmpty($part);
});
} | php | {
"resource": ""
} |
q239575 | PathNormalizer.toString | train | protected function toString(): string
{
$normalized = sprintf('%s%s', $this->prefix, implode(DIRECTORY_SEPARATOR, $this->stack));
return trim($normalized);
} | php | {
"resource": ""
} |
q239576 | ServiceFunctions.isValidEmail | train | public function isValidEmail(string $email): bool
{
return filter_var(filter_var($email, FILTER_SANITIZE_EMAIL), FILTER_VALIDATE_EMAIL) !== false;
} | php | {
"resource": ""
} |
q239577 | Command.repl | train | public function repl()
{
$input = $this->prompt();
$buffer = null;
while ($input != 'exit;') {
try {
$buffer .= $input;
if ((new ShallowParser)->statements($buffer)) {
ob_start();
$app = $this->container;
... | php | {
"resource": ""
} |
q239578 | Command.prompt | train | protected function prompt($indent = false)
{
$dialog = $this->getHelperSet()->get('dialog');
$indent = $indent ? '*' : null;
return $dialog->ask($this->output, "<info>encore{$indent}></info>", null);
} | php | {
"resource": ""
} |
q239579 | Filesystem.getActualFileDir | train | public function getActualFileDir($filename, $subDir = self::UPLOADER_SUB_DIR)
{
return $this->getPath(array($this->getMediaRootDir(), $subDir, $this->getFileDirPrefix($filename)));
} | php | {
"resource": ""
} |
q239580 | Filesystem.getFileDirPrefix | train | public function getFileDirPrefix($filename)
{
if (empty($filename)) {
throw new InvalidArgumentException('Invalid filename argument');
}
$path = array();
$parts = explode('.', $filename);
for ($i = 0; $i < min(strlen($parts[0]), $this->prefixSize); $i++) {
... | php | {
"resource": ""
} |
q239581 | Filesystem.getAbsoluteFilePath | train | public function getAbsoluteFilePath($filename, $subDir = self::UPLOADER_SUB_DIR)
{
return $this->getRootDir() . $this->getRelativeFilePath($filename, $subDir);
} | php | {
"resource": ""
} |
q239582 | Filesystem.getRelativeFilePath | train | public function getRelativeFilePath($filename, $subDir = self::UPLOADER_SUB_DIR)
{
$pathParts = array(Media::NAME, $subDir, $this->getFileDirPrefix($filename), $filename);
return DIRECTORY_SEPARATOR . $this->getPath($pathParts);
} | php | {
"resource": ""
} |
q239583 | User.verifyPassword | train | public function verifyPassword($email, $password)
{
$this->find("email", $email);
return password_verify($password, $this->password);
} | php | {
"resource": ""
} |
q239584 | User.isEmailUnique | train | public function isEmailUnique($email)
{
$this->find("email", $email);
if (isset($this->id)) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q239585 | Values.finalize | train | public function finalize() : Values
{
/* @var input\Parameter $parameter */
foreach ($this->definitions as $name => $parameter) {
if (isset($this->items[$name])) {
continue;
}
// In the case of Parameters which do not accept values (ie. optional f... | php | {
"resource": ""
} |
q239586 | Values.assertIsDefined | train | protected function assertIsDefined(string $name) : input\Parameter
{
/* @var input\Parameter $parameter */
if (!$parameter = $this->definitions->get($name)) {
throw new \OutOfBoundsException("The parameter [$name] is not defined.");
}
return $parameter;
} | php | {
"resource": ""
} |
q239587 | NormalizeKeyCapableTrait._normalizeKey | train | protected function _normalizeKey($key)
{
try {
return $this->_normalizeString($key);
} catch (InvalidArgumentException $e) {
throw $this->_createOutOfRangeException($this->__('Invalid key'), null, $e, $key);
}
} | php | {
"resource": ""
} |
q239588 | Doctrine._getLifetime | train | public function _getLifetime(\Doctrine_Record $record)
{
$return = $this->_lifetime;
if (!$this->_overrideLifetime) {
$return = (int) $record->{$this->_lifetimeColumn};
}
return $return;
} | php | {
"resource": ""
} |
q239589 | Operator.get | train | public static function get()
{
return [
self::$equals,
self::$lessThan,
self::$lessThanEqualTo,
self::$greaterThan,
self::$greaterThanEqualTo,
self::$doesNotEqual,
self::$doesNotEqualAlt,
self::$is,
s... | php | {
"resource": ""
} |
q239590 | Assume.that | train | public static function that($condition, $message = null)
{
if ($condition === true) {
return;
}
if (isset($message)) {
throw new InvalidArgumentException($message);
}
$bt = debug_backtrace();
$call = $bt[0];
$lines = file($call['file'])... | php | {
"resource": ""
} |
q239591 | Net_Notifier_Listener.run | train | public function run()
{
$this->connect();
// tell server we want to listen
$this->connection->writeText('{ "action" : "listen" }');
while (!$this->moribund) {
$read = array($this->connection->getSocket()->getRawSocket());
// Suppressing warnings for stream... | php | {
"resource": ""
} |
q239592 | Locale.parse | train | public static function parse($value)
{
if (is_array($value)) {
return static::fromArray((array)$value);
} elseif (is_string($value)) {
return static::fromString((string)$value);
} else {
return null;
}
} | php | {
"resource": ""
} |
q239593 | Locale.fromArray | train | public static function fromArray(array $value)
{
$language = null;
$culture = null;
if (!empty($value['language'])) {
$language = $value['language'];
} elseif ($value[0]) {
$language = $value[0];
}
if (!empty($value['culture'])) {
... | php | {
"resource": ""
} |
q239594 | Locale.fromString | train | public static function fromString(string $value)
{
$locale = preg_split('/-|_/', $value, 2);
$language = null;
$culture = null;
if (isset($locale[0])) {
$language = $locale[0];
}
if (isset($locale[1])) {
$culture = $locale[1];
}
... | php | {
"resource": ""
} |
q239595 | Locale.toString | train | public function toString()
{
if ($this->_language && $this->_culture) {
return (string)$this->_language . '_' . (string)$this->_culture;
} else {
return (string)$this->_language;
}
} | php | {
"resource": ""
} |
q239596 | Imageable.image | train | public function image()
{
if ($this->relationLoaded('mediables')) {
return $this->mediables->where('type', 'image')->first();
}
return $this->mediables()
->where('media.type', 'image')
->whereNull('mediables.type')
->first();
} | php | {
"resource": ""
} |
q239597 | Imageable.setImageAttribute | train | public function setImageAttribute($value)
{
$value = $this->resolveMediableValue($value);
// Dont store or make lazy store
// if current model doesn't exists in database.
if (!$this->exists && $value) {
return $this->attributes['image'] = $value;
} elseif (!$this... | php | {
"resource": ""
} |
q239598 | Imageable.getImageAttribute | train | public function getImageAttribute()
{
// It should have image
if ($this->exists) {
return $this->image();
}
return isset($this->attributes['image']) ? $this->attributes['image'] : null;
} | php | {
"resource": ""
} |
q239599 | Imageable.getImageUrlAttribute | train | public function getImageUrlAttribute()
{
if ($this->exists) {
$image = $this->image();
if ($image) {
return $image->url;
}
return config('media.image.default');
}
return config('media.image.default');
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.