_id
stringlengths 2
7
| title
stringlengths 3
151
| partition
stringclasses 3
values | text
stringlengths 33
8k
| language
stringclasses 1
value | meta_information
dict |
---|---|---|---|---|---|
q267900 | OneOfFilter.matches | test | public function matches(array $data)
{
foreach ($this->filters as $filter) {
| php | {
"resource": ""
} |
q267901 | ConfigurableSchema.createTablesFromConfig | test | public function createTablesFromConfig($config)
{
try{
foreach ($config as $tableName => $className
) {
$this->_addTable(new $className($tableName));
| php | {
"resource": ""
} |
q267902 | ConfigurableSchema.bundleMultipleSchemas | test | public function bundleMultipleSchemas($config)
{
foreach ($config as $alias => $schemaClassName) {
$schema = new $schemaClassName();
| php | {
"resource": ""
} |
q267903 | AbstractGeometricObject.getPoint | test | public function getPoint($name)
{
return isset($this->_points[$name]) ? | php | {
"resource": ""
} |
q267904 | ProvidesCommand.publish | test | public static function publish(Application $app): void
{
$app->console()->addCommand(
(new Command())
->setPath(static::PATH)
->setName(static::COMMAND)
| php | {
"resource": ""
} |
q267905 | LeafRestUrlHandler.getMatchingUrlFragment | test | protected function getMatchingUrlFragment(Request $request, $currentUrlFragment = "")
{
$uri = $currentUrlFragment;
$parentResponse = parent::getMatchingUrlFragment($request, $currentUrlFragment);
if (preg_match('|^' . $this->url . '([0-9]+)/([a-zA-Z0-9\-]+)|', $uri, $matches)) {
if ($this->checkForPotentialAction($matches[2])) {
$this->urlAction = $matches[2];
$this->isCollection = false;
return $matches[0];
}
| php | {
"resource": ""
} |
q267906 | LeafRestUrlHandler.generateResponseForRequest | test | protected function generateResponseForRequest($request = null)
{
$leafClass = $this->getLeafClassName();
if ($this->isCollection()) {
$leaf = new $leafClass($this->getModelCollection());
} else {
if (is_callable($leafClass)){
$leaf = $leafClass($this, $this->getModelObject());
} else {
$leaf = new $leafClass($this->getModelObject());
}
}
$response = | php | {
"resource": ""
} |
q267907 | PEAR_REST.retrieveCacheFirst | test | function retrieveCacheFirst($url, $accept = false, $forcestring = false, $channel = false)
{
$cachefile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .
md5($url) . 'rest.cachefile';
if (file_exists($cachefile)) {
| php | {
"resource": ""
} |
q267908 | StringHelper.endsWith | test | public static function endsWith($string, $with, $caseSensitive = true, $encoding = null)
{
if (!$bytes = static::byteLength($with)) {
return true;
}
if ($caseSensitive) {
// Warning check, see http://php.net/manual/en/function.substr-compare.php#refsect1-function.substr-compare-returnvalues
if (static::byteLength($string) < $bytes) {
return false;
}
return substr_compare($string, $with, -$bytes, $bytes) === 0;
| php | {
"resource": ""
} |
q267909 | StringHelper.countWords | test | public static function countWords($string)
{
$result = preg_split('/\s+/u', | php | {
"resource": ""
} |
q267910 | CreateActingAs.createActingAs | test | protected function createActingAs(array $properties = [], string $userModel = null): Authenticatable
{
$userClass = $userModel ?: config('auth.providers.users.model');
| php | {
"resource": ""
} |
q267911 | Session.init | test | public function init()
{
parent::init();
$self = $this;
//Close session on end of request
$this->app->once(Reaction\RequestApplicationInterface::EVENT_REQUEST_END, function() use (&$self) {
return $self->close();
});
| php | {
"resource": ""
} |
q267912 | Session.open | test | public function open()
{
if ($this->getIsActive()) {
return \Reaction\Promise\resolve(true);
}
$this->registerSessionHandler();
$self = $this;
return $this->openInternal()->then(
function() use ($self) {
| php | {
"resource": ""
} |
q267913 | Session.openInternal | test | protected function openInternal()
{
$self = $this;
if (!$this->getId()) {
$self = $this;
return $this->handler->createId($this->app)
->then(function($id = null) use ($self) {
$self->_isActive = true;
$self->setId($id);
$cookie = $self->createSessionCookie();
$self->app->response->cookies->add($cookie);
return true;
});
} else {
$this->_isActive = true;
return $this->readSession()->then(
function($data) use ($self) {
$self->data = is_array($data) ? $data : [];
| php | {
"resource": ""
} |
q267914 | Session.registerSessionHandler | test | protected function registerSessionHandler()
{
if ($this->handler !== null) {
if (!is_object($this->handler)) {
if (is_string($this->handler) && Reaction::$app->has($this->handler)) {
$this->handler = Reaction::$app->get($this->handler);
} else {
$this->handler = Reaction::create($this->handler);
}
}
if (!$this->handler instanceof SessionHandlerInterface) {
| php | {
"resource": ""
} |
q267915 | Session.close | test | public function close($destroy = false)
{
if ($this->getIsActive()) {
if (Reaction::isDebug()) {
//Reaction::info('Session closed');
| php | {
"resource": ""
} |
q267916 | Session.destroy | test | public function destroy()
{
if ($this->getIsActive()) {
$sessionId = $this->getId();
return $this->close(true)
->otherwise(function() { return true; })
->then(function() use ($sessionId) {
| php | {
"resource": ""
} |
q267917 | Session.regenerateID | test | public function regenerateID($deleteOldSession = false)
{
if ($this->getIsActive()) {
return $this->handler->regenerateId($this->id, $this->app, $deleteOldSession);
}
| php | {
"resource": ""
} |
q267918 | Session.readSession | test | public function readSession($id = null)
{
$id = !isset($id) && isset($this->_sessionId) ? $this->_sessionId : $id;
if (!isset($id)) { | php | {
"resource": ""
} |
q267919 | Session.writeSession | test | public function writeSession($data = null, $id = null)
{
$id = !isset($id) && isset($this->_sessionId) ? $this->_sessionId : $id;
if (!isset($id)) {
| php | {
"resource": ""
} |
q267920 | Session.destroySession | test | public function destroySession($id = null)
{
$id = !isset($id) && isset($this->_sessionId) ? $this->_sessionId : $id;
if (!isset($id)) { | php | {
"resource": ""
} |
q267921 | Session.set | test | public function set($key, $value)
{
$this->open();
$data = $this->data;
| php | {
"resource": ""
} |
q267922 | Session.remove | test | public function remove($key)
{
$this->open();
$data = $this->data;
if (isset($data[$key])) {
| php | {
"resource": ""
} |
q267923 | Session.removeAll | test | public function removeAll()
{
$this->open();
$data = $this->data;
foreach (array_keys($data) as $key) {
unset($data[$key]);
| php | {
"resource": ""
} |
q267924 | Session.getFlash | test | public function getFlash($key, $defaultValue = null, $delete = false)
{
$counters = $this->get($this->flashParam, []);
if (isset($counters[$key])) {
$value = $this->get($key, $defaultValue);
if ($delete) {
$this->removeFlash($key);
} elseif ($counters[$key] < 0) {
// mark for deletion in the next request
| php | {
"resource": ""
} |
q267925 | Session.getAllFlashes | test | public function getAllFlashes($delete = false)
{
$counters = $this->get($this->flashParam, []);
$flashes = [];
foreach (array_keys($counters) as $key) {
if (array_key_exists($key, $this->data)) {
$flashes[$key] = $this->data[$key];
if ($delete) {
unset($counters[$key], $this->data[$key]);
} elseif ($counters[$key] < 0) {
| php | {
"resource": ""
} |
q267926 | Session.setFlash | test | public function setFlash($key, $value = true, $removeAfterAccess = true)
{
$counters = $this->get($this->flashParam, []);
$counters[$key] = $removeAfterAccess ? -1 : 0;
| php | {
"resource": ""
} |
q267927 | Session.addFlash | test | public function addFlash($key, $value = true, $removeAfterAccess = true)
{
$counters = $this->get($this->flashParam, []);
$counters[$key] = $removeAfterAccess ? -1 : 0;
$this->data[$this->flashParam] = $counters;
if (empty($this->data[$key])) {
$this->data[$key] = [$value];
| php | {
"resource": ""
} |
q267928 | Session.removeFlash | test | public function removeFlash($key)
{
$counters = $this->get($this->flashParam, []);
$value = isset($this->data[$key], $counters[$key]) ? $this->data[$key] : null;
| php | {
"resource": ""
} |
q267929 | Session.removeAllFlashes | test | public function removeAllFlashes()
{
$counters = $this->get($this->flashParam, []);
foreach (array_keys($counters) as $key) {
| php | {
"resource": ""
} |
q267930 | Session.freeze | test | protected function freeze()
{
if ($this->getIsActive()) {
if (isset($this->data)) {
$this->frozenSessionData = $this->data;
}
//$this->close();
| php | {
"resource": ""
} |
q267931 | Session.unfreeze | test | protected function unfreeze()
{
if (null !== $this->frozenSessionData) {
//$this->open();
if ($this->getIsActive()) {
Reaction::info('Session unfrozen');
} else {
$error = error_get_last();
$message = isset($error['message']) ? $error['message'] | php | {
"resource": ""
} |
q267932 | Session.createSessionCookie | test | protected function createSessionCookie() {
$_params = $this->getCookieParams();
$config = [
'class' => 'Reaction\Web\Cookie',
];
foreach ($_params as $key => $value) {
if ($key === 'httponly') {
$key = 'httpOnly';
} elseif ($key === 'lifetime') {
$expireValue = intval($value);
if (empty($expireValue)) {
continue;
| php | {
"resource": ""
} |
q267933 | Validator._validateAfter | test | protected function _validateAfter($attribute, $value, $parameters)
{
$this->_requireParameterCount(1, $parameters, 'after');
if (! is_string($value)) {
return false;
}
if ($format = $this->_getDateFormat($attribute)) {
return $this->_validateAfterWithFormat($format, $value, $parameters);
}
| php | {
"resource": ""
} |
q267934 | Validator._validateAfterWithFormat | test | protected function _validateAfterWithFormat($format, $value, $parameters)
{
$param = $this->_getValue($parameters[0]) ?: $parameters[0];
| php | {
"resource": ""
} |
q267935 | Validator._validateDateFormat | test | protected function _validateDateFormat($attribute, $value, $parameters)
{
$this->_requireParameterCount(1, $parameters, 'date_format');
if (! is_string($value)) {
return false;
}
| php | {
"resource": ""
} |
q267936 | NamespaceProphecy.checkPredictions | test | public function checkPredictions()
{
$exception = new AggregateException(sprintf("%s:\n", $this->name));
foreach ($this->prophecies as $prophecy) {
try {
$prophecy->checkPrediction();
} | php | {
"resource": ""
} |
q267937 | AssignByPath.assign | test | function assign(array &$arr, string $path, $value, string $separator = '.')
{
$keys = explode($separator, $path);
foreach ($keys as $key) {
| php | {
"resource": ""
} |
q267938 | Module.getControllerPluginConfig | test | public function getControllerPluginConfig()
{
return [
'factories' => [
'resource' => function(\Zend\Mvc\Controller\PluginManager $sm) {
$event = new ResourceEvent();
| php | {
"resource": ""
} |
q267939 | BaseManager.executeRule | test | protected function executeRule($user, $item, $params)
{
if ($item->ruleName === null) {
return resolve(true);
}
return $this->getRule($item->ruleName)->then(
function($rule) use ($user, $item, $params) {
if ($rule instanceof Rule) {
return $rule->execute($user, $item, $params);
}
| php | {
"resource": ""
} |
q267940 | PEAR_PackageFile_Generator_v1._processMultipleDepsName | test | function _processMultipleDepsName($deps)
{
$ret = $tests = array();
foreach ($deps as $name => $dep) {
foreach ($dep as $d) {
$tests[$name][] = $this->_processDep($d);
}
}
foreach ($tests as $name => $test) {
$max = $min = $php = array();
$php['name'] = $name;
foreach ($test as $dep) {
if (!$dep) {
continue;
}
if (isset($dep['channel'])) {
$php['channel'] = 'pear.php.net';
}
if (isset($dep['conflicts']) && $dep['conflicts'] == 'yes') {
$php['conflicts'] = 'yes';
}
if (isset($dep['min'])) {
$min[$dep['min']] = count($min);
}
if (isset($dep['max'])) {
$max[$dep['max']] = count($max);
}
}
if (count($min) > 0) {
uksort($min, 'version_compare');
}
if (count($max) > 0) {
uksort($max, 'version_compare');
}
if (count($min)) {
// get the highest minimum
$min = array_pop($a = array_flip($min));
} else {
$min = false;
}
| php | {
"resource": ""
} |
q267941 | Fragment.parseFragments | test | public static function parseFragments(array $rawData = [])
{
$fragments = [];
foreach ($rawData as $type => $value) { | php | {
"resource": ""
} |
q267942 | PhpView.make | test | public function make(string $template = null, array $variables = []): View
{
return new | php | {
"resource": ""
} |
q267943 | PhpView.setVariables | test | public function setVariables(array $variables = []): View
{
$this->variables = | php | {
"resource": ""
} |
q267944 | PhpView.setVariable | test | public function setVariable(string $key, $value): View
{
| php | {
"resource": ""
} |
q267945 | PhpView.escape | test | public function escape(string $value): string
{
$value = mb_convert_encoding($value, 'UTF-8', 'UTF-8');
| php | {
"resource": ""
} |
q267946 | PhpView.getTemplateDir | test | public function getTemplateDir(string $path = null): string
{
return $this->templateDir . ($path
| php | {
"resource": ""
} |
q267947 | PhpView.layout | test | public function layout(string $layout = null): View
{
// If no layout has been set
if (null === $layout) {
// Set to null
return $this->withoutLayout();
}
// If we should be tracking layout changes
if ($this->trackLayoutChanges) {
| php | {
"resource": ""
} |
q267948 | PhpView.template | test | public function template(string $template): View
{
$this->template | php | {
"resource": ""
} |
q267949 | PhpView.partial | test | public function partial(string $partial, array $variables = []): string
{
| php | {
"resource": ""
} |
q267950 | PhpView.endBlock | test | public function endBlock(string $name): string
{
unset($this->blockStatus[$name]);
| php | {
"resource": ""
} |
q267951 | PhpView.render | test | public function render(array $variables = []): string
{
// Set the variables with the new variables and this view instance
$this->variables = array_merge(
$this->variables,
$variables,
['view' => $this]
| php | {
"resource": ""
} |
q267952 | PhpView.getFullPath | test | protected function getFullPath(string $template): string
{
// If the first character of the template is an @ symbol
// Then this is a template from a path in the config
if (strpos($template, '@') === 0) {
$explodeOn = Directory::DIRECTORY_SEPARATOR;
$parts = explode($explodeOn, $template);
$path = config('views.paths.' . $parts[0]);
// If there is no path
if ($path === null) {
// Then throw an exception
throw new InvalidConfigPath(
'Invalid path '
. $parts[0]
. ' specified for template '
| php | {
"resource": ""
} |
q267953 | PhpView.renderTemplate | test | protected function renderTemplate(string $templatePath, array $variables = []): string
{
$variables = array_merge($this->variables, $variables);
| php | {
"resource": ""
} |
q267954 | PhpView.renderLayout | test | protected function renderLayout(string $layoutPath): string
{
// Render the layout
$renderedLayout = $this->renderTemplate($layoutPath);
// Check if the layout has changed
if ($this->hasLayoutChanged) {
// Reset the flag
| php | {
"resource": ""
} |
q267955 | RoutesListCommand.setRoute | test | protected function setRoute(Route $route, array &$routes, array &$lengths): void
{
$requestMethod = implode(' | ', $route->getRequestMethods());
$dispatch = 'Closure';
if (null !== $route->getFunction()) {
$dispatch = $route->getFunction();
} elseif (null !== $route->getClass()) {
$dispatch = $route->getClass()
. ($route->isStatic() ? '::' : '->')
. ($route->getMethod()
? $route->getMethod() . '()'
: $route->getProperty());
| php | {
"resource": ""
} |
q267956 | RoutesListCommand.getSepLine | test | protected function getSepLine(array $lengths): string
{
return '+-' . str_repeat('-', $lengths[0])
. '-+-' . str_repeat('-', $lengths[1])
| php | {
"resource": ""
} |
q267957 | RoutesListCommand.headerMessage | test | protected function headerMessage(array $headerTexts, array $lengths): void
{
$headerMessage = '| ' . $headerTexts[0]
. str_repeat(' ', $lengths[0] - \strlen($headerTexts[0]))
. ' | ' . $headerTexts[1]
. str_repeat(' ', $lengths[1] - \strlen($headerTexts[1]))
. ' | ' . $headerTexts[2]
| php | {
"resource": ""
} |
q267958 | Factory.getNotification | test | public static function getNotification()
{
$notificationClassList = ClassMapGenerator::createMap(base_path().'/vendor/abuseio');
/** @noinspection PhpUnusedParameterInspection */
$notificationClassListFiltered = array_where(
array_keys($notificationClassList),
function ($value, $key) {
// Get all notifications, ignore all other packages.
| php | {
"resource": ""
} |
q267959 | Factory.create | test | public static function create($requiredName)
{
/**
* Loop through the notification list and try to find a match by name
*/
$notifications = Factory::getNotification();
foreach ($notifications as $notificationName) {
if ($notificationName === ucfirst($requiredName)) {
$notificationClass = 'AbuseIO\\Notification\\' . $notificationName;
// Collector is enabled, then return its object
| php | {
"resource": ""
} |
q267960 | UploadableTrait.setKey | test | public function setKey($key)
{
$this->key = $key;
if (0 < strlen($this->key) && !$this->hasRename()) {
if ($this->hasPath()) {
$this->rename = pathinfo($this->path, PATHINFO_BASENAME);
} else {
| php | {
"resource": ""
} |
q267961 | UploadableTrait.shouldBeRenamed | test | public function shouldBeRenamed()
{
return (bool) ($this->hasPath() | php | {
"resource": ""
} |
q267962 | UploadableTrait.guessExtension | test | public function guessExtension()
{
$extension = null;
if ($this->hasFile()) {
$extension = $this->file->guessExtension();
} elseif ($this->hasKey()) {
$extension = pathinfo($this->getKey(), PATHINFO_EXTENSION);
} elseif ($this->hasPath()) {
| php | {
"resource": ""
} |
q267963 | UploadableTrait.guessFilename | test | public function guessFilename()
{
// Extension
$extension = $this->guessExtension();
// Filename
$filename = null;
if ($this->hasRename()) {
$filename = Transliterator::urlize(pathinfo($this->rename, PATHINFO_FILENAME));
} elseif ($this->hasFile()) {
$filename = pathinfo($this->file->getFilename(), PATHINFO_FILENAME);
} elseif ($this->hasKey()) {
| php | {
"resource": ""
} |
q267964 | UploadableTrait.setRename | test | public function setRename($rename)
{
if ($rename !== $this->rename) {
$this->updatedAt = new \DateTime();
| php | {
"resource": ""
} |
q267965 | FileController.downloadAction | test | public function downloadAction(Request $request)
{
$key = $request->attributes->get('key');
if (0 < strlen($key)) {
$fs = $this->get('local_upload_filesystem');
if ($fs->has($key)) {
$file = $fs->get($key);
// TODO 304 not modified
$response = new StreamedResponse();
// Set the headers
$response->headers->set('Content-Type', $file->getMimetype());
$response->headers->set('Content-Length', $file->getSize());
// TODO http cache
/*$this->setHttpCacheHeaders(
| php | {
"resource": ""
} |
q267966 | FileController.tinymceUploadAction | test | public function tinymceUploadAction(Request $request)
{
// TODO check admin ?
if (!$request->isXmlHttpRequest()) {
throw new NotFoundHttpException();
}
$name = $request->request->get('name');
$base64 = $request->request->get('data');
$filename = md5(time().uniqid()).".jpg";
| php | {
"resource": ""
} |
q267967 | KernelEventSubscriber.onKernelException | test | public function onKernelException(GetResponseForExceptionEvent $event)
{
$exception = $event->getException();
if ($exception instanceof NotFoundHttpException) {
$request = $event->getRequest();
$registry = $this->container->get('ekyna_core.redirection.provider_registry');
foreach ($registry->getProviders() as $provider) {
if ($provider->supports($request) && false !== $response = $provider->redirect($request)) {
if ($response instanceof RedirectResponse) {
$event->setResponse($response);
} elseif (is_string($response) && 0 < strlen($response)) {
$response = $this->container
->get('security.http_utils')
->createRedirectResponse($request, $response, 301)
;
$event->setResponse($response);
}
return;
}
}
} elseif ($exception instanceof RedirectException) {
// Check path
$path = $exception->getPath();
if (0 === strlen($path)) {
return;
}
// Build the response
$request = $event->getRequest();
$response = $this->container
->get('security.http_utils')
->createRedirectResponse($request, $path)
;
$event->setResponse($response);
// Add flash
if (0 < strlen($message = $exception->getMessage())) {
$this->container
->get('session')
->getFlashBag()
->add($exception->getMessageType(), $message)
;
}
} elseif ($exception instanceof HttpException) {
| php | {
"resource": ""
} |
q267968 | Download.getCurl | test | private function getCurl(string $url, int $return = 1, int $timeout = 10, string $lang = 'de-DE')
{
// Define useragent
$agent = 'Mozilla/5.0 (Windows; U; Windows NT 6.1; ' . $lang . '; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12';
// Url encode
$url = urlencode($url);
// Language of request
$lang = array(
'Accept-Language: ' . $lang
);
$curl = curl_init();
| php | {
"resource": ""
} |
q267969 | Http.execute | test | public function execute() {
if ($this->isMulti) {
return;
}
$this->applyMethod();
$this->responseText = curl_exec($this->curl);
| php | {
"resource": ""
} |
q267970 | Http.setCookieFile | test | public function setCookieFile($file) {
$file = (string)$file;
| php | {
"resource": ""
} |
q267971 | Http.chooseParameters | test | protected static function chooseParameters(array $item, array $args) {
$data = static::getMapParameters($item, $args);
if (empty($data)) {
| php | {
"resource": ""
} |
q267972 | ItemController.actionIndex | test | public function actionIndex()
{
$items = Item::updateAll(Yii::$app->request->post('Item'));
if ($items === true) {
Yii::$app->session->setFlash('info', Yii::t('modules/module', 'Updated'));
return $this->refresh();
} else if (!$items) {
| php | {
"resource": ""
} |
q267973 | Alert.initOptions | test | protected function initOptions()
{
$this->htmlHlp->addCssClass($this->options, ['alert']);
if ($this->closeButton !== false) {
$this->htmlHlp->addCssClass($this->options, ['alert-dismissible', 'fade', 'show']);
$this->closeButton = array_merge([
'data-dismiss' => | php | {
"resource": ""
} |
q267974 | Zend_Config_Writer_FileAbstract.write | test | public function write($filename = null, Zend_Config $config = null, $exclusiveLock = null)
{
if ($filename !== null) {
$this->setFilename($filename);
}
if ($config !== null) {
$this->setConfig($config);
}
if ($exclusiveLock !== null) {
$this->setExclusiveLock($exclusiveLock);
}
if ($this->_filename === null) {
throw new Zend_Config_Exception('No filename was set');
}
if ($this->_config === null) {
throw new Zend_Config_Exception('No config was set');
} | php | {
"resource": ""
} |
q267975 | ExceptionExtractorTrait.getExceptionFromContext | test | protected function getExceptionFromContext(array $context)
{
$exception = $context['exception'] ?? null;
if ($exception instanceof \Exception) {
return $exception;
}
if ($exception instanceof \Error) {
return new \ErrorException(
$exception->getMessage(),
0,
| php | {
"resource": ""
} |
q267976 | ErrorHandler.convertExceptionToArray | test | protected function convertExceptionToArray($exception)
{
if (!Reaction::isDebug() && !$exception instanceof UserException && !$exception instanceof HttpException) {
$exception = new HttpException(500, Reaction::t('rct', 'An internal server error occurred.'));
}
$array = [
'name' => ($exception instanceof Exception || $exception instanceof ErrorException) ? $exception->getName() : 'Exception',
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
];
if ($exception instanceof HttpException) {
$array['status'] = $exception->statusCode;
}
if (Reaction::isDebug()) {
| php | {
"resource": ""
} |
q267977 | ErrorHandler.renderFile | test | public function renderFile($_file_, $_params_)
{
$_params_['handler'] = $this;
if ($this->exception instanceof ErrorException || !$this->app->has('view')) {
ob_start();
ob_implicit_flush(false);
extract($_params_, EXTR_OVERWRITE);
| php | {
"resource": ""
} |
q267978 | ErrorHandler.isCoreFile | test | public function isCoreFile($file)
{
$corePath = Reaction::getAlias('@reaction');
return | php | {
"resource": ""
} |
q267979 | ErrorHandler.getExceptionName | test | public function getExceptionName($exception)
{
if (
$exception instanceof \Reaction\Exceptions\Exception
|| $exception instanceof \Reaction\Exceptions\InvalidCallException
|| $exception instanceof \Reaction\Exceptions\InvalidParamException
| php | {
"resource": ""
} |
q267980 | minifyHTMLResponsePlugin.beforeOutput | test | public function beforeOutput() {
if (!($this->response instanceof jResponseHtml))
return;
$conf = &jApp::config()->jResponseHtml;
$basePath = jApp::urlBasePath();
if (isset($conf['minifyCSS']) && $conf['minifyCSS']) {
if (isset($conf['minifyExcludeCSS']) && $conf['minifyExcludeCSS']) {
$this->excludeCSS = preg_split( '/\s*,\s*/', $conf['minifyExcludeCSS'] );
foreach($this->excludeCSS as $k=>$url) {
if (substr($url,0,1) != '/')
$this->excludeCSS[$k]= $basePath.$url;
}
}
$this->response->setCSSLinks($this->generateMinifyList($this->response->getCSSLinks(), 'excludeCSS'));
$this->response->setCSSIELinks($this->generateMinifyList($this->response->getCSSIELinks(), 'excludeCSS'));
}
if (isset($conf['minifyJS']) && $conf['minifyJS']) {
| php | {
"resource": ""
} |
q267981 | minifyHTMLResponsePlugin.generateMinifyList | test | protected function generateMinifyList($list, $exclude) {
$pendingList = array();
$pendingParameters = false;
$resultList = array();
foreach ($list as $url=>$parameters) {
if(preg_match('#^https?\://#', $url) || in_array($url, $this->$exclude) ) {
// for absolute or exculded url, we put directly in the result
// we won't try to minify it or combine it with an other file
$resultList[$url] = $parameters;
continue;
}
ksort($parameters);
if ($pendingParameters === false) {
$pendingParameters = $parameters;
$pendingList[] = $url;
continue;
}
if ($pendingParameters == $parameters) {
| php | {
"resource": ""
} |
q267982 | BudgetAbstract.setAmountDefault | test | public function setAmountDefault($amountDefault)
{
$amountDefault = (float) $amountDefault;
if ($this->exists() && | php | {
"resource": ""
} |
q267983 | BudgetAbstract.setDateStart | test | public function setDateStart($dateStart)
{
$dateStart = (string) $dateStart;
if ($this->exists() && $this->dateStart !== $dateStart) {
$this->updated['dateStart'] | php | {
"resource": ""
} |
q267984 | BudgetAbstract.setDateEnd | test | public function setDateEnd($dateEnd)
{
$dateEnd = ($dateEnd === null ? $dateEnd : (string) $dateEnd);
if ($this->exists() && $this->dateEnd !== $dateEnd) {
| php | {
"resource": ""
} |
q267985 | BudgetAbstract.setIsRecurrent | test | public function setIsRecurrent($isRecurrent)
{
$isRecurrent = (bool) $isRecurrent;
if ($this->exists() && $this->isRecurrent !== $isRecurrent) {
$this->updated['isRecurrent'] | php | {
"resource": ""
} |
q267986 | BudgetAbstract.setMonthBitmask | test | public function setMonthBitmask($monthBitmask)
{
$monthBitmask = (int) $monthBitmask;
if ($this->monthBitmask < 0) {
throw new \UnderflowException('Value of "monthBitmask" | php | {
"resource": ""
} |
q267987 | BudgetAbstract.getAllBudgetCategory | test | public function getAllBudgetCategory($isForceReload = false)
{
if ($isForceReload || null === $this->joinManyCacheBudgetCategory) {
$mapper = new BudgetCategoryMapper($this->dependencyContainer->getDatabase('money'));
$mapper->addWhere('budget_id', $this->getId());
| php | {
"resource": ""
} |
q267988 | BudgetAbstract.getAllBudgetMonth | test | public function getAllBudgetMonth($isForceReload = false)
{
if ($isForceReload || null === $this->joinManyCacheBudgetMonth) {
$mapper = new BudgetMonthMapper($this->dependencyContainer->getDatabase('money'));
$mapper->addWhere('budget_id', $this->getId());
| php | {
"resource": ""
} |
q267989 | SafePDO.execute | test | protected function execute($sql, array $values = [], \Closure $callback = null)
{
if($statement = $this->pdo->prepare($sql)) {
if($statement->execute($values)) {
// format output
| php | {
"resource": ""
} |
q267990 | SafePDO.error | test | protected function error($sql, \PDOStatement $statement = null)
{
$error = $this->pdo->errorInfo();
if(!$error[1] and $statement) {
$error = $statement->errorInfo();
$statement->closeCursor();
unset($statement);
}
| php | {
"resource": ""
} |
q267991 | Composer.path | test | public static function path($path)
{
$loaders = spl_autoload_functions();
$loader = require $path;
// Check whether autoloader is registered at all
if ($loaders and in_array(array($loader, 'loadClass'), $loaders))
{
// Create new loader first using the previous one | php | {
"resource": ""
} |
q267992 | Migration.up | test | public function up()
{
$transaction = $this->db->createTransaction();
return $transaction->begin()->thenLazy(
function($connection) {
//Set transaction connection
$this->_connection = $connection;
$promise = $this->safeUp($connection);
return is_array($promise) ? allInOrder($promise) : $promise;
}
)->thenLazy(
function() use ($transaction) {
return $transaction->commit();
},
function($error) use ($transaction) {
| php | {
"resource": ""
} |
q267993 | Migration.down | test | public function down()
{
$transaction = $this->db->createTransaction();
return $transaction->begin()->thenLazy(
function($connection) {
$promise = $this->safeDown($connection);
return is_array($promise) ? allInOrder($promise) : $promise;
}
)->thenLazy(
function() use ($transaction) {
return $transaction->commit();
},
| php | {
"resource": ""
} |
q267994 | Migration.insert | test | public function insert($table, $columns)
{
$cmdPromise = $this->createCommand()->insert($table, $columns)->execute();
| php | {
"resource": ""
} |
q267995 | Migration.batchInsert | test | public function batchInsert($table, $columns, $rows)
{
$cmdPromise = $this->createCommand()->batchInsert($table, $columns, $rows)->execute();
| php | {
"resource": ""
} |
q267996 | Migration.update | test | public function update($table, $columns, $condition = '', $params = [])
{
$cmdPromise = $this->createCommand()->update($table, $columns, $condition, | php | {
"resource": ""
} |
q267997 | Migration.delete | test | public function delete($table, $condition = '', $params = [])
{
$cmdPromise = $this->createCommand()->delete($table, $condition, $params)->execute();
| php | {
"resource": ""
} |
q267998 | Migration.renameTable | test | public function renameTable($table, $newName)
{
$cmdPromise = $this->createCommand()->renameTable($table, $newName)->execute();
| php | {
"resource": ""
} |
q267999 | Migration.dropTable | test | public function dropTable($table)
{
$cmdPromise = $this->createCommand()->dropTable($table)->execute();
return | php | {
"resource": ""
} |