_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
33
8k
language
stringclasses
1 value
meta_information
dict
q2700
UserPermission.revoke
train
public function revoke($flag) { if (is_string($flag) && defined('static::' . strtoupper($flag))) {
php
{ "resource": "" }
q2701
Assets.sort
train
protected function sort($assets) { $original = $assets; $sorted = []; while (count($assets) > 0) { foreach ($assets as $handle => $asset) { // No dependencies anymore, add it to sorted if (!$asset->hasDependency()) { $sorted[$handle] = $asset; unset($assets[$handle]); } else { foreach ($asset->getDependency() as $dep) { // Remove dependency if doesn't exist, if its dependent on itself, // or if the dependent is dependent on it if (!isset($original[$dep]) or $dep === $handle or (isset($assets[$dep]) and $assets[$dep]->hasDependency($handle))) { $assets[$handle]->removeDependency($dep); continue;
php
{ "resource": "" }
q2702
CA.createAppCSR
train
public static function createAppCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $x509 = new \File_X509(); $x509->setPrivateKey($privKey);
php
{ "resource": "" }
q2703
CA.createCrlDistCSR
train
public static function createCrlDistCSR($keyPair, $dn) { $privKey = new \Crypt_RSA(); $privKey->loadKey($keyPair['privatekey']); $pubKey = new \Crypt_RSA(); $pubKey->loadKey($keyPair['publickey']); $pubKey->setPublicKey(); $csr = new \File_X509(); $csr->setPrivateKey($privKey); $csr->setPublicKey($pubKey);
php
{ "resource": "" }
q2704
Util.localDelete
train
public static function localDelete(string $path, string $fileName) : bool { if (is_file($path . $fileName)) { unlink($path . $fileName);
php
{ "resource": "" }
q2705
Util.getUUID
train
public static function getUUID() : string { mt_srand((double) microtime() * 10000); $charId = strtolower(md5(uniqid(rand(), true))); $hyphen = chr(45);
php
{ "resource": "" }
q2706
Util.getRandomString
train
public static function getRandomString(int $length = 64) : string { $characters = "01234567890123456789"; $characters .= "abcdefghijklmnopqrstuvwxyz";
php
{ "resource": "" }
q2707
Parser.arrayToXml
train
public static function arrayToXml($arr, $num_prefix = "num_") : string { if (!is_array($arr)) return $arr; $result = ''; foreach ($arr as $key => $val) { $key = (is_numeric($key) ? $num_prefix . $key : $key);
php
{ "resource": "" }
q2708
Client.get
train
public function get($apiPath, $queryParams = []) { $response = $this->guzzleClient->get( $this->baseUrl . $apiPath, [ 'query' => $queryParams, 'future' => false, 'auth' => [ $this->id,
php
{ "resource": "" }
q2709
AssetsServiceProvider.compiles
train
public static function compiles() { return [ base_path('vendor\kodicms\laravel-assets\src\Contracts\MetaInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageManagerInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\AssetElementInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\PackageInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Contracts\SocialMediaTagsInterface.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Groups.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Vars.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Packages.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Styles.php'), base_path('vendor\kodicms\laravel-assets\src\Traits\Scripts.php'), base_path('vendor\kodicms\laravel-assets\src\AssetElement.php'),
php
{ "resource": "" }
q2710
HttpRequest.setSecurityLevel
train
public function setSecurityLevel($rawData) { switch ($this->securityLevel) { case "low": break; case "normal": $rawData = \str_replace("<", "&lt;", $rawData); $rawData = \str_replace(">", "&gt;", $rawData); $rawData = \str_replace("\"", "&quot;", $rawData); $rawData = \str_replace("'", "&apos;", $rawData); break; case "high": $rawData
php
{ "resource": "" }
q2711
HttpRequest.setGet
train
private function setGet() { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ GET Params ]" . $k . ": " . $v, []); $this->get->$k = $this->setSecurityLevel($v);
php
{ "resource": "" }
q2712
HttpRequest.setConfig
train
private function setConfig($config) { $this->securityLevel = $config->config['project']['security_level']; if ($config->config['config']) { foreach ($config->config['config'] as $k => $v) { $this->log->debug("[ CONFIG Params ]" . $k . ": " . $v, []);
php
{ "resource": "" }
q2713
HttpRequest.setPost
train
private function setPost() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); $this->post->$k = $this->setSecurityLevel($v); $this->parameters["post"][$k] = $this->setSecurityLevel($v); } unset($_GET); } } if (isset($_POST)) { foreach ($_POST as $k => $v) { if (is_array($v) == true) { $this->log->debug("[ _POST Params ]" . $k . ": " . json_encode($v), []); } else { $this->log->debug("[ _POST Params ]" . $k . ": " . $v, []); }
php
{ "resource": "" }
q2714
HttpRequest.setPut
train
private function setPut() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ PUT Params ]" . $k . ": " . $v, []); $this->put->$k = $this->setSecurityLevel($v); $this->parameters["put"][$k] = $this->setSecurityLevel($v);
php
{ "resource": "" }
q2715
HttpRequest.setDelete
train
private function setDelete() { if ($this->parameters['header']["Content-Type"] == "application/x-www-form-urlencoded") { if (isset($_GET)) { foreach ($_GET as $k => $v) { $this->log->debug("[ DELETE Params ]" . $k . ": " . $v, []); $this->delete->$k = $this->setSecurityLevel($v); $this->parameters["delete"][$k] = $this->setSecurityLevel($v);
php
{ "resource": "" }
q2716
HttpRequest.setCookie
train
private function setCookie() { if (isset($_COOKIE)) { foreach ($_COOKIE as $k => $v) { $this->log->debug("[ COOKIE Params ]" . $k . ": " . $v, []); $this->cookie->$k = $this->setSecurityLevel($v);
php
{ "resource": "" }
q2717
HttpRequest.setHeader
train
private function setHeader() { foreach (getallheaders() as $k => $v) { $this->log->debug("[ HEADER Params ]" . $k . ": " . $v, []);
php
{ "resource": "" }
q2718
HttpRequest.setServer
train
private function setServer() { if (isset($_SERVER)) { foreach ($_SERVER as $k => $v) { $this->log->debug("[ SERVER Params ]" . $k . ": " . $v, []); $this->server->$k = $v;
php
{ "resource": "" }
q2719
HttpRequest.setSession
train
private function setSession() { if (isset($_SESSION)) { foreach ($_SESSION as $k => $v) { $this->log->debug("[ SESSION Params ]" . $k . ": " . $v, []);
php
{ "resource": "" }
q2720
Scripts.addJs
train
public function addJs($handle = false, $src = null, $dependency = null, $footer = false) { return $this->scripts[$handle] =
php
{ "resource": "" }
q2721
Scripts.removeJs
train
public function removeJs($handle = null) { if (is_null($handle)) { return $this->scripts = []; } if (is_bool($handle)) { foreach ($this->scripts as $i => $javaScript) { if ($javaScript->isFooter() === $handle) {
php
{ "resource": "" }
q2722
View.data
train
public static function data($key, $value) { if ($value === null) { unset(self::$shared[$key]);
php
{ "resource": "" }
q2723
View.render
train
public static function render($view, array $data = array()) { if (self::$force || App::state() > 2) { \UtilsSandboxLoader('application/View/' . strtr($view, '.', '/') . '.php', self::$shared + $data);
php
{ "resource": "" }
q2724
View.remove
train
public static function remove($index) { if (isset(self::$views[$index])) {
php
{ "resource": "" }
q2725
Commands.getContainerName
train
protected function getContainerName($container) { $this->validateConfig(); // Project name is defined in a nice, human-readable style, so lowercase it // first. $project_lowercase = strtolower($this->config->get('name')); // Replace all spaces to match the
php
{ "resource": "" }
q2726
Commands.cleanFileName
train
protected function cleanFileName($identifier) { // Convert or strip certain special characters, by convention. $filter = [ ' ' => '-', '_' => '-', '/' => '-', '[' => '-', ']' => '', ]; $identifier = strtr($identifier, $filter); // Valid characters in a clean filename identifier are: // - the hyphen (U+002D) // - the period (U+002E) // - a-z (U+0030 - U+0039) // - A-Z (U+0041 - U+005A) // - the underscore (U+005F) // - 0-9 (U+0061 - U+007A) // - ISO 10646 characters U+00A1 and higher // We strip out any character not
php
{ "resource": "" }
q2727
MessageFactory.createRequest
train
public function createRequest($method, $url, array $options = []) { $request = parent::createRequest($method, $url, $options); $query = $request->getQuery(); $auth = $request->getConfig()->get('auth'); // The 'auth' configuration must be valid if ((!is_array($auth)) || (count($auth) < 3) || ($auth[2] != Client::$AUTH_TYPE)) { throw new RuntimeException("Authorization information not provided"); } $id = $auth[0]; $secret = $auth[1]; // Add API User ID to the query $query->set('api_id', $id); // Add
php
{ "resource": "" }
q2728
MessageFactory.generateMac
train
private function generateMac($url, $query, $secret) { // break URL into parts to get the path $urlParts = parse_url($url); // trim double slashes in the path if (substr($urlParts['path'], 0, 2) == '//') { $urlParts['path'] = substr($urlParts['path'], 1);
php
{ "resource": "" }
q2729
MessageFactory.createResponse
train
public function createResponse( $statusCode, array $headers = [], $body = null, array $options = []
php
{ "resource": "" }
q2730
Common.setMaxDepth
train
public function setMaxDepth(int $maxDepth) : void { if ($maxDepth < 0 || $maxDepth >= 0x7fffffff) { // max depth + 1 must not be greater than this limit
php
{ "resource": "" }
q2731
Common.setOption
train
protected function setOption(int $option, bool $bool) : void { if ($bool) { $this->options |= $option;
php
{ "resource": "" }
q2732
Sypexgeo.get
train
public function get($ip='') { if (empty($ip)) $this->getIP(); else if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { return false; } else { $this->ip = $ip; $this->ipAsLong = sprintf('%u', ip2long($ip));
php
{ "resource": "" }
q2733
Debug.unregister
train
public static function unregister() { $nc = '\\' . get_called_class(); App::off('error', array( $nc, 'renderError' )); App::off('terminate', array( $nc, 'renderPerformance' ));
php
{ "resource": "" }
q2734
Debug.renderError
train
public static function renderError($type, $message, $file, $line) { if (empty(self::$views['error'])) { return null; } elseif (preg_match('#allowed\s+memory\s+size\s+of\s+\d+\s+bytes\s+exhausted\s+\(tried\s+to\s+allocate\s+\d+\s+bytes\)#i', $message)) { die('<br><strong>Fatal error:</strong> ' . $message . ' in <strong>' . $file . '</strong> on line <strong>' . $line . '</strong>'); } $data = self::details($type, $message, $file, $line); if (!headers_sent() && strcasecmp(Request::header('accept'), 'application/json') === 0) { ob_start();
php
{ "resource": "" }
q2735
Debug.renderPerformance
train
public static function renderPerformance() { if (!empty(self::$views['performance'])) {
php
{ "resource": "" }
q2736
Debug.renderClasses
train
public static function renderClasses() { if (!empty(self::$views['classes'])) { self::render(self::$views['classes'], array(
php
{ "resource": "" }
q2737
Debug.view
train
public static function view($type, $view) { if ($view !== null && View::exists($view) === false) { throw new Exception($view . ' view is not found', 2); } $callRender = array( '\\' . get_called_class(), 'render' . ucfirst($type) ); switch ($type) { case 'error': self::$views[$type] = $view; App::on('error', $callRender);
php
{ "resource": "" }
q2738
Debug.classes
train
public static function classes() { $objs = array(); foreach (get_declared_classes() as $value) { $value = ltrim($value, '\\'); $cname = new \ReflectionClass($value); if (false === $cname->isInternal()) {
php
{ "resource": "" }
q2739
Debug.source
train
public static function source($file, $line) { if ($line <= 0 || is_file($file) === false) { return null; } elseif ($line > 5) { $init = $line - 5; $end = $line + 5; $breakpoint = 6; } else { $init = 0; $end = 5; $breakpoint = $line;
php
{ "resource": "" }
q2740
CsvFileIterator.readCurrent
train
private function readCurrent() : void { $row = $this->readRow(); if ($this->columns === null || $row === null) { $this->current = $row; } else { $this->current = [];
php
{ "resource": "" }
q2741
ObjectStorage.has
train
public function has($object) : bool { $hash = spl_object_hash($object);
php
{ "resource": "" }
q2742
ObjectStorage.get
train
public function get($object) { $hash = spl_object_hash($object); if (isset($this->data[$hash])) {
php
{ "resource": "" }
q2743
ObjectStorage.set
train
public function set($object, $data = null) : void { $hash = spl_object_hash($object);
php
{ "resource": "" }
q2744
ObjectStorage.remove
train
public function remove($object) : void { $hash = spl_object_hash($object);
php
{ "resource": "" }
q2745
ObjectStorage.getIterator
train
public function getIterator() : \Traversable { foreach ($this->objects as
php
{ "resource": "" }
q2746
RegistrationServer.call
train
public function call($reqData) { $respData = $this->createError('Unrecognized entity or action'); if ($reqData['entity'] == 'Cxn' && preg_match('/^[a-zA-Z]+$/', $reqData['action'])) { $func = 'on' . $reqData['entity'] . strtoupper($reqData['action']{0}) . substr($reqData['action'], 1);
php
{ "resource": "" }
q2747
RegistrationServer.onCxnRegister
train
public function onCxnRegister($cxn, $params) { $storedCxn = $this->cxnStore->getByCxnId($cxn['cxnId']); if (!$storedCxn || $storedCxn['secret'] == $cxn['secret']) { $this->log->notice('Register cxnId="{cxnId}" siteUrl={siteUrl}: OK', array( 'cxnId' => $cxn['cxnId'], 'siteUrl' => $cxn['siteUrl'], )); $this->cxnStore->add($cxn); return $this->createSuccess(array( 'cxn_id' => $cxn['cxnId'],
php
{ "resource": "" }
q2748
RegistrationServer.onCxnUnregister
train
public function onCxnUnregister($cxn, $params) { $storedCxn = $this->cxnStore->getByCxnId($cxn['cxnId']); if (!$storedCxn) { $this->log->warning('Unregister cxnId="{cxnId} siteUrl="{siteUrl}"": Non-existent', array( 'cxnId' => $cxn['cxnId'], 'siteUrl' => $cxn['siteUrl'], )); return $this->createSuccess(array( 'cxn_id' => $cxn['cxnId'], )); } elseif ($storedCxn['secret'] == $cxn['secret']) {
php
{ "resource": "" }
q2749
Builder.addPlugin
train
public function addPlugin(Plugin $plugin): Builder { $this->plugins[] = $plugin;
php
{ "resource": "" }
q2750
Route.set
train
public static function set($method, $path, $action) { if (is_array($method)) { foreach ($method as $value) { self::set($value, $path, $action); } } else { if (is_string($action)) { $action = parent::$prefixNS . $action; } elseif ($action !== null && !$action instanceof \Closure) { return null; } $method = strtoupper(trim($method));
php
{ "resource": "" }
q2751
Route.get
train
public static function get() { if (self::$current !== null) { return self::$current; } $resp = 404; $args = array(); $routes = parent::$httpRoutes; $path = \UtilsPath(); $method = $_SERVER['REQUEST_METHOD']; //... if (isset($routes[$path])) { $verbs = $routes[$path]; } else { foreach ($routes as $route => $actions) { if (parent::find($route, $path, $args)) { $verbs = $actions; break; } } } if (isset($verbs[$method])) { $resp = $verbs[$method]; } elseif (isset($verbs['ANY'])) {
php
{ "resource": "" }
q2752
ErrorCatcher.run
train
public static function run(callable $function) { set_error_handler(static function($severity, $message, $file, $line) { throw new \ErrorException($message, 0, $severity, $file, $line); }); try {
php
{ "resource": "" }
q2753
LoggerService.emergency
train
public static function emergency($message, $context = [], $channel = 'tastphp.logger') { $logger
php
{ "resource": "" }
q2754
Response.dispatch
train
public static function dispatch() { if (empty(self::$headers) === false) { self::$dispatchedHeaders = true;
php
{ "resource": "" }
q2755
Response.status
train
public static function status($code = null, $trigger = true) { if (self::$httpCode === null) { self::$httpCode = \UtilsStatusCode(); } if ($code === null || self::$httpCode === $code) { return self::$httpCode;
php
{ "resource": "" }
q2756
Response.removeHeader
train
public static function removeHeader($name) { self::$headers = array_filter(self::$headers, function
php
{ "resource": "" }
q2757
Response.download
train
public static function download($name = null, $contentLength = 0) { if ($name) { $name = '; filename="' . strtr($name, '"', '-') . '"'; } else { $name = ''; } self::putHeader('Content-Transfer-Encoding', 'Binary');
php
{ "resource": "" }
q2758
ModelView.addViewData
train
public function addViewData($key, $value) { if ($key) { $this->modelVar[$key] = $value; } else {
php
{ "resource": "" }
q2759
Shell.inputObserver
train
public function inputObserver($callback, $exitCicle = null) { if (self::isCli() === false || is_callable($callback) === false) { return false; } $this->io = $callback; $this->ec = $exitCicle ? $exitCicle : $this->ec;
php
{ "resource": "" }
q2760
Shell.fireInputObserver
train
protected function fireInputObserver() { $response = rtrim(self::input(), PHP_EOL); if (strcasecmp($response, $this->ec) === 0) { return null; }
php
{ "resource": "" }
q2761
Router.get
train
public function get(string $pattern, callable $callback) { if ($this->requestMethod === "GET") {
php
{ "resource": "" }
q2762
Router.post
train
public function post(string $pattern, callable $callback) { if ($this->requestMethod === "POST") {
php
{ "resource": "" }
q2763
Router.getPattern
train
private static function getPattern(string $pattern) { $keywords = preg_split("/\\//", $pattern); $i = '0'; $word = ""; foreach ($keywords as $keyword) { $i++;
php
{ "resource": "" }
q2764
Embed.normalizeConfig
train
private function normalizeConfig(array $embedConfig) { $config = $embedConfig; // apply deprecated configuration keys if exists: if (array_key_exists('video_player', $embedConfig)) { $config['video']['player'] = $embedConfig['video_player']; } if (array_key_exists('video_autoplay', $embedConfig)) { $config['video']['autoplay'] = $embedConfig['video_autoplay']; } if (array_key_exists('video_available_speeds', $embedConfig)) { $config['video']['available-speeds'] = $embedConfig['video_available_speeds']; } if (array_key_exists('audio_player', $embedConfig)) { $config['audio']['player'] = $embedConfig['audio_player']; } if (array_key_exists('audio_autoplay', $embedConfig)) {
php
{ "resource": "" }
q2765
Groups.group
train
public function group($group, $handle = null, $content = null) {
php
{ "resource": "" }
q2766
Groups.removeGroup
train
public function removeGroup($group = null, $handle = null) { if (is_null($group)) { return $this->groups = [];
php
{ "resource": "" }
q2767
Groups.renderGroup
train
public function renderGroup($group) { if (!isset($this->groups[$group])) { return PHP_EOL; }
php
{ "resource": "" }
q2768
SeoBehavior.saveSeoContent
train
public function saveSeoContent() { $model = $this->getSeoContentModel(); if (!$model->is_global) { $model->title = $this->owner->{$this->titleAttribute}; $model->keywords
php
{ "resource": "" }
q2769
SeoBehavior.deleteSeoContent
train
public function deleteSeoContent() { $model = $this->getSeoContentModel(); if ($model
php
{ "resource": "" }
q2770
Router.find
train
protected static function find($route, $path, array &$matches) { $re = Regex::parse($route); if ($re !== false && preg_match('#^' . $re . '$#', $path, $matches)) {
php
{ "resource": "" }
q2771
Quick.verbs
train
private static function verbs(array $methods) { $list = array(); $reMatch = '#^(any|get|post|patch|put|head|delete|options|trace|connect)([A-Z0-9]\w+)$#'; foreach ($methods as $value) { $verb = array(); if (preg_match($reMatch, $value, $verb)) { if (strcasecmp('index', $verb[2]) === 0) { $verb[2] = ''; } else {
php
{ "resource": "" }
q2772
Quick.prepare
train
public function prepare() { if ($this->ready) { return null; } $this->ready = true; $format = $this->format; $controller = $this->controller; foreach ($this->classMethods as $value) { if ($format === self::BOTH || $format === self::SLASH) { $route = '/' . (empty($value[1]) ? '' : ($value[1] . '/')); Route::set($value[0], $route, $controller . ':' . $value[2]); }
php
{ "resource": "" }
q2773
AesHelper.authenticateThenDecrypt
train
public static function authenticateThenDecrypt($secret, $body, $signature) { $keys = self::deriveAesKeys($secret); $localHmac = hash_hmac('sha256', $body, $keys['auth']); if (!self::hash_compare($signature, $localHmac)) { throw new InvalidMessageException("Incorrect hash"); } list ($jsonEnvelope, $jsonEncrypted) = explode(Constants::PROTOCOL_DELIM, $body, 2); if (strlen($jsonEnvelope) > Constants::MAX_ENVELOPE_BYTES) { throw new InvalidMessageException("Oversized envelope"); } $envelope = json_decode($jsonEnvelope, TRUE); if (!$envelope) { throw new InvalidMessageException("Malformed envelope"); } if (!is_numeric($envelope['ttl']) || Time::getTime() > $envelope['ttl']) { throw new InvalidMessageException("Invalid TTL"); } if (!is_string($envelope['iv']) || strlen($envelope['iv']) !== Constants::AES_BYTES * 2 || !preg_match('/^[a-f0-9]+$/', $envelope['iv'])) { // AES_BYTES (32) ==> bin2hex ==> 2 hex digits (4-bit) per byte (8-bit)
php
{ "resource": "" }
q2774
AesHelper.hash_compare
train
private static function hash_compare($a, $b) { if (!is_string($a) || !is_string($b)) { return FALSE; } $len = strlen($a); if ($len !== strlen($b)) { return FALSE; } $status = 0; for ($i
php
{ "resource": "" }
q2775
File.exists
train
public static function exists($path) { if (file_exists($path) === false) { return false; } $path = preg_replace('#^file:/+([a-z]:/|/)#i', '$1', $path); $pinfo = pathinfo($path); $rpath = strtr(realpath($path), '\\', '/'); if ($pinfo['dirname'] !== '.') {
php
{ "resource": "" }
q2776
File.mime
train
public static function mime($path) { $mime = false; if (is_readable($path)) { if (function_exists('finfo_open')) { $buffer = file_get_contents($path, false, null, -1, 5012); $finfo = finfo_open(FILEINFO_MIME_TYPE); $mime = finfo_buffer($finfo, $buffer); finfo_close($finfo); $buffer = null; } elseif (function_exists('mime_content_type')) { $mime
php
{ "resource": "" }
q2777
File.output
train
public static function output($path, $length = 102400, $delay = 0) { if (is_readable($path) === false) { return false; } $buffer = ob_get_level() !== 0; $handle = fopen($path, 'rb'); $length = is_int($length) && $length > 0 ? $length : 102400; while (false === feof($handle)) {
php
{ "resource": "" }
q2778
Message.send
train
public function send() { list ($headers, $blob, $code) = $this->toHttp(); header('Content-Type: ' . Constants::MIME_TYPE); header("X-PHP-Response-Code: $code", TRUE, $code);
php
{ "resource": "" }
q2779
Message.toSymfonyResponse
train
public function toSymfonyResponse() { $headers = array_merge( array('Content-Type' => Constants::MIME_TYPE), $this->getHeaders() ); return new
php
{ "resource": "" }
q2780
JmsMetadataParser.doParse
train
protected function doParse($className, $visited = array(), array $groups = array()) { $meta = $this->factory->getMetadataForClass($className); if (null === $meta) { throw new \InvalidArgumentException(sprintf('No metadata found for class %s', $className)); } $exclusionStrategies = array(); if ($groups) { $exclusionStrategies[] = new GroupsExclusionStrategy($groups); } $params = array(); // iterate over property metadata foreach ($meta->propertyMetadata as $item) { if (!is_null($item->type)) { $name = $this->namingStrategy->translateName($item); $dataType = $this->processDataType($item); // apply exclusion strategies foreach ($exclusionStrategies as $strategy) {
php
{ "resource": "" }
q2781
Request.header
train
public static function header($name = null) { if (self::$reqHeaders === null) { self::generate(); } if (is_string($name))
php
{ "resource": "" }
q2782
Request.raw
train
public static function raw($binary = true) { if (is_readable('php://input')) { return false; } $mode = $binary ? 'rb' : 'r'; if (PHP_VERSION_ID >= 50600) { return fopen('php://input', $mode);
php
{ "resource": "" }
q2783
SeoContentHelper.behavior
train
protected static function behavior(Component $model) { foreach ($model->getBehaviors() as $b) { if ($b instanceof SeoBehavior) { return $b; }
php
{ "resource": "" }
q2784
SeoContentHelper.registerSeoMetaTag
train
protected static function registerSeoMetaTag(Component $model, string $modelSeoAttributeName, string $metaTagKey) { $value = $model->{$modelSeoAttributeName};
php
{ "resource": "" }
q2785
SeoContentHelper.registerAllSeoMeta
train
public static function registerAllSeoMeta(Component $model) { self::registerMetaTitle($model);
php
{ "resource": "" }
q2786
SeoContentHelper.setTitle
train
public static function setTitle(Component $model) { $title = $model->{self::behavior($model)->titleAttribute}; if
php
{ "resource": "" }
q2787
SeoContentHelper.registerMetaTitle
train
public static function registerMetaTitle(Component $model) { $modelSeoAttributeName
php
{ "resource": "" }
q2788
SeoContentHelper.registerMetaKeywords
train
public static function registerMetaKeywords(Component $model) { $modelSeoAttributeName
php
{ "resource": "" }
q2789
SeoContentHelper.registerMetaDescription
train
public static function registerMetaDescription(Component $model) { $modelSeoAttributeName
php
{ "resource": "" }
q2790
FileStream.gets
train
public function gets(?int $maxLength = null) : string { if ($this->closed) { throw new IoException('The stream is closed.'); } try { $data = ErrorCatcher::run(function() use ($maxLength) { if ($maxLength === null) { return fgets($this->handle); } else { return fgets($this->handle, $maxLength + 1);
php
{ "resource": "" }
q2791
FileStream.lock
train
public function lock(bool $exclusive) : void { if ($this->closed) { throw new IoException('The stream is closed.'); } try { $result = ErrorCatcher::run(function() use ($exclusive) {
php
{ "resource": "" }
q2792
FileStream.unlock
train
public function unlock() : void { if ($this->closed) { throw new IoException('The stream is closed.'); } try { $result = ErrorCatcher::run(function() { return flock($this->handle, LOCK_UN); });
php
{ "resource": "" }
q2793
Uri.withScheme
train
public function withScheme($scheme) { $scheme = strtolower($scheme); $pattern = new UriPattern(); if (strlen($scheme) === 0 || $pattern->matchScheme($scheme)) { return
php
{ "resource": "" }
q2794
Uri.withUserInfo
train
public function withUserInfo($user, $password = null) { $username = rawurlencode($user); if (strlen($username) > 0) { return $this->with('userInfo', $this->constructString([ '%s%s' => $username,
php
{ "resource": "" }
q2795
Uri.withHost
train
public function withHost($host) { $pattern = new UriPattern(); if ($pattern->matchHost($host)) { return $this->with('host', $this->normalize(strtolower($host)));
php
{ "resource": "" }
q2796
Uri.withPort
train
public function withPort($port) { if ($port !== null) { $port = (int) $port; if (max(0, min(65535, $port)) !== $port) {
php
{ "resource": "" }
q2797
Uri.with
train
private function with($variable, $value) { if ($value === $this->$variable) { return $this; } $uri = clone
php
{ "resource": "" }
q2798
Uri.encode
train
private function encode($string, $extra = '') { $pattern = sprintf( '/[^0-9a-zA-Z%s]|%%(?![0-9A-F]{2})/', preg_quote("%-._~!$&'()*+,;=" . $extra, '/') );
php
{ "resource": "" }
q2799
Uri.constructString
train
private function constructString(array $components) { $formats = array_keys($components); $values = array_values($components); $keys = array_keys(array_filter($values, 'strlen')); return array_reduce($keys, function ($string,
php
{ "resource": "" }