_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q252000 | SetTrait.set | validation | public function set($col, $value = ClauseInterface::NO_VALUE)
{
if (is_array($col)) {
return $this->setWithArrayData($col);
}
// update column name
if (!isset($this->clause_set[$col])) {
$this->clause_set[$col] = true;
}
// store data by row
... | php | {
"resource": ""
} |
q252001 | SetTrait.buildUpdateSet | validation | protected function buildUpdateSet()/*# : array */
{
$result = [];
// build set
$data = $this->clause_data[0];
foreach ($data as $col => $val) {
$result[] = $this->quote($col) . ' = ' . $this->processValue($val);
}
return $result;
} | php | {
"resource": ""
} |
q252002 | FirstClass.encodeString | validation | public function encodeString($string)
{
$string=strtolower($string);
$src="abcdefghijklmnopqrstuvwxyz0123456789 ";
$dst="jklmnopqrstuvwxyz0123456789abcdefghi ";
for ($i=0; $i<strlen($string); $i++) {
$pos=strpos($src, $string[$i]);
if ($pos===false) {
... | php | {
"resource": ""
} |
q252003 | QRPayment.setAlternativeAccount | validation | public function setAlternativeAccount($iban1, $swift1 = null, $iban2 = null, $swift2 = null)
{
if ($swift1 !== null) {
$iban1 .= '+' . $swift1;
}
if ($iban2 !== null) {
if ($swift2 !== null) {
$iban2 .= '+' . $swift2;
}
$iban1 .... | php | {
"resource": ""
} |
q252004 | QRPayment.setPaymentType | validation | public function setPaymentType($paymentType)
{
if (self::PAYMENT_PEER_TO_PEER !== $paymentType) {
throw new RuntimeException(Tools::poorManTranslate('fts-shared', 'Invalid payment type.'));
}
return $this->add('PT', $paymentType);
} | php | {
"resource": ""
} |
q252005 | QRPayment.generateText | validation | public function generateText()
{
$result = 'SPD' . self::DELIMITER . $this->version . self::DELIMITER . $this->implodeContent();
if ($this->appendCRC32) {
$result .= self::DELIMITER . 'CRC32:' . sprintf('%x', crc32($result));
}
return $result;
} | php | {
"resource": ""
} |
q252006 | QRPayment.generateImage | validation | public function generateImage($filename = false, $level = Constants::QR_ECLEVEL_L, $size = 3, $margin = 4)
{
$result = 'SPD' . self::DELIMITER . $this->version . self::DELIMITER . $this->implodeContent();
if ($this->appendCRC32) {
$result .= self::DELIMITER . 'CRC32:' . sprintf('%x', cr... | php | {
"resource": ""
} |
q252007 | QRPayment.implodeContent | validation | private function implodeContent()
{
ksort($this->content);
$output = '';
foreach ($this->content as $key => $value) {
$output .= $key . self::KV_DELIMITER . $value . self::DELIMITER;
}
return rtrim($output, self::DELIMITER);
} | php | {
"resource": ""
} |
q252008 | QRPayment.normalizeAccountNumber | validation | public static function normalizeAccountNumber($account)
{
$account = str_replace(' ', '', $account);
if (false === strpos($account, '-')) {
$account = '000000-' . $account;
}
$parts = explode('-', $account);
$parts[0] = str_pad($parts[0], 6, '0', STR_PAD_LEFT);
... | php | {
"resource": ""
} |
q252009 | QRPayment.accountToIBAN | validation | public static function accountToIBAN($account, $country = 'CZ')
{
$allowedCountries = ['AT', 'BE', 'BG', 'CZ', 'CY', 'DK', 'EE', 'FI', 'FR', 'DE', 'GI', 'GR', 'HU', 'IE', 'IS', 'IT', 'LI', 'LT', 'LU', 'LV', 'MC', 'MT', 'NL', 'NO', 'PL', 'PT', 'RO', 'SE', 'CH', 'SI', 'SK', 'ES', 'GB'];
$account = se... | php | {
"resource": ""
} |
q252010 | ViewAction.run | validation | public function run()
{
$viewName = $this->resolveViewName();
$this->controller->actionParams[$this->viewParam] = Yii::$app->request->get($this->viewParam);
$controllerLayout = null;
if ($this->layout !== null) {
$controllerLayout = $this->controller->layout;
... | php | {
"resource": ""
} |
q252011 | ViewAction.resolveViewName | validation | protected function resolveViewName()
{
$viewName = Yii::$app->request->get($this->viewParam, $this->defaultView);
if (!is_string($viewName) || !preg_match('~^\w(?:(?!\/\.{0,2}\/)[\w\/\-\.])*$~', $viewName)) {
if (YII_DEBUG) {
throw new NotFoundHttpException("The requeste... | php | {
"resource": ""
} |
q252012 | MediaTypeManager.registerMediaType | validation | public function registerMediaType($mediaType)
{
if ($this->check($mediaType)) {
$this->mediaTypes[(new \ReflectionClass($mediaType))->getConstant('NAME')] = $mediaType;
return $this;
} else {
throw new \Exception('registered MediaType must implement \MandarinMedi... | php | {
"resource": ""
} |
q252013 | MediaTypeManager.getMediaTypeMatch | validation | public function getMediaTypeMatch($data)
{
foreach ($this->getMediaTypes() as $mediaTypeClass) {
$instance = forward_static_call(array($mediaTypeClass, 'check'), $data);
if ($instance) {
return $instance;
}
}
} | php | {
"resource": ""
} |
q252014 | IdentityMap.with | validation | public static function with(array $theseObjects): MapsObjectsByIdentity
{
$objects = [];
$entityIds = [];
foreach ($theseObjects as $id => $object) {
$objects = IdentityMap::addTo($objects, (string) $id, $object);
$entityIds[theInstanceIdOf($object)] = (string) $id;
... | php | {
"resource": ""
} |
q252015 | User.loginByCookie | validation | protected function loginByCookie()
{
$value = Yii::$app->getRequest()->getCookies()->getValue($this->identityCookie['name']);
if ($value === null) {
return;
}
$data = json_decode($value, true);
if (count($data) !== 3 || !isset($data[0], $data[1], $data[2])) {
... | php | {
"resource": ""
} |
q252016 | User.loginRequired | validation | public function loginRequired($checkAjax = true)
{
$request = Yii::$app->getRequest();
if ($this->enableSession && (!$checkAjax || !$request->getIsAjax())) {
$this->setReturnUrl($request->getUrl());
}
if ($this->loginUrl !== null) {
$loginUrl = (array) $this->... | php | {
"resource": ""
} |
q252017 | Factory.fromArray | validation | public function fromArray(array $array)
{
$root = new Node(null);
$map = array();
$map[0] = $root;
// Create an entry in $map for every item in $a
foreach ($array as $element) {
if (3 !== count($element)) {
throw new Exception('Each array mus... | php | {
"resource": ""
} |
q252018 | Spritify.total_size | validation | private function total_size() {
$arr = array("width" => 0, "height" => 0);
foreach ($this->images as $image) {
if ($arr["width"] < $image["width"]) {
$arr["width"] = $image["width"];
}
$arr["height"] += $image["height"];
}
return $arr;
... | php | {
"resource": ""
} |
q252019 | Spritify.create_image | validation | private function create_image() {
$total = $this->total_size();
$sprite = imagecreatetruecolor($total["width"], $total["height"]);
imagesavealpha($sprite, true);
$transparent = imagecolorallocatealpha($sprite, 0, 0, 0, 127);
imagefill($sprite, 0, 0, $transparent);
$top = ... | php | {
"resource": ""
} |
q252020 | PhpSessionMiddleware.addSessionCookie | validation | private function addSessionCookie(ResponseInterface $response):ResponseInterface
{
$params = session_get_cookie_params();
$cookie = new SetCookie(
session_name(),
session_id(),
time() + $params["lifetime"],
$params["path"],
$params["domain"... | php | {
"resource": ""
} |
q252021 | PhpSessionMiddleware.addCacheLimiterHeaders | validation | private function addCacheLimiterHeaders(ResponseInterface $response):ResponseInterface
{
$cache = new CacheUtil();
switch (session_cache_limiter()) {
case 'public':
$response = $cache->withExpires($response, time() + session_cache_limiter() * 60);
$respons... | php | {
"resource": ""
} |
q252022 | AssetExtension.assetFunction | validation | public function assetFunction($asset, $serverPath = false) {
/** @var Request|null $request */
$request = isset($this->container['request']) ? $this->container['request'] : null;
$path = \ltrim($asset, '/\\');
$assetPath = Utils::fixPath($this->container->getRootDir() . '/' . $path);
//... | php | {
"resource": ""
} |
q252023 | Having.andHaving | validation | public function andHaving($column, $op, $value, $isParam = true)
{
$this->clauses[] = array("AND", $column, $op, $value, $isParam);
return $this;
} | php | {
"resource": ""
} |
q252024 | Having.orHaving | validation | public function orHaving($column, $op, $value, $isParam = true)
{
$this->clauses[] = array("OR", $column, $op, $value, $isParam);
return $this;
} | php | {
"resource": ""
} |
q252025 | RegexURLParser.parse | validation | public function parse(UriInterface $uri): ParsedURL
{
$matches = [];
if(preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
throw new InvalidRequestURLException("Unable to parse request path: did not match regex");
}
if(!($endpoint = $matches["endpoint"] ?? nul... | php | {
"resource": ""
} |
q252026 | PDO.runQuery | validation | public function runQuery(\Peyote\Query $query)
{
return $this->run($query->compile(), $query->getParams());
} | php | {
"resource": ""
} |
q252027 | PDO.run | validation | public function run($query, array $params = array())
{
$statement = $this->pdo->prepare($query);
$statement->execute($params);
return $statement;
} | php | {
"resource": ""
} |
q252028 | SearchControllerTrait.onlineHelpAction | validation | public function onlineHelpAction(Request $request) {
$template = $this->searchService->getOnlineHelp($request->getLocale(), $this->getDefaultLocale());
return $this->render($template ?: 'StingerSoftEntitySearchBundle:Help:no_help.html.twig');
} | php | {
"resource": ""
} |
q252029 | SearchControllerTrait.getSearchFacets | validation | protected function getSearchFacets(SessionInterface $session) {
$facets = $session->get($this->getSessionPrefix() . '_facets', false);
return $facets ? \json_decode($facets, true) : $this->getDefaultFacets();
} | php | {
"resource": ""
} |
q252030 | SearchControllerTrait.setSearchFacets | validation | protected function setSearchFacets(SessionInterface $session, $facets) {
$session->set($this->getSessionPrefix() . '_facets', \json_encode($facets));
} | php | {
"resource": ""
} |
q252031 | UtilityTrait.quote | validation | protected function quote(/*# string */ $str)/*# : string */
{
return $this->getDialect()->quote(
$str,
$this->getSettings()['autoQuote'] ?
DialectInterface::QUOTE_YES :
DialectInterface::QUOTE_NO
);
} | php | {
"resource": ""
} |
q252032 | TwigExtensionTagServiceProvider.register | validation | public function register(SilexApp $app) {
$app['twig'] = $app->share($app->extend('twig', function (\Twig_Environment $twig, SilexApp $app) {
$class = $this->getServiceConfig()->getProviderClass();
$twig->addExtension(new $class);
return $twig;
}));
} | php | {
"resource": ""
} |
q252033 | User.get | validation | public function get($idOrUser)
{
// All the services we need
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$userRepository = $main->getUserEntityRepository();
if('current' == $idOrUser) {
return $userRepository->get($idOrUser, $this->getServiceLocator());
}
$user = $this->... | php | {
"resource": ""
} |
q252034 | User.delete | validation | public function delete($idOrUser, $forceLogout = true)
{
// All the services we need
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$em = $main->getEntityManager();
$user = $this->getEntity($idOrUser);
$classifiedService = $this->getServiceLocator()->get('document.service.classified')... | php | {
"resource": ""
} |
q252035 | User.passwordRecovery | validation | public function passwordRecovery(array $data)
{
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$userRepository = $main->getUserEntityRepository();
$form = $this->getServiceLocator()->get('user.form.passwordrecovery');
$form->setData($data);
if (!$form->isValid()) {
throw new ... | php | {
"resource": ""
} |
q252036 | User.contact | validation | public function contact(array $data, $destination = null)
{
$authService = $this->getServiceLocator()->get('ControllerPluginManager')->get('zfcUserAuthentication');
if(null === $destination && !$authService->hasIdentity()) {
throw new \Exception("Errore si sistema.");
}... | php | {
"resource": ""
} |
q252037 | User.classifiedAnswer | validation | public function classifiedAnswer(array $data)
{
$id = isset($data['id']) ? $data['id'] : null;
if(empty($id)) {
throw new \Exception("Errore si sistema.");
}
$main = $this->getServiceLocator()->get('neobazaar.service.main');
$documentRepository = $main->get... | php | {
"resource": ""
} |
q252038 | User.getCryptedPassword | validation | public function getCryptedPassword($password)
{
$bcrypt = new Bcrypt;
$bcrypt->setCost($this->getOptions()->getPasswordCost());
return $bcrypt->create($password);
} | php | {
"resource": ""
} |
q252039 | User.dateToSqlFormat | validation | public function dateToSqlFormat($dateString)
{
$dateFormatter = new \IntlDateFormatter(
\Locale::getDefault(),
\IntlDateFormatter::NONE,
\IntlDateFormatter::NONE,
\date_default_timezone_get(),
\IntlDateFormatter::GREGORIAN,
"dd MMM yyyy"
);
$time = $dateFormatter->parse($dateString)... | php | {
"resource": ""
} |
q252040 | PageHistoricController.renderPageHistoricAction | validation | public function renderPageHistoricAction()
{
$idPage = $this->params()->fromRoute('idPage', $this->params()->fromQuery('idPage', ''));
$melisKey = $this->params()->fromRoute('melisKey', '');
$view = new ViewModel();
$view->idPage = $idPage;
$view->melisKey = $melisKey;
retur... | php | {
"resource": ""
} |
q252041 | PageHistoricController.renderPageHistoricTableAction | validation | public function renderPageHistoricTableAction()
{
$translator = $this->getServiceLocator()->get('translator');
$melisKey = $this->params()->fromRoute('melisKey', '');
$melisTool = $this->getServiceLocator()->get('MelisCoreTool');
$melisTool->setMelisToolKey(self::PLUGIN_INDEX, self:... | php | {
"resource": ""
} |
q252042 | PageHistoricController.renderPageHistoricContentFiltersActionsAction | validation | public function renderPageHistoricContentFiltersActionsAction()
{
$melisPageHistoricTable = $this->getServiceLocator()->get('MelisPagehistoricTable');
//get distinct actions on database
$actions = $melisPageHistoricTable->getPageHistoricListOfActions()->toArray();
$translator = $this... | php | {
"resource": ""
} |
q252043 | PageHistoricController.savePageHistoricAction | validation | public function savePageHistoricAction()
{
$responseData = $this->params()->fromRoute('datas', $this->params()->fromQuery('datas', ''));
$idPage = isset($responseData['idPage']) ? $responseData['idPage'] : (!empty($responseData[0]['idPage'])?($responseData[0]['idPage']):0);
$isNew = i... | php | {
"resource": ""
} |
q252044 | PageHistoricController.deletePageHistoricAction | validation | public function deletePageHistoricAction()
{
$responseData = $this->params()->fromRoute('datas', $this->params()->fromQuery('datas', ''));
$idPage = $responseData[0]['idPage'];
$response = array('idPage' => $idPage);
$this->getEventManager()->trigger('meliscmspagehistoric_hi... | php | {
"resource": ""
} |
q252045 | PageHistoricController.getBackOfficeUsersAction | validation | public function getBackOfficeUsersAction()
{
$melisPageHistoricTable = $this->getServiceLocator()->get('MelisPageHistoricTable');
$users = $melisPageHistoricTable->getUsers()->toArray();
return new JsonModel(array(
'users' => $users,
));
} | php | {
"resource": ""
} |
q252046 | StatementAbstract.build | validation | protected function build()/*# : string */
{
// settings
$settings = $this->getSettings();
// before build()
$this->beforeBuild();
// configs
$configs = $this->getConfig();
// start of result array
$result = [$this->getType()];
// seperator... | php | {
"resource": ""
} |
q252047 | StatementAbstract.getConfig | validation | protected function getConfig()/*# : array */
{
$config = array_replace($this->config, $this->dialect_config);
ksort($config);
return $config;
} | php | {
"resource": ""
} |
q252048 | CreateTableTrait.select | validation | public function select()/*# : SelectStatementInterface */
{
$cols = func_get_args();
return $this->getBuilder()->setPrevious($this)
->select(false)->col($cols);
} | php | {
"resource": ""
} |
q252049 | RestfulApi.isRender | validation | public static function isRender($request)
{
return true;
$accept = $request->header('accept') ?? '';
if (static::isHas($accept, 'json') || static::isHas($accept, 'api')) {
return true;
} else if (static::isHas($accept, 'html') || static::isHas($accept, 'xml') || static::i... | php | {
"resource": ""
} |
q252050 | CheckboxSetField.__templates | validation | protected function __templates($customTemplate = null, $customTemplateSuffix = null) {
$templates = SSViewer::get_templates_by_class($this->class, $customTemplateSuffix, \FormField::class);
//$templates = \SSViewer::get_templates_by_class($this->class, '', __CLASS__);
if (!$templates) {
throw new \Exception("N... | php | {
"resource": ""
} |
q252051 | DefaultController.actionIndex | validation | public function actionIndex($option = null)
{
// todo: вынести в конфиг домена
$allNames = [
'web/assets',
'runtime',
'runtime/cache',
'tests/_output',
];
$answer = Select::display('Select objects', $allNames, 1);
$result = ClearHelper::run($answer);
if($result) {
Output::items($result, "Cle... | php | {
"resource": ""
} |
q252052 | ParameterAwareTrait.bindValues | validation | protected function bindValues(
/*# string */ $sql,
array $settings
)/*# : string */ {
$bindings = &$this->bindings;
$escape = $this->getEscapeCallable($settings['escapeFunction']);
$params = $this->getBuilder()->getPlaceholderMapping();
// real function
$... | php | {
"resource": ""
} |
q252053 | AbstractFinisher.callAPI | validation | protected function callAPI($data) {
$apiUtility = new PipedriveApi($this->apiEndpoint);
$apiUtility->setData($data);
$formState = $this->finisherContext->getFormRuntime()->getFormState();
$response = $apiUtility->execute();
if($response->data->id) {
$formState->setFormValue($this->getIdenti... | php | {
"resource": ""
} |
q252054 | InstanceWrapperTrait.callMethodInWrappedInst | validation | public function callMethodInWrappedInst($method, $args)
{
$i = $this->getWrappedInst();
if (method_exists($i, $method)) {
return call_user_method_array($method, $i, $args);
}
throw new UnknownMethodException('Calling unknown method: ' . get_class($i) . "::$method()");
... | php | {
"resource": ""
} |
q252055 | DataStoreAwareContainerTrait._setDataStore | validation | protected function _setDataStore($dataStore)
{
if (!is_null($dataStore)) {
$dataStore = $this->_normalizeContainer($dataStore);
}
$this->dataStore = $dataStore;
} | php | {
"resource": ""
} |
q252056 | Client.authenticate | validation | public function authenticate($authMethod, $options)
{
$sm = $this->getServiceManager();
$authListener = $sm->get($authMethod);
$authListener->setOptions($options);
$this->getHttpClient()->getEventManager()->attachAggregate($authListener);
} | php | {
"resource": ""
} |
q252057 | Console.write | validation | public static function write($messages, $style = '', $length = 0, $suffix = '')
{
if (self::$silent) {
return;
}
if (!is_array($messages)) {
$messages = [(string)$messages];
}
if (count($messages) > 0) {
foreach ($messages as $message) {
... | php | {
"resource": ""
} |
q252058 | Console.info | validation | public static function info($messages, $linebreak = true, $length = 0)
{
$separator = $linebreak ? "\n" : '';
self::write($messages, 'info', $length, $separator);
} | php | {
"resource": ""
} |
q252059 | Console.error | validation | public static function error($messages, $linebreak = true, $length = 0)
{
$separator = $linebreak ? "\n" : '';
self::write($messages, 'error', $length, $separator);
} | php | {
"resource": ""
} |
q252060 | Console.comment | validation | public static function comment($messages, $linebreak = true, $length = 0)
{
$separator = $linebreak ? "\n" : '';
self::write($messages, 'comment', $length, $separator);
} | php | {
"resource": ""
} |
q252061 | Console.warning | validation | public static function warning($messages, $linebreak = true, $length = 0)
{
$separator = $linebreak ? "\n" : '';
self::write($messages, 'warning', $length, $separator);
} | php | {
"resource": ""
} |
q252062 | Console.title | validation | public static function title($messages, $linebreak = true, $length = 0)
{
$separator = $linebreak ? "\n" : '';
self::write($messages, 'title', $length, $separator);
} | php | {
"resource": ""
} |
q252063 | Console.block | validation | public static function block($messages, $style)
{
if (is_string($messages)) {
$messages = [$messages];
}
if (count($messages) > 0) {
self::writeln(str_repeat(' ', self::$lineLength), $style);
foreach ($messages as $message) {
$message = ' '... | php | {
"resource": ""
} |
q252064 | Console.ask | validation | public static function ask($question, $defaultValue = null, $secret = false)
{
$value = '';
while (trim($value) == '') {
self::writeln('');
self::write(' ' . $question, 'info');
if ($defaultValue !== null) {
self::write(' [');
self:... | php | {
"resource": ""
} |
q252065 | Console.confirm | validation | public static function confirm($question, $allowShort, $defaultValue = false)
{
$value = $defaultValue ? 'yes' : 'no';
$value = self::ask($question . ' (yes/no)', $value);
return $value == 'yes' || ($value == 'y' && $allowShort);
} | php | {
"resource": ""
} |
q252066 | Console.choice | validation | public static function choice($question, array $choices, $defaultValue = null)
{
$value = '';
while (trim($value) == '') {
// Write prompt.
self::writeln('');
self::write(' ' . $question, 'info');
if ($defaultValue !== null) {
// @code... | php | {
"resource": ""
} |
q252067 | Console.table | validation | public static function table(array $rows, array $headers = [])
{
$table = new Table();
$table->setRows($rows);
if (count($headers) > 0) {
$table->setHeaders($headers);
}
$output = $table->render();
self::writeln($output);
} | php | {
"resource": ""
} |
q252068 | Console.words | validation | public static function words(array $words, $style = '', $separator = ', ')
{
self::write(implode($separator, $words), $style);
} | php | {
"resource": ""
} |
q252069 | Fs.sanitizeName | validation | public static function sanitizeName(string $name): string
{
$basename = basename($name);
$dir = ($basename === $name) ? null : dirname($name);
$basename = preg_replace("/[^a-zA-Z0-9-_.]/", "_", $basename);
return ($dir === null) ? $basename : "$dir/$basename";
} | php | {
"resource": ""
} |
q252070 | Fs.dir | validation | public static function dir(string $path): fs\entity\DirEntity
{
return (new fs\entity\DirEntity($path))->normalize();
} | php | {
"resource": ""
} |
q252071 | Fs.file | validation | public static function file(string $path): fs\entity\FileEntity
{
return (new fs\entity\FileEntity($path))->normalize();
} | php | {
"resource": ""
} |
q252072 | Fs.createFromSplFileInfo | validation | public static function createFromSplFileInfo(\SplFileInfo $info)
{
$realpath = $info->getRealPath();
if ($info->isFile()) {
return new fs\entity\FileEntity($realpath);
}
return new fs\entity\DirEntity($realpath);
} | php | {
"resource": ""
} |
q252073 | StateController.actionIndex | validation | public function actionIndex()
{
$searchModel = new SearchState(Yii::$app->request->get());
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel
, 'dataProvider' => $dataPr... | php | {
"resource": ""
} |
q252074 | Join.on | validation | public function on($column1, $op, $column2)
{
if ($this->active_join === null)
{
throw new \Peyote\Exception("You need to start a join before calling \Peyote\Join::on()");
}
list($table, $type) = $this->active_join;
$this->active_join = null;
$this->joins[] = array("ON", $table, $type, $column1, $op, $... | php | {
"resource": ""
} |
q252075 | Join.using | validation | public function using($column)
{
if ($this->active_join === null)
{
throw new \Peyote\Exception("You need to start a join before calling \Peyote\Join::using()");
}
list($table, $type) = $this->active_join;
$this->active_join = null;
$this->joins[] = array("USING", $table, $type, $column);
return $thi... | php | {
"resource": ""
} |
q252076 | Join.compileOn | validation | private function compileOn(array $join)
{
$sql = array();
list($on, $table, $type, $c1, $op, $c2) = $join;
if ($type !== null)
{
$sql[] = $type;
}
array_push($sql, "JOIN", $table, "ON", $c1, $op, $c2);
return join(' ', $sql);
} | php | {
"resource": ""
} |
q252077 | Join.compileUsing | validation | private function compileUsing(array $join)
{
$sql = array();
list($using, $table, $type, $column) = $join;
if ($type !== null)
{
$sql[] = $type;
}
array_push($sql, "JOIN", $table, "USING({$column})");
return join(' ', $sql);
} | php | {
"resource": ""
} |
q252078 | OrderByTrait.buildOrderBy | validation | protected function buildOrderBy()/*# : array */
{
$result = [];
foreach ($this->clause_orderby as $ord) {
$result[] = $ord[0] ? $ord[1] :
($this->quote($ord[1]) . ' ' . $ord[2]);
}
return $result;
} | php | {
"resource": ""
} |
q252079 | File.setRaw | validation | protected function setRaw($Key, $Val, $expire = 0)
{
$CacheFile = $this->getCacheFile($Key);
return file_put_contents($CacheFile, serialize($Val)) > 0;
} | php | {
"resource": ""
} |
q252080 | File.deleteRaw | validation | protected function deleteRaw($Key)
{
$CacheFile = $this->getCacheFile($Key);
if (file_exists($CacheFile)) {
return unlink($CacheFile);
}
return true;
} | php | {
"resource": ""
} |
q252081 | File.getRaw | validation | protected function getRaw($Key)
{
$CacheFile = $this->getCacheFile($Key);
if (!file_exists($CacheFile)) {
return false;
}
return unserialize(file_get_contents($CacheFile));
} | php | {
"resource": ""
} |
q252082 | HAL.sayHello | validation | public function sayHello()
{
$text = $this->getHALLogo();
if ($this->showText) {
$text .= $this->getHelloDave();
}
$lines = explode("\n", $text);
$spaces = '';
if ($this->center) {
$max_length = 0;
foreach ($lines as $line) {
... | php | {
"resource": ""
} |
q252083 | ProductDoctrineEventSubscriber.refreshProductSellPrices | validation | protected function refreshProductSellPrices(ProductInterface $product)
{
$sellPrice = $product->getSellPrice();
$grossAmount = $sellPrice->getGrossAmount();
$discountedGrossAmount = $sellPrice->getDiscountedGrossAmount();
$taxRate = $product->getSe... | php | {
"resource": ""
} |
q252084 | ProductDoctrineEventSubscriber.refreshProductVariantSellPrice | validation | protected function refreshProductVariantSellPrice(VariantInterface $variant)
{
$product = $variant->getProduct();
$sellPrice = $product->getSellPrice();
$grossAmount = $this->calculateAttributePrice($variant, $sellPrice->getGrossAmount());
$discoun... | php | {
"resource": ""
} |
q252085 | ProductDoctrineEventSubscriber.calculateAttributePrice | validation | protected function calculateAttributePrice(VariantInterface $variant, $amount)
{
$modifierType = $variant->getModifierType();
$modifierValue = $variant->getModifierValue();
switch ($modifierType) {
case '+':
$amount = $amount + $modifierValue;
... | php | {
"resource": ""
} |
q252086 | ProductDoctrineEventSubscriber.refreshProductBuyPrices | validation | protected function refreshProductBuyPrices(ProductInterface $product)
{
$buyPrice = $product->getBuyPrice();
$grossAmount = $buyPrice->getGrossAmount();
$taxRate = $product->getBuyPriceTax()->getValue();
$netAmount = TaxHelper::calculateNetPrice($grossAmount, $taxRate);
... | php | {
"resource": ""
} |
q252087 | Pluralize.restoreWordCase | validation | protected function restoreWordCase($token)
{
if ($token === strtoupper($token)) {
return function ($word) {
return strtoupper($word);
};
}
if ($token === ucfirst($token)) {
return function ($word) {
return ucfirst($word);
};
}
return function ($word) {
return $word;
};
} | php | {
"resource": ""
} |
q252088 | AssetConverter.runCommand | validation | protected function runCommand($command, $basePath, $asset, $result)
{
$command = Yii::getAlias($command);
$command = strtr($command, [
'{from}' => escapeshellarg("$basePath/$asset"),
'{to}' => escapeshellarg("$basePath/$result"),
]);
$descriptor = [
... | php | {
"resource": ""
} |
q252089 | FromTrait.getTableName | validation | protected function getTableName($returnAlias = false)/*# : string */
{
$result = '';
foreach ($this->clause_table as $k => $v) {
if (!is_int($k) && $returnAlias) {
return $k;
} else {
return $v;
}
}
return $result;
... | php | {
"resource": ""
} |
q252090 | EntityToDocumentMapper.fillDocument | validation | protected function fillDocument(Document $document, object $object) : bool {
if($object instanceof SearchableEntity) {
return $object->indexEntity($document);
}
$mapping = $this->getMapping(\get_class($object));
$accessor = PropertyAccess::createPropertyAccessor();
foreach($mapping as $fieldName => $proper... | php | {
"resource": ""
} |
q252091 | EntityToDocumentMapper.getMapping | validation | protected function getMapping(string $clazz) : array {
if(isset($this->cachedMapping[$clazz])) {
return $this->cachedMapping[$clazz];
}
$ref = new \ReflectionClass($clazz);
$mapping = array();
foreach($this->mapping as $className => $config) {
if($clazz === $className || $ref->isSubclassOf($classN... | php | {
"resource": ""
} |
q252092 | Install.executeProcess | validation | public function executeProcess($command, $beforeNotice = false, $afterNotice = false):void
{
$this->echo('info', $beforeNotice ? ' '.$beforeNotice : $command);
$process = new Process($command, null, null, null, $this->option('timeout'), null);
$process->run(function ($type, $buffer) {
... | php | {
"resource": ""
} |
q252093 | Install.echo | validation | public function echo($type, $content)
{
if ($this->option('debug') == false) {
return;
}
// skip empty lines
if (trim($content)) {
$this->{$type}($content);
}
} | php | {
"resource": ""
} |
q252094 | Limit.setLimit | validation | public function setLimit($num, $offset = 0)
{
$this->limit = (int) $num;
$this->offset = (int) $offset;
} | php | {
"resource": ""
} |
q252095 | ColDefinitionTrait.buildCol | validation | protected function buildCol()/*# : array */
{
$result = [];
foreach ($this->col_defs as $col) {
$res = [];
// name
$res[] = $this->quote($col['name']);
// type
$res[] = $col['type'];
// not null ?
if (isset($col['... | php | {
"resource": ""
} |
q252096 | Location.getLocationString | validation | public function getLocationString()
{
$normalized = '';
if ($this->city !== null) {
$normalized .= $this->city->name;
}
if ($this->region !== null) {
$normalized .= ' ' . $this->region->name;
}
if ($this->postal_code !== null) {
$no... | php | {
"resource": ""
} |
q252097 | Container.has | validation | public function has(string $typeName): bool
{
if (isset($this->shared[$typeName]) || isset($this->definitions[$typeName])) {
return true;
}
if (!isset($this->typeCache[$typeName])) {
if (\class_exists($typeName) || \interface_exists($typeName, false)) {
... | php | {
"resource": ""
} |
q252098 | Container.getMarked | validation | public function getMarked(string $marker): array
{
if (!\is_subclass_of($marker, Marker::class)) {
throw new \InvalidArgumentException(\sprintf('Marker implementation %s must extend %s', $marker, Marker::class));
}
if (!isset($this->marked[$marker])) {
$this-... | php | {
"resource": ""
} |
q252099 | Container.eachMarked | validation | public function eachMarked(callable $callback, $result = null)
{
$ref = new \ReflectionFunction($callback);
$params = $ref->getParameters();
if (\count($params) < 2) {
throw new \InvalidArgumentException(\sprintf('Callback for marker processing must declare at least 2 ar... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.