_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q265800
jSoapRequest.getParam
test
public function getParam($name, $defaultValue=null, $useDefaultIfEmpty=false){ if (!isset($this->params[$name])) { return $defaultValue; } // we cannot use the empty() function because 0 returns true. And maybe we want 0 // as a normal value... if (is_scalar($this->pa...
php
{ "resource": "" }
q265801
ExistValidator.checkTargetRelationExistence
test
private function checkTargetRelationExistence($model, $attribute) { /** @var ActiveQuery $relationQuery */ $relationQuery = $model->{'get' . ucfirst($this->targetRelation)}(); if ($this->filter instanceof \Closure) { call_user_func($this->filter, $relationQuery); } elsei...
php
{ "resource": "" }
q265802
ExistValidator.checkTargetAttributeExistence
test
private function checkTargetAttributeExistence($model, $attribute) { $targetAttribute = $this->targetAttribute === null ? $attribute : $this->targetAttribute; $params = $this->prepareConditions($targetAttribute, $model, $attribute); $conditions = [$this->targetAttributeJunction == 'or' ? 'or...
php
{ "resource": "" }
q265803
ExistValidator.valueExists
test
private function valueExists($query, $value) { if (is_array($value)) { return $query->count("DISTINCT [[$this->targetAttribute]]") ->then(function($count) use ($value) { return $count == count($value) ? true : reject(new Error("Not exists (count mismatch)")); ...
php
{ "resource": "" }
q265804
AbstractMySqlDao.getClause
test
protected final function getClause(TableInterface $table): string { $mySql = ""; $column = $table->get($table::ATTR_COLUMN); foreach ($table->get($table::ATTR_CLAUSE) as $key => $clause) { $mySql .= rtrim(" " . $this->constant($clause->getType()) . " " . $clause->g...
php
{ "resource": "" }
q265805
Renderer.render
test
public function render(Modal $modal, $template = 'EkynaCoreBundle:Modal:modal.xml.twig') { $response = new Response(); // Translations $modal->setTitle($this->translator->trans($modal->getTitle())); $buttons = $modal->getButtons(); foreach($buttons as &$button) { ...
php
{ "resource": "" }
q265806
FileHelper.localize
test
public function localize($file, $language = null, $sourceLanguage = null) { return $this->proxyWithLanguage(__FUNCTION__, [$file, $language, $sourceLanguage], -2); }
php
{ "resource": "" }
q265807
Stream.detach
test
public function detach() { $previous_stream = $this->stream; $this->stream = null; $this->meta_data = null; return $previous_stream; }
php
{ "resource": "" }
q265808
Stream.read
test
public function read($length) { if (!$this->isReadable()) { throw new \RuntimeException('Could not read the stream because it is not readable'); } $string = fread($this->stream, (int)$length); if ($string === false) { throw new \RuntimeException('Could not re...
php
{ "resource": "" }
q265809
NativeRequest.factory
test
public static function factory( array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null ): Request { return new static( $query, $request, ...
php
{ "resource": "" }
q265810
NativeRequest.createFromGlobals
test
public static function createFromGlobals(): Request { // Create a new request from the PHP globals /** @var Request $request */ $request = new static($_GET, $_POST, [], $_COOKIE, $_FILES, $_SERVER); if ( 0 === strpos( $request->headers()->get('Content-Typ...
php
{ "resource": "" }
q265811
NativeRequest.setServer
test
public function setServer(array $server = []): Request { $server = $server ?: $_SERVER; $this->server = new Server($server); return $this; }
php
{ "resource": "" }
q265812
NativeRequest.setHeaders
test
public function setHeaders(array $headers = []): Request { $headers = $headers ?: $this->server()->getHeaders(); $this->headers = new Headers($headers); return $this; }
php
{ "resource": "" }
q265813
NativeRequest.getPath
test
public function getPath(): string { if (null === $this->path) { $this->path = $this->server()->get('REQUEST_URI'); } return $this->path; }
php
{ "resource": "" }
q265814
NativeRequest.getPathOnly
test
public function getPathOnly(): string { $requestUri = $this->getPath(); // Determine if the request uri has any query parameters if (false !== $queryPosition = strpos($requestUri, '?')) { // If so get the substring of the uri from start until the query param position ...
php
{ "resource": "" }
q265815
NativeRequest.getHttpHost
test
public function getHttpHost(): string { $scheme = $this->getScheme(); $port = $this->getPort(); if ( ('http' === $scheme && $port === 80) || ('https' === $scheme && $port === 443) ) { return $this->getHost(); } return $this->get...
php
{ "resource": "" }
q265816
NativeRequest.setMethod
test
public function setMethod(string $method): Request { $this->method = null; $this->server->set('REQUEST_METHOD', $method); return $this; }
php
{ "resource": "" }
q265817
NativeRequest.getMethod
test
public function getMethod(): string { if (null === $this->method) { $this->method = strtoupper( $this->server->get('REQUEST_METHOD', RequestMethod::GET) ); if (RequestMethod::POST === $this->method) { if ($method = $this->headers->get('X-H...
php
{ "resource": "" }
q265818
NativeRequest.getMimeType
test
public function getMimeType(string $format): string { return isset(static::$formats[$format]) ? static::$formats[$format][0] : null; }
php
{ "resource": "" }
q265819
NativeRequest.getFormat
test
public function getFormat(string $mimeType): string { $canonicalMimeType = null; if (false !== $pos = strpos($mimeType, ';')) { $canonicalMimeType = substr($mimeType, 0, $pos); } foreach (static::FORMATS as $format => $mimeTypes) { if (\in_array($mimeType, $...
php
{ "resource": "" }
q265820
NativeRequest.getRequestFormat
test
public function getRequestFormat(string $default = 'html'): string { if (null === $this->format) { $this->format = $this->attributes->get('_format', $default); } return $this->format; }
php
{ "resource": "" }
q265821
TemplateViewProcessor.render
test
public function render($controller, $method, $parameters) { $templateMapping = []; foreach ($this->templateRoots as $templateRoot) { if ($templateRoot['name']) { $templateMapping[$templateRoot['name']] = $templateRoot['directory']; } } foreach ($this->templateRoots as $templateRoot) { try { re...
php
{ "resource": "" }
q265822
StaticApplicationAbstract.initHttp
test
public function initHttp() { $this->socket = Reaction::create(SocketServerInterface::class); $this->http = Reaction::create(Http::class, [$this->middleware]); $this->http->listen($this->socket); //Exception handler $this->http->on('error', function(\Throwable $error) { ...
php
{ "resource": "" }
q265823
StaticApplicationAbstract.addMiddleware
test
public function addMiddleware($middleware) { if (!is_callable($middleware) && !is_array($middleware)) { throw new InvalidArgumentException("Middleware must be a valid callable"); } else { $this->middleware[] = $middleware; } }
php
{ "resource": "" }
q265824
StaticApplicationAbstract.createRequestApplication
test
public function createRequestApplication(ServerRequestInterface $request) { $config = Reaction::$config->get('appRequest'); $config = ['request' => $request] + $config; $app = Reaction::create($config); return $app; }
php
{ "resource": "" }
q265825
StaticApplicationAbstract.setAlias
test
public function setAlias($alias, $path) { if (strncmp($alias, '@', 1)) { $alias = '@' . $alias; } $pos = strpos($alias, '/'); $root = $pos === false ? $alias : substr($alias, 0, $pos); if ($path !== null) { $path = strncmp($path, '@', 1) ? rtrim($path,...
php
{ "resource": "" }
q265826
StaticApplicationAbstract.setAliases
test
public function setAliases($aliases) { foreach ($aliases as $alias => $path) { $this->setAlias($alias, $path); } }
php
{ "resource": "" }
q265827
StaticApplicationAbstract.getErrorLogLevel
test
protected function getErrorLogLevel($code) { $levels = [ E_ERROR => ['error', [Console::FG_RED, Console::BOLD]], E_WARNING => ['warning', [Console::FG_YELLOW, Console::BOLD]], E_PARSE => ['parse error', Console::FG_RED], E_NOTICE => ['notice', Console::FG_YELL...
php
{ "resource": "" }
q265828
Generator.generate
test
public static function generate($originalClassName, array $methods = null, array $properties = null, $proxyClassName = '', $callAutoload = false) { self::$exposeMethods = false; self::$exposeProperties = false; if ($proxyClassName == '') { $k...
php
{ "resource": "" }
q265829
Generator.getMethodCallParameters
test
public static function getMethodCallParameters($method) { $parameters = array(); foreach ($method->getParameters() as $i => $parameter) { $parameters[] = '$' . $parameter->getName(); } return join(', ', $parameters); }
php
{ "resource": "" }
q265830
Generator.generateProxy
test
protected static function generateProxy($originalClassName, array $methods = null, array $properties = null, $proxyClassName = '', $callAutoload = false) { $templateDir = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR; $classTemplate = s...
php
{ "resource": "" }
q265831
Generator.getProxiedProperties
test
protected static function getProxiedProperties($fullClassName, \ReflectionClass $class, array $properties = null) { $proxiedProperties = ''; $templateDir = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR; $proxyProperties = $class->getProperties(\ReflectionMethod::IS_PROTEC...
php
{ "resource": "" }
q265832
Generator.getProxiedMethods
test
protected static function getProxiedMethods($fullClassName, \ReflectionClass $class, array $methods = null) { $proxyMethods = array(); $proxiedMethods = ''; $templateDir = __DIR__ . DIRECTORY_SEPARATOR . 'Generator' . DIRECTORY_SEPARATOR; if (is_array($methods) && count($methods) > ...
php
{ "resource": "" }
q265833
Generator.generateProxyClassName
test
protected static function generateProxyClassName($originalClassName, $proxyClassName) { $classNameParts = explode('\\', $originalClassName); $namespaceName = ''; $fullClassName = $originalClassName; if (count($classNameParts) > 1) { $originalClassName = array_pop($classN...
php
{ "resource": "" }
q265834
Generator.getArgumentDeclaration
test
protected static function getArgumentDeclaration(\ReflectionMethod $method) { $declarations = array(); $parameters = explode(', ', self::getMethodParameters($method)); foreach ($parameters as $parameter) { if (0 < strpos(trim($parameter), ' $') && false === strpos($parameter, '...
php
{ "resource": "" }
q265835
Generator.canProxyMethod
test
protected static function canProxyMethod(\ReflectionMethod $method) { if ($method->isConstructor() || $method->isFinal() || $method->isStatic() || isset(self::$blacklistedMethodNames[$method->getName()]) ) { return false; } elseif ($method->isProtected()) { return tru...
php
{ "resource": "" }
q265836
Generator.canProxyMethods
test
protected static function canProxyMethods(array $methods) { $proxyMethods = array(); foreach ($methods as $method) { if (self::canProxyMethod($method)) { $proxyMethods[] = $method; } } return $proxyMethods; }
php
{ "resource": "" }
q265837
Generator.traverseStructure
test
protected static function traverseStructure($iterator) { $children = ''; while ($iterator->valid()) { if ($iterator->hasChildren()) { $current = 'array (' . self::traverseStructure($iterator->getChildren()) . '), '; } else { $current = "'" . $...
php
{ "resource": "" }
q265838
Generator.getMethodParameters
test
public static function getMethodParameters($method, $forCall = FALSE) { $parameters = array(); foreach ($method->getParameters() as $i => $parameter) { $name = '$' . $parameter->getName(); /* Note: PHP extensions may use empty names for reference arguments * or...
php
{ "resource": "" }
q265839
CreatePackagistHook.create
test
public function create(string $repoName) { $this->getGithubAuthentication()->authenticate(); $this->getHooksApi()->create($this->getGithubUsername(), $repoName, [ 'name' => 'packagist', 'config' => [ 'user' => $this->getPackagistUser(), 'token' => $this->getPackagistApiToken() ...
php
{ "resource": "" }
q265840
DbMessageSource.loadMessages
test
protected function loadMessages($category, $language) { if ($this->enableCaching) { $cacheKey = [ __CLASS__, $category, $language, ]; return $this->cache ->get($cacheKey) ->then(function($data...
php
{ "resource": "" }
q265841
Valkyrja.setup
test
public function setup(array $config = null, bool $force = false): void { // If the application was already setup, no need to do it again if (self::$setup && false === $force) { return; } // Avoid re-setting up the app later self::$setup = true; // Set the...
php
{ "resource": "" }
q265842
Valkyrja.bootstrapConfig
test
protected function bootstrapConfig(array $config = null): void { $cacheFilePath = Directory::cachePath('config.php'); // If we should use the config cache file if (is_file($cacheFilePath)) { // Get the config from the cache file's contents self::$config = require $ca...
php
{ "resource": "" }
q265843
Valkyrja.bootstrapCore
test
protected function bootstrapCore(): void { // The events class to use from the config $eventsImpl = self::$config['app']['events']; // The container class to use from the config $containerImpl = self::$config['app']['container']; // The dispatcher class to use from the config...
php
{ "resource": "" }
q265844
Valkyrja.bootstrapContainer
test
protected function bootstrapContainer(): void { // Set the application instance in the container self::$container->singleton(Application::class, $this); // Set the events instance in the container self::$container->singleton('env', self::$env); // Set the events instance in t...
php
{ "resource": "" }
q265845
Valkyrja.env
test
public static function env(string $variable = null, $default = null) { // If there was no variable requested if (null === $variable) { // Return the env class return static::getEnv(); } // If the env has this variable defined and the variable isn't null ...
php
{ "resource": "" }
q265846
Valkyrja.setEnv
test
public static function setEnv(string $env = null): void { // Set the env class to use self::$env = $env ?? self::$env ?? Env::class; }
php
{ "resource": "" }
q265847
Valkyrja.config
test
public function config(string $key = null, $default = null) { // If no key was specified if (null === $key) { // Return all the entire config return self::$config; } // Explode the keys on period $keys = explode('.', $key); // Set the config t...
php
{ "resource": "" }
q265848
Valkyrja.abort
test
public function abort( int $statusCode = StatusCode::NOT_FOUND, string $message = '', array $headers = [], int $code = 0, Response $response = null ): void { throw new HttpException($statusCode, $message, null, $headers, $code, $response); }
php
{ "resource": "" }
q265849
Valkyrja.redirectTo
test
public function redirectTo(string $uri = null, int $statusCode = StatusCode::FOUND, array $headers = []): void { throw new HttpRedirectException($statusCode, $uri, null, $headers, 0); }
php
{ "resource": "" }
q265850
Valkyrja.response
test
public function response(string $content = '', int $statusCode = StatusCode::OK, array $headers = []): Response { /** @var Response $response */ $response = $this->container()->getSingleton(Response::class); if (\func_num_args() === 0) { return $response; } retu...
php
{ "resource": "" }
q265851
Valkyrja.redirectRoute
test
public function redirectRoute( string $route, array $parameters = [], int $statusCode = StatusCode::FOUND, array $headers = [] ): RedirectResponse { // Get the uri from the router using the route and parameters $uri = $this->router()->routeUrl($route, $parameters); ...
php
{ "resource": "" }
q265852
Valkyrja.view
test
public function view(string $template = '', array $variables = []): View { /** @var \Valkyrja\View\View $view */ $view = $this->container()->getSingleton(View::class); if (\func_num_args() === 0) { return $view; } return $view->make($template, $variables); }
php
{ "resource": "" }
q265853
Config.get
test
public function get($key) { if(!$this->exists($key)) { return false; } return array_get($this->items, $key); }
php
{ "resource": "" }
q265854
Schema.validateKey
test
public function validateKey(string $key) { if (false === isset($this->definitions[$key])) { throw new \InvalidArgumentException(sprintf( 'Descriptor "%s" not a permitted descriptor key. Did you make a typo? Permitted descriptors: "%s"', $key, implo...
php
{ "resource": "" }
q265855
Schema.validate
test
public function validate(string $key, DescriptorInterface $descriptor) { $this->validateKey($key); $definition = $this->definitions[$key]; if (get_class($descriptor) !== $definition->getClass()) { throw new \InvalidArgumentException(sprintf( 'Descriptor with key ...
php
{ "resource": "" }
q265856
CacheInvalidator.getCacheInvalidationSettings
test
public function getCacheInvalidationSettings() { if($this->cacheInvalidationSettings == null) { $this->cacheInvalidationSettings = '[]'; } return json_decode($this->cacheInvalidationSettings, true); }
php
{ "resource": "" }
q265857
CacheInvalidator.setCacheInvalidationSettings
test
public function setCacheInvalidationSettings($settings) { $this->cacheInvalidationSettings = is_string($settings) ? $settings : json_encode($settings, JSON_PRETTY_PRINT); return $this; }
php
{ "resource": "" }
q265858
Logger.init
test
protected function init(array $user_options = array(), $logname = null) { $app_config = CarteBlanche::getConfig('log', array(), true); $app_config['directory'] = CarteBlanche::getFullPath('log_dir'); $user_config = CarteBlanche::getConfig('log', array()); if (!empty($user_config)) { ...
php
{ "resource": "" }
q265859
Logger.getFilePath
test
protected function getFilePath($level = 100) { $mode = CarteBlanche::getKernel()->getMode(); return DirectoryHelper::slashDirname($this->directory) .$this->getFileName($level) .($mode!='prod' ? '_'.$mode : '' ) .'.'.trim($this->logfile_extension, '.'); }
php
{ "resource": "" }
q265860
Password.verify
test
public function verify($password, $hash) { $verify = password_verify($password, $hash); if (true === $verify && $this->isRehashIfNeeded() && $this->needsRehash($hash)) { $newHash = $this->create($password); $verify = [ 'verify' => true, 'hash'...
php
{ "resource": "" }
q265861
Zend_Filter_RealPath.setExists
test
public function setExists($exists) { if ($exists instanceof Zend_Config) { $exists = $exists->toArray(); } if (is_array($exists)) { if (isset($exists['exists'])) { $exists = (boolean) $exists['exists']; } } $this->_exists ...
php
{ "resource": "" }
q265862
Progress.renderProgress
test
protected function renderProgress() { if (empty($this->bars)) { $config = ['percent' => $this->percent, 'animated' => $this->animated, 'striped' => $this->striped]; return $this->renderBar($config, $this->label, $this->barOptions); } $bars = []; foreach ($this...
php
{ "resource": "" }
q265863
Progress.renderBar
test
protected function renderBar($config = [], $label, $options = []) { $percent = ArrayHelper::getValue($config, 'percent', 0); $animated = ArrayHelper::getValue($config, 'animated', false); $striped = ArrayHelper::getValue($config, 'striped', false) || $animated; $percentFixed = number_for...
php
{ "resource": "" }
q265864
jSoapCoordinator.processSoap
test
public function processSoap(){ $this->wsdl = new jWSDL($this->request->params['module'], $this->request->params['action']); $this->soapServer = $this->getSoapServer($this->wsdl); $this->soapServer->setclass('jSoapHandler', $this); $this->soapServer->handle($this->request->soapMsg); ...
php
{ "resource": "" }
q265865
jSoapCoordinator.getSoapServer
test
public function getSoapServer($wsdl = null){ if(is_null($this->soapServer)){ if(is_null($wsdl)){ $this->soapServer = new SoapServer(null, array('soap_version' => SOAP_1_1, 'encoding' => jApp::config()->charset, 'uri' => $_SERVER['PHP_SELF'])); }else{ $thi...
php
{ "resource": "" }
q265866
TaggedEntityListener.onFlush
test
public function onFlush(OnFlushEventArgs $eventArgs) { $em = $eventArgs->getEntityManager(); $uow = $em->getUnitOfWork(); foreach ($uow->getScheduledEntityInsertions() as $entity) { $this->invalidateEntity($entity); } foreach ($uow->getScheduledEntityUpdates() a...
php
{ "resource": "" }
q265867
TaggedEntityListener.postFlush
test
public function postFlush() { $this->eventDispatcher->dispatch( HttpCacheEvents::INVALIDATE_TAG, new HttpCacheEvent($this->tagsToInvalidate) ); $this->reset(); }
php
{ "resource": "" }
q265868
TaggedEntityListener.invalidateEntity
test
private function invalidateEntity($entity) { if ($entity instanceof TaggedEntityInterface) { $this->addTagToInvalidate($entity::getEntityTagPrefix()); if (null !== $entity->getId()) { $this->addTagToInvalidate($entity->getEntityTag()); } } elseif (...
php
{ "resource": "" }
q265869
TaggedEntityListener.addTagToInvalidate
test
private function addTagToInvalidate($tag) { if (0 < strlen($tag) && !in_array($tag, $this->tagsToInvalidate)) { $this->tagsToInvalidate[] = $tag; } }
php
{ "resource": "" }
q265870
BaseUser.choiceSexe
test
public static function choiceSexe() { return array('Sexe.choice.' . self::SEXE_MISS => self::SEXE_MISS, 'Sexe.choice.' . self::SEXE_MRS => self::SEXE_MRS, 'Sexe.choice.' . self::SEXE_MR => self::SEXE_MR); }
php
{ "resource": "" }
q265871
Zend_Filter_Callback.setCallback
test
public function setCallback($callback, $options = null) { if (!is_callable($callback)) { throw new Zend_Filter_Exception('Callback can not be accessed'); } $this->_callback = $callback; $this->setOptions($options); return $this; }
php
{ "resource": "" }
q265872
Zend_Filter_Callback.filter
test
public function filter($value) { $options = array(); if ($this->_options !== null) { if (!is_array($this->_options)) { $options = array($this->_options); } else { $options = $this->_options; } } array_unshift($opti...
php
{ "resource": "" }
q265873
Zend_Cache_Backend_WinCache.getFillingPercentage
test
public function getFillingPercentage() { $mem = wincache_ucache_meminfo(); $memSize = $mem['memory_total']; $memUsed = $memSize - $mem['memory_free']; if ($memSize == 0) { Zend_Cache::throwException('can\'t get WinCache memory size'); } if ($memUsed > $mem...
php
{ "resource": "" }
q265874
SeobilityBehavior.getAllSeobility
test
public function getAllSeobility($force = false) { $this->_seo = (array)($force ? [] : $this->_seo) + Seo::findAll($this->owner); return ArrayHelper::toArray($this->_seo, ['inblank\seobility\models\Seo' => ['title', 'keywords', 'description']]); }
php
{ "resource": "" }
q265875
SeobilityBehavior.setSeobility
test
public function setSeobility($values, $condition = 0) { $condition = (int)$condition; if (!array_key_exists($condition, $this->_seo)) { $this->_seo[$condition] = Seo::find($this->owner, $condition); } $this->_seo[$condition]->setAttributes($values); }
php
{ "resource": "" }
q265876
SeobilityBehavior.getSeobility
test
public function getSeobility($condition = 0, $defaultIfNotFound = true, $defaultCondition = 0) { $condition = (int)$condition; if (!array_key_exists($condition, $this->_seo)) { $this->_seo[$condition] = Seo::find($this->owner, $condition); if ($this->_seo[$condition]->getIsNe...
php
{ "resource": "" }
q265877
ToBool.convert
test
function convert(): bool { if (!is_string($this->value)) { $this->result = $this->value; } else { switch (strtolower($this->value)) { case '1': case 'true': case 'on': case 'yes': case 'y'...
php
{ "resource": "" }
q265878
Circle.getOrdinateByAbscissa
test
public function getOrdinateByAbscissa($x) { $o = $this->getPointO(); return (sqrt(pow($this->getRadius(), 2) - pow(($x - $o->getAbscissa()), 2)) + $o->getOrdinate()); }
php
{ "resource": "" }
q265879
Circle.getAbscissaByOrdinate
test
public function getAbscissaByOrdinate($y) { $o = $this->getPointO(); return (sqrt(pow($this->getRadius(), 2) - pow(($y - $o->getOrdinate()), 2)) + $o->getAbscissa()); }
php
{ "resource": "" }
q265880
OwpPostmark.attachment
test
public function attachment($name, $content, $content_type) { $this->data['Attachments'][$this->attachment_count]['Name'] = $name; $this->data['Attachments'][$this->attachment_count]['ContentType'] = $content_type; // Check if our content is already base64 encoded or not if(...
php
{ "resource": "" }
q265881
Mail_mimePart.encode
test
function encode($boundary=null) { $encoded =& $this->_encoded; if (count($this->_subparts)) { $boundary = $boundary ? $boundary : '=_' . md5(rand() . microtime()); $eol = $this->_eol; $this->_headers['Content-Type'] .= ";$eol boundary=\"$boundary\""; ...
php
{ "resource": "" }
q265882
Mail_mimePart.encodeToFile
test
function encodeToFile($filename, $boundary=null, $skip_head=false) { if (file_exists($filename) && !is_writable($filename)) { $err = $this->_raiseError('File is not writeable: ' . $filename); return $err; } if (!($fh = fopen($filename, 'ab'))) { $err = $t...
php
{ "resource": "" }
q265883
Mail_mimePart._encodePartToFile
test
function _encodePartToFile($fh, $boundary=null, $skip_head=false) { $eol = $this->_eol; if (count($this->_subparts)) { $boundary = $boundary ? $boundary : '=_' . md5(rand() . microtime()); $this->_headers['Content-Type'] .= ";$eol boundary=\"$boundary\""; } ...
php
{ "resource": "" }
q265884
Mail_mimePart.&
test
function &addSubpart($body, $params) { $this->_subparts[] = $part = new Mail_mimePart($body, $params); return $part; }
php
{ "resource": "" }
q265885
Mail_mimePart._quotedPrintableEncode
test
function _quotedPrintableEncode($input , $line_max = 76) { $eol = $this->_eol; /* // imap_8bit() is extremely fast, but doesn't handle properly some characters if (function_exists('imap_8bit') && $line_max == 76) { $input = preg_replace('/\r?\n/', "\r\n", $input); ...
php
{ "resource": "" }
q265886
Mail_mimePart._buildHeaderParam
test
function _buildHeaderParam($name, $value, $charset=null, $language=null, $encoding=null, $maxLength=75 ) { // RFC 2045: // value needs encoding if contains non-ASCII chars or is longer than 78 chars if (!preg_match('#[^\x20-\x7E]#', $value)) { $token_regexp = '#([^\x21\x2...
php
{ "resource": "" }
q265887
Mail_mimePart._buildRFC2047Param
test
function _buildRFC2047Param($name, $value, $charset, $encoding='quoted-printable', $maxLength=76 ) { // WARNING: RFC 2047 says: "An 'encoded-word' MUST NOT be used in // parameter of a MIME Content-Type or Content-Disposition field", // but... it's supported by many clients/servers ...
php
{ "resource": "" }
q265888
Mail_mimePart._explodeQuotedString
test
function _explodeQuotedString($delimiter, $string) { $result = array(); $strlen = strlen($string); for ($q=$p=$i=0; $i < $strlen; $i++) { if ($string[$i] == "\"" && (empty($string[$i-1]) || $string[$i-1] != "\\") ) { $q = $q ? false : ...
php
{ "resource": "" }
q265889
Mail_mimePart.encodeHeaderValue
test
function encodeHeaderValue($value, $charset, $encoding, $prefix_len=0, $eol="\r\n") { // #17311: Use multibyte aware method (requires mbstring extension) if ($result = Mail_mimePart::encodeMB($value, $charset, $encoding, $prefix_len, $eol)) { return $result; } // Generat...
php
{ "resource": "" }
q265890
Mail_mimePart.encodeMB
test
function encodeMB($str, $charset, $encoding, $prefix_len=0, $eol="\r\n") { if (!function_exists('mb_substr') || !function_exists('mb_strlen')) { return; } $encoding = $encoding == 'base64' ? 'B' : 'Q'; // 75 is the value specified in the RFC $prefix = '=?' . $cha...
php
{ "resource": "" }
q265891
AdminController.getMessages
test
public function getMessages() { $table = new AdminMessages(Message::query()); $table->with(['recipient', 'sender']); if (mustard_loaded('feedback')) { $table->with(['recipient.feedbackReceived', 'sender.feedbackReceived']); } return view('mustard::admin.message...
php
{ "resource": "" }
q265892
FilePointer.getLine
test
public function getLine() { return (feof($this->fp)) ? false : fgets($this->fp, $this->lineReadLength); }
php
{ "resource": "" }
q265893
Dropdown.renderItems
test
protected function renderItems($items, $options = []) { $lines = []; foreach ($items as $item) { if (is_string($item)) { if ($item === static::DIVIDER) { $lines[] = $this->renderDivider(); } else { $lines[] = $item; ...
php
{ "resource": "" }
q265894
Pff2Annotations.doBefore
test
public function doBefore() { $class_name = get_class($this->_controller); $this->classAnnotations = $this->reader->getClassAnnotations($class_name); $this->methodAnnotations = $this->reader->getMethodAnnotations($class_name, $this->_controller->getAction()); }
php
{ "resource": "" }
q265895
Zend_Cache_Core.setOption
test
public function setOption($name, $value) { if (!is_string($name)) { Zend_Cache::throwException("Incorrect option name!"); } $name = strtolower($name); if (array_key_exists($name, $this->_options)) { // This is a Core option $this->_setOption($name,...
php
{ "resource": "" }
q265896
Inflector.slug
test
public function slug($string, $replacement = '-', $lowercase = true) { return $this->proxy(__FUNCTION__, [$string, $replacement, $lowercase]); }
php
{ "resource": "" }
q265897
Inflector.sentence
test
public function sentence(array $words, $twoWordsConnector = null, $lastWordConnector = null, $connector = ', ') { return $this->proxy(__FUNCTION__, [$words, $twoWordsConnector, $lastWordConnector, $connector]); }
php
{ "resource": "" }
q265898
Gallery.extractGalleryArray
test
private function extractGalleryArray($data) { if ($data->stat == 'fail') { return; } $photoset = &$data->photoset; $photo = $this->newPhoto(); $gallery = []; $gallery['id'] = $photoset->id; $gallery['title'] = $ph...
php
{ "resource": "" }
q265899
AbstractAdapter.isValid
test
public function isValid($session) { return ($this->getModifiedValue($session)->getTimestamp() + $this->getLifetimeValue($session)) > time(); }
php
{ "resource": "" }