_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 33 8k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q23100 | jsModal.setOption | train | public function setOption($options, $value = null)
{
if (is_array($options)) {
foreach ($options as $key => $value) {
$this->args['arg'][$key] = $value;
}
| php | {
"resource": ""
} |
q23101 | ItemShelf.linkCart | train | public function linkCart(Cart $cart, $jsAction = null)
{
$this->on('click', '.item', function ($a, $b) use ($cart, $jsAction) {
| php | {
"resource": ""
} |
q23102 | SSE.init | train | public function init()
{
if ($this->runEvent) {
$chain = new jsChain();
$this->app->html->js(true, $chain->atkServerEvent(
| php | {
"resource": ""
} |
q23103 | UserController.actionRequestPasswordReset | train | public function actionRequestPasswordReset()
{
$model = new PasswordResetRequest();
if ($model->load(Yii::$app->getRequest()->post()) && $model->validate()) {
if ($model->sendEmail()) {
Yii::$app->getSession()->setFlash('success', 'Check your email for further instruction... | php | {
"resource": ""
} |
q23104 | Route.getRoutePrefix | train | public function getRoutePrefix()
{
if (!$this->_routePrefix) {
$this->_routePrefix = Configs::instance()->advanced ? self::PREFIX_ADVANCED | php | {
"resource": ""
} |
q23105 | Route.getPermissionName | train | public function getPermissionName($route)
{
if (self::PREFIX_BASIC == $this->routePrefix) {
return self::PREFIX_BASIC . trim($route, self::PREFIX_BASIC);
} else {
| php | {
"resource": ""
} |
q23106 | Route.getControllerActions | train | protected function getControllerActions($type, $id, $module, &$result)
{
$token = "Create controller with cofig=" . VarDumper::dumpAsString($type) . " and id='$id'";
Yii::beginProfile($token, __METHOD__);
try {
/* @var $controller \yii\base\Controller */
$controller =... | php | {
"resource": ""
} |
q23107 | Route.getActionRoutes | train | protected function getActionRoutes($controller, &$result)
{
$token = "Get actions of controller '" . $controller->uniqueId . "'";
Yii::beginProfile($token, __METHOD__);
try {
$prefix = '/' . $controller->uniqueId . '/';
foreach ($controller->actions() as $id => $value... | php | {
"resource": ""
} |
q23108 | Module.getMenus | train | public function getMenus()
{
if ($this->_normalizeMenus === null) {
$mid = '/' . $this->getUniqueId() . '/';
// resolve core menus
$this->_normalizeMenus = [];
$config = components\Configs::instance();
$conditions = [
'user' => $co... | php | {
"resource": ""
} |
q23109 | Module.setMenus | train | public function setMenus($menus)
{
$this->_menus = array_merge($this->_menus, $menus);
| php | {
"resource": ""
} |
q23110 | Assignment.assign | train | public function assign($items)
{
$manager = Configs::authManager();
$success = 0;
foreach ($items as $name) {
try {
$item = $manager->getRole($name);
$item = $item ?: $manager->getPermission($name);
$manager->assign($item, $this->id... | php | {
"resource": ""
} |
q23111 | MenuHelper.requiredParent | train | private static function requiredParent($assigned, &$menus)
{
$l = count($assigned);
for ($i = 0; $i < $l; $i++) {
$id = $assigned[$i];
| php | {
"resource": ""
} |
q23112 | Helper.filter | train | public static function filter($items, $user = null)
{
if ($user === null) {
$user = Yii::$app->getUser();
| php | {
"resource": ""
} |
q23113 | AuthItem.getTypeName | train | public static function getTypeName($type = null)
{
$result = [
Item::TYPE_PERMISSION => 'Permission',
| php | {
"resource": ""
} |
q23114 | Assignment.search | train | public function search($params, $class, $usernameField)
{
$query = $class::find();
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
if (!($this->load($params) && $this->validate())) {
| php | {
"resource": ""
} |
q23115 | HandleFormFields.fields | train | function fields(): array
{
$this->checkFormIsBuilt();
return collect($this->fields)->map(function($field) {
| php | {
"resource": ""
} |
q23116 | HandleFormFields.findFieldByKey | train | function findFieldByKey(string $key)
{
$this->checkFormIsBuilt();
$fields = collect($this->fields);
if(strpos($key, ".") !== false) {
list($key, $itemKey) = explode(".", $key);
$listField = $fields->where("key", $key)->first();
| php | {
"resource": ""
} |
q23117 | WithSharpFormEloquentUpdater.getFormListFieldsConfiguration | train | protected function getFormListFieldsConfiguration()
{
return collect($this->fields)
->filter(function($field) {
return $field instanceof SharpFormListField
&& $field->isSortable();
})->map(function($listField) {
return [
... | php | {
"resource": ""
} |
q23118 | EntityListController.update | train | public function update($entityKey)
{
sharp_check_ability("update", $entityKey);
$list = $this->getListInstance($entityKey);
| php | {
"resource": ""
} |
q23119 | ModelWizardCommand.parseClassname | train | protected function parseClassname($class, $additionalNamespace = null)
{
if (preg_match('([^A-Za-z0-9_/\\\\])', $class)) {
throw new InvalidArgumentException('Class name contains invalid characters.');
}
$class = trim(str_replace('/', '\\', $class), '\\');
if (! Str::st... | php | {
"resource": ""
} |
q23120 | AssetViewComposer.compose | train | public function compose(View $view)
{
$strategy = $this->getValidatedStrategyFromConfig();
$output = [];
foreach((array)config("sharp.extensions.assets") as $position => $paths) {
foreach((array)$paths as $assetPath) {
if(!isset($output[$position])) {
... | php | {
"resource": ""
} |
q23121 | AssetViewComposer.getValidatedStrategyFromConfig | train | protected function getValidatedStrategyFromConfig():string
{
$strategy = config('sharp.extensions.assets.strategy', 'raw');
if(!is_string($strategy)) {
throw new SharpInvalidAssetRenderStrategy('The asset strategy defined at sharp.extensions.assets.strategy is not a string');
} | php | {
"resource": ""
} |
q23122 | SharpWidget.validate | train | protected function validate(array $properties)
{
$validator = Validator::make($properties, [
'key' => 'required',
'type' => 'required',
] + $this->validationRules());
| php | {
"resource": ""
} |
q23123 | SharpForm.formLayout | train | function formLayout(): array
{
if(!$this->layoutBuilt) {
$this->buildFormLayout();
$this->layoutBuilt = true;
}
return [
"tabbed" => $this->tabbed,
| php | {
"resource": ""
} |
q23124 | SharpForm.instance | train | function instance($id): array
{
return collect($this->find($id))
// Filter model attributes on actual form fields
| php | {
"resource": ""
} |
q23125 | SharpForm.newInstance | train | public function newInstance()
{
$data = collect($this->create())
// Filter model attributes | php | {
"resource": ""
} |
q23126 | SharpForm.create | train | public function create(): array
{
$attributes = collect($this->getDataKeys())
->flip()
->map(function() {
return null;
})->all();
// Build a fake Model class based on attributes
return $this->transform(new class($attributes) extends \stdCl... | php | {
"resource": ""
} |
q23127 | SharpEntityList.dataContainers | train | function dataContainers(): array
{
$this->checkListIsBuilt();
return collect($this->containers)->map(function(EntityListDataContainer | php | {
"resource": ""
} |
q23128 | SharpEntityList.listLayout | train | function listLayout(): array
{
if(!$this->layoutBuilt) {
$this->buildListLayout();
$this->layoutBuilt = true;
}
| php | {
"resource": ""
} |
q23129 | SharpEntityList.listConfig | train | function listConfig(): array
{
$config = [
"instanceIdAttribute" => $this->instanceIdAttribute,
"multiformAttribute" => $this->multiformAttribute,
"displayMode" => $this->displayMode,
"searchable" => $this->searchable,
"paginated" => $this->paginat... | php | {
"resource": ""
} |
q23130 | SharpEntityList.addDataContainer | train | protected function addDataContainer(EntityListDataContainer $container)
{
$this->containers[] = $container;
| php | {
"resource": ""
} |
q23131 | WithCustomTransformers.transform | train | function transform($models)
{
if($this instanceof SharpForm || $this instanceof Command) {
// It's a Form (full entity or from a Command), there's only one model.
// We must add Form Field Formatters in the process
return $this->applyFormatters(
$this->app... | php | {
"resource": ""
} |
q23132 | MenuViewComposer.compose | train | public function compose(View $view)
{
$menuItems = new Collection;
foreach (config("sharp.menu", []) as $menuItemConfig) {
if($menuItem = MenuItem::parse($menuItemConfig)) {
$menuItems->push($menuItem);
}
}
$view->with('sharpMenu', (object)[
... | php | {
"resource": ""
} |
q23133 | Command.validate | train | public function validate(array $params, array $rules, array $messages = [])
{
$validator = app(Validator::class)->make($params, $rules, $messages);
if ($validator->fails()) {
throw new ValidationException(
| php | {
"resource": ""
} |
q23134 | HandleCommands.appendCommandsToConfig | train | protected function appendCommandsToConfig(array &$config)
{
collect($this->entityCommandHandlers)
->merge(collect($this->instanceCommandHandlers))
->each(function($handler, $commandName) use(&$config) {
$formFields = $handler->form();
$formLayout = $fo... | php | {
"resource": ""
} |
q23135 | SharpDashboard.addWidget | train | protected function addWidget(SharpWidget $widget)
{
$this->widgets[] = $widget;
| php | {
"resource": ""
} |
q23136 | SharpDashboard.addFullWidthWidget | train | protected function addFullWidthWidget(string $widgetKey)
{
$this->layoutBuilt = false;
| php | {
"resource": ""
} |
q23137 | SharpDashboard.addRow | train | protected function addRow(\Closure $callback)
{
$row = new DashboardLayoutRow();
| php | {
"resource": ""
} |
q23138 | SharpDashboard.widgetsLayout | train | function widgetsLayout(): array
{
if(!$this->layoutBuilt) {
$this->buildWidgetsLayout();
$this->layoutBuilt = true;
}
return [
"rows" => | php | {
"resource": ""
} |
q23139 | Client.process_response | train | protected function process_response($response_json)
{
$response = json_decode($response_json);
$this->catch_json_last_error();
$this->last_results_raw = $response;
if (isset($response->meta->rc)) {
if ($response->meta->rc === 'ok') {
$this->last_error_mess... | php | {
"resource": ""
} |
q23140 | Client.check_base_url | train | private function check_base_url()
{
$url_valid = filter_var($this->baseurl, FILTER_VALIDATE_URL);
if (!$url_valid) {
trigger_error('The URL provided is incomplete or invalid!');
return false;
}
$base_url_components = parse_url($this->baseurl); | php | {
"resource": ""
} |
q23141 | Client.get_curl_obj | train | protected function get_curl_obj()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->curl_ssl_verify_peer);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->curl_ssl_verify_host);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, ... | php | {
"resource": ""
} |
q23142 | RollbackMultiAuthCommand.parseName | train | protected function parseName($name = null)
{
if (!$name) {
$name = $this->name;
}
return [
'{{pluralCamel}}' => str_plural(camel_case($name)),
'{{pluralSlug}}' => str_plural(str_slug($name)),
'{{pluralSnake}}' => str_plural(snake_case($... | php | {
"resource": ""
} |
q23143 | FileSystemOptions.setCacheDir | train | public function setCacheDir($cacheDir)
{
if ($cacheDir !== null) {
if (!is_dir($cacheDir)) {
throw new Exception\InvalidArgumentException(
"Cache directory '{$cacheDir}' not found or not a directory"
);
} elseif (!is_writable($cache... | php | {
"resource": ""
} |
q23144 | FileSystemOptions.setDirLevel | train | public function setDirLevel($dirLevel)
{
$dirLevel = (int)$dirLevel;
if ($dirLevel < 0 || $dirLevel > 16) {
throw new Exception\InvalidArgumentException(
| php | {
"resource": ""
} |
q23145 | FileSystemOptions.setDirPermission | train | public function setDirPermission($dirPermission)
{
if ($dirPermission !== false) {
if (is_string($dirPermission)) {
$dirPermission = octdec($dirPermission);
} else {
$dirPermission = (int)$dirPermission;
}
// validate
... | php | {
"resource": ""
} |
q23146 | FileSystemOptions.setFilePermission | train | public function setFilePermission($filePermission)
{
if ($filePermission !== false) {
if (is_string($filePermission)) {
$filePermission = octdec($filePermission);
} else {
$filePermission = (int)$filePermission;
}
// validate
... | php | {
"resource": ""
} |
q23147 | FileSystemOptions.setUmask | train | public function setUmask($umask)
{
if ($umask !== false) {
if (is_string($umask)) {
$umask = octdec($umask);
} else {
$umask = (int)$umask;
}
// validate
if ($umask & 0700) {
throw new Exception\Inva... | php | {
"resource": ""
} |
q23148 | AdapterOptions.setKeyPattern | train | public function setKeyPattern($keyPattern)
{
$keyPattern = (string)$keyPattern;
if ($this->keyPattern !== $keyPattern) {
// validate pattern
if ($keyPattern !== '') {
ErrorHandler::start(E_WARNING);
$result = preg_match($keyPattern, '');
... | php | {
"resource": ""
} |
q23149 | AdapterOptions.normalizeTtl | train | protected function normalizeTtl(&$ttl)
{
if (!is_int($ttl)) {
$ttl = (float)$ttl;
// convert to int if possible
if ($ttl === (float)(int)$ttl) {
$ttl = (int)$ttl; | php | {
"resource": ""
} |
q23150 | ErrorHandler.stop | train | public static function stop($throw = false)
{
$errorException = null;
if (static::$stack) {
$errorException = array_pop(static::$stack);
if (!static::$stack) {
restore_error_handler();
| php | {
"resource": ""
} |
q23151 | ErrorHandler.addError | train | public static function addError($errno, $errstr = '', $errfile = '', $errline = 0)
{
$stack | php | {
"resource": ""
} |
q23152 | AbstractAdapter.normalizeKey | train | protected function normalizeKey(&$key)
{
$key = (string)$key;
if ($key === '') {
throw new InvalidArgumentException("An empty key isn't allowed");
| php | {
"resource": ""
} |
q23153 | Semacode.makeEncoding | train | function makeEncoding($height = 0, $width = 0, $data = 0, $fw = 0, $bytes = 0, $datablocks = 0, $rsblocks = 0) {
$t = array(
'height' => $height,
'width' => $width,
'data' => $data,
| php | {
"resource": ""
} |
q23154 | Semacode.placeBit | train | function placeBit(&$array, $NR, $NC, $r, $c, $p, $b) {
if ($r < 0) {
$r += $NR;
$c += 4 - (($NR + 4) % 8);
}
if ($c < 0) {
| php | {
"resource": ""
} |
q23155 | Semacode.rs | train | function rs(&$binary, $bytes, $datablock, $rsblock) {
$blocks = floor(($bytes + 2) / $datablock);
$rs = new ReedSolomon($rsblock);
for ($b = 0; $b < $blocks; $b++) {
$buf = array();
$p = 0;
for ($n = $b; $n < $bytes; $n += $blocks)
array_push(... | php | {
"resource": ""
} |
q23156 | Semacode.asGDImage | train | function asGDImage($text,$resize=160){
$barcode = $this->encode($text);
$w = $barcode['width'];
$h = $barcode['height'];
$bs = 10;
$size = $bs * $w;
$img = imagecreatetruecolor($size + 2 * $bs * 2 ,$size + 2 * $bs * 2);
$white = imagecolorallocate($img,255,2... | php | {
"resource": ""
} |
q23157 | FileSystem.internalHasItem | train | protected function internalHasItem(& $normalizedKey)
{
$file = $this->getFileSpec($normalizedKey) . '.dat';
if (!file_exists($file)) {
return false;
}
$ttl = $this->getOptions()->getTtl();
if ($ttl) {
ErrorHandler::start();
$mtime = filemt... | php | {
"resource": ""
} |
q23158 | FileSystem.getFileSpec | train | protected function getFileSpec($normalizedKey)
{
$options = $this->getOptions();
$namespace = $options->getNamespace();
$prefix = ($namespace === '') ? '' : $namespace . $options->getNamespaceSeparator();
$path = $options->getCacheDir() . DIRECTORY_SEPARATOR;
$level... | php | {
"resource": ""
} |
q23159 | FileSystem.getFileContent | train | protected function getFileContent($file, $nonBlocking = false, & $wouldblock = null)
{
$locking = $this->getOptions()->getFileLocking();
$wouldblock = null;
ErrorHandler::start();
// if file locking enabled -> file_get_contents can't be used
if ($locking) {
$... | php | {
"resource": ""
} |
q23160 | Tag.index | train | public function index(string $domain, int $limit = 100)
{
Assert::stringNotEmpty($domain);
Assert::range($limit, 1, 1000);
$params = [
'limit' => $limit,
];
| php | {
"resource": ""
} |
q23161 | Tag.update | train | public function update(string $domain, string $tag, string $description)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($tag);
$params = [
'description' => $description,
];
| php | {
"resource": ""
} |
q23162 | Tag.stats | train | public function stats(string $domain, string $tag, array $params)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($tag);
| php | {
"resource": ""
} |
q23163 | Message.show | train | public function show(string $url, bool $rawMessage = false)
{
Assert::notEmpty($url);
$headers = [];
if ($rawMessage) {
$headers['Accept'] = 'message/rfc2822';
}
$response = | php | {
"resource": ""
} |
q23164 | Message.prepareMultipartParameters | train | private function prepareMultipartParameters(array $params): array
{
$postDataMultipart = [];
foreach ($params as $key => $value) {
// If $value is not an array we cast it to | php | {
"resource": ""
} |
q23165 | Message.closeResources | train | private function closeResources(array $params): void
{
foreach ($params as $param) {
if (is_array($param) && array_key_exists('content', $param) | php | {
"resource": ""
} |
q23166 | Ip.index | train | public function index(bool $dedicated = false)
{
Assert::boolean($dedicated);
$params = [
'dedicated' => $dedicated,
];
| php | {
"resource": ""
} |
q23167 | Ip.domainIndex | train | public function domainIndex(string $domain)
{
Assert::stringNotEmpty($domain);
$response = $this->httpGet(sprintf('/v3/domains/%s/ip', $domain));
| php | {
"resource": ""
} |
q23168 | Ip.show | train | public function show(string $ip)
{
Assert::ip($ip);
$response = $this->httpGet(sprintf('/v3/ips/%s', $ip));
| php | {
"resource": ""
} |
q23169 | Ip.assign | train | public function assign(string $domain, string $ip)
{
Assert::stringNotEmpty($domain);
Assert::ip($ip);
$params = [
'id' => $ip,
];
$response | php | {
"resource": ""
} |
q23170 | Ip.unassign | train | public function unassign(string $domain, string $ip)
{
Assert::stringNotEmpty($domain);
Assert::ip($ip);
| php | {
"resource": ""
} |
q23171 | MailingList.pages | train | public function pages(int $limit = 100)
{
Assert::range($limit, 1, 1000);
$params = [
'limit' => $limit,
];
| php | {
"resource": ""
} |
q23172 | MailingList.create | train | public function create(string $address, string $name = null, string $description = null, string $accessLevel = 'readonly')
{
Assert::stringNotEmpty($address);
Assert::nullOrStringNotEmpty($name);
Assert::nullOrStringNotEmpty($description);
| php | {
"resource": ""
} |
q23173 | MailingList.update | train | public function update(string $address, array $parameters = [])
{
Assert::stringNotEmpty($address);
Assert::isArray($parameters);
foreach ($parameters as $field => $value) {
switch ($field) {
case 'address':
case 'name':
case 'desc... | php | {
"resource": ""
} |
q23174 | EmailValidation.validate | train | public function validate(string $address, bool $mailboxVerification = false)
{
Assert::stringNotEmpty($address);
$params = [
'address' => $address,
'mailbox_verification' => $mailboxVerification,
];
$response | php | {
"resource": ""
} |
q23175 | Domain.index | train | public function index(int $limit = 100, int $skip = 0)
{
Assert::range($limit, 1, 1000);
$params = [
'limit' => $limit,
'skip' => $skip,
];
| php | {
"resource": ""
} |
q23176 | Domain.credentials | train | public function credentials(string $domain, int $limit = 100, int $skip = 0)
{
Assert::stringNotEmpty($domain);
$params = [
'limit' => $limit,
'skip' => $skip,
];
$response | php | {
"resource": ""
} |
q23177 | Domain.createCredential | train | public function createCredential(string $domain, string $login, string $password)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($login);
Assert::stringNotEmpty($password);
Assert::lengthBetween($password, 5, 32, 'SMTP password | php | {
"resource": ""
} |
q23178 | Domain.updateCredential | train | public function updateCredential(string $domain, string $login, string $pass)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($login);
Assert::stringNotEmpty($pass);
Assert::lengthBetween($pass, 5, 32, 'SMTP password must be between 5 and 32 characters.');
$params ... | php | {
"resource": ""
} |
q23179 | Domain.deleteCredential | train | public function deleteCredential(string $domain, string $login)
{
Assert::stringNotEmpty($domain);
Assert::stringNotEmpty($login);
$response = $this->httpDelete(
sprintf(
'/v3/domains/%s/credentials/%s',
| php | {
"resource": ""
} |
q23180 | Domain.connection | train | public function connection(string $domain)
{
Assert::stringNotEmpty($domain);
$response = $this->httpGet(sprintf('/v3/domains/%s/connection', $domain));
| php | {
"resource": ""
} |
q23181 | Domain.updateConnection | train | public function updateConnection(string $domain, ?bool $requireTLS, ?bool $noVerify)
{
Assert::stringNotEmpty($domain);
$params = [];
if (null !== $requireTLS) {
$params['require_tls'] = $requireTLS ? 'true' : 'false'; | php | {
"resource": ""
} |
q23182 | Domain.verify | train | public function verify(string $domain)
{
Assert::stringNotEmpty($domain);
$response = $this->httpPut(sprintf('/v3/domains/%s/verify', $domain));
| php | {
"resource": ""
} |
q23183 | Member.index | train | public function index(string $address, int $limit = 100, bool $subscribed = null)
{
Assert::stringNotEmpty($address);
Assert::greaterThan($limit, 0);
$params = [
'limit' => $limit,
];
| php | {
"resource": ""
} |
q23184 | Route.show | train | public function show(string $routeId)
{
Assert::stringNotEmpty($routeId);
$response = $this->httpGet(sprintf('/v3/routes/%s', $routeId));
| php | {
"resource": ""
} |
q23185 | Route.create | train | public function create(string $expression, array $actions, string $description, int $priority = 0)
{
Assert::isArray($actions);
$params = [
'priority' => (string) $priority,
'expression' => $expression,
'action' => $actions,
| php | {
"resource": ""
} |
q23186 | Route.update | train | public function update(
string $routeId,
string $expression = null,
array $actions = [],
string $description = null,
int $priority = null
) {
Assert::stringNotEmpty($routeId);
$params = [];
if (!empty($expression)) {
$params['expression'] ... | php | {
"resource": ""
} |
q23187 | Route.delete | train | public function delete(string $routeId)
{
Assert::stringNotEmpty($routeId);
$response = $this->httpDelete(sprintf('/v3/routes/%s', $routeId));
| php | {
"resource": ""
} |
q23188 | Webhook.verifyWebhookSignature | train | public function verifyWebhookSignature(int $timestamp, string $token, string $signature): bool
{
if (empty($timestamp) || empty($token) || empty($signature)) {
return false;
}
$hmac = hash_hmac('sha256', $timestamp.$token, $this->apiKey);
if (function_exists('hash_equal... | php | {
"resource": ""
} |
q23189 | Action.createMultiple | train | public static function createMultiple(array $data)
{
$items = [];
foreach ($data as $action) {
| php | {
"resource": ""
} |
q23190 | HttpApi.handleErrors | train | protected function handleErrors(ResponseInterface $response)
{
$statusCode = $response->getStatusCode();
switch ($statusCode) {
case 400:
throw HttpClientException::badRequest($response);
case 401:
throw HttpClientException::unauthorized($respo... | php | {
"resource": ""
} |
q23191 | HttpApi.httpPost | train | protected function httpPost(string $path, array $parameters = [], array $requestHeaders = []): | php | {
"resource": ""
} |
q23192 | HttpApi.httpPut | train | protected function httpPut(string $path, array $parameters = [], array $requestHeaders = []): ResponseInterface
{
try {
$response = $this->httpClient->sendRequest(
$this->requestBuilder->create('PUT', $path, $requestHeaders, $this->createRequestBody($parameters))
);
... | php | {
"resource": ""
} |
q23193 | ThemeRouteCollection.getThemeByRoute | train | public function getThemeByRoute($path)
{
$text = new Text();
// there's probably a more efficient way to do this
foreach ($this->themePaths as $lp => $layout) {
| php | {
"resource": ""
} |
q23194 | BitmapFormat.getAllImageFormats | train | public function getAllImageFormats()
{
if ($this->allImageFormats === null) {
$this->allImageFormats = [
static::FORMAT_PNG,
static::FORMAT_JPEG,
static::FORMAT_GIF,
| php | {
"resource": ""
} |
q23195 | BitmapFormat.getFormatMimeType | train | public function getFormatMimeType($format)
{
$format = $this->normalizeFormat($format);
$result = '';
switch ($format) {
case static::FORMAT_PNG:
case static::FORMAT_JPEG:
| php | {
"resource": ""
} |
q23196 | BitmapFormat.getFormatFromMimeType | train | public function getFormatFromMimeType($mimeType, $fallback = '')
{
$mimeType = trim(strtolower((string) $mimeType));
switch ($mimeType) {
case 'image/png':
$result = static::FORMAT_PNG;
break;
case 'image/jpeg':
$result = static... | php | {
"resource": ""
} |
q23197 | BitmapFormat.getFormatImagineSaveOptions | train | public function getFormatImagineSaveOptions($format)
{
$format = $this->normalizeFormat($format);
$result = [
'format' => $format,
];
switch ($format) {
case static::FORMAT_PNG:
$result['png_compression_level'] = $this->getDefaultPngCompression... | php | {
"resource": ""
} |
q23198 | BitmapFormat.setDefaultJpegQuality | train | public function setDefaultJpegQuality($value)
{
if ($this->valn->integer($value, 0, 100)) {
$value = (int) $value;
$this->config->set('concrete.misc.default_jpeg_image_compression', $value);
| php | {
"resource": ""
} |
q23199 | BitmapFormat.getDefaultJpegQuality | train | public function getDefaultJpegQuality()
{
$result = $this->config->get('concrete.misc.default_jpeg_image_compression');
if ($this->valn->integer($result, 0, 100)) {
$result = (int) $result;
| php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.