_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q5500 | CategoryModel._buildTree | train | private function _buildTree(array &$tree, array $parents, array $orderedCategories, CmsCategoryRecord $parentCategory = null)
{
//uzupełnienie rodziców
if ($parentCategory !== null) {
$parents[$parentCategory->id] = $parentCategory;
} else {
$parentCategory = new CmsC... | php | {
"resource": ""
} |
q5501 | User.getRoles | train | public function getRoles()
{
$roles = array();
foreach ($this->groups as $group) {
$roles[] = $group->getAsRole();
}
$roles[] = 'ROLE_USER';
return $roles;
} | php | {
"resource": ""
} |
q5502 | CmsFileRecord.getHashName | train | public function getHashName()
{
//brak pliku
if ($this->id === null) {
return;
}
return substr(md5($this->name . \App\Registry::$config->salt), 0, 8);
} | php | {
"resource": ""
} |
q5503 | CmsFileRecord.getPosterUrl | train | public function getPosterUrl($scaleType = 'default', $scale = null, $https = null)
{
//brak pliku
if (null === $this->id || !$this->data->posterFileName) {
return;
}
//ścieżka CDN
$cdnPath = rtrim(\Mmi\App\FrontController::getInstance()->getView()->cdn ? \Mmi\App\... | php | {
"resource": ""
} |
q5504 | CmsFileRecord.delete | train | public function delete()
{
//usuwanie meta
if (!parent::delete()) {
return false;
}
//plik jest ciągle potrzebny (ma linki)
if (0 != (new CmsFileQuery)->whereName()->equals($this->name)->count()) {
return true;
}
//kasowanie z systemu p... | php | {
"resource": ""
} |
q5505 | Query.limit | train | public function limit($limit, $offset = null)
{
$this->_limit = $limit > 0 ? (int)$limit : null;
$this->_offset = $offset > 0 ? (int)$offset : null;
return $this;
} | php | {
"resource": ""
} |
q5506 | GridRequestHandler._retrievePostFilter | train | protected function _retrievePostFilter(\Mmi\Http\RequestPost $post)
{
//brak filtracji dla tego grida
if (false === strpos($post->filter, $this->_grid->getClass())) {
return;
}
$columnName = substr($post->filter, strpos($post->filter, '[') + 1, -1);
$tableName = n... | php | {
"resource": ""
} |
q5507 | RepositoryCreator.create | train | public function create(
ReflectionClass $modelReflection,
$classFileName,
$shortClassName,
$classNamespace,
$contractFileName,
$shortContractName,
$contractNamespace,
array $methods
) {
$createdFiles = [$this->createRepository(
$mod... | php | {
"resource": ""
} |
q5508 | RepositoryCreator.createRepository | train | protected function createRepository(
ReflectionClass $model,
$fileName,
$shortName,
$namespace,
$contractName,
$contractNamespace,
array $methods
) {
$path = app_path($fileName);
$stub = $this->compileStub('repository.stub', [
'nam... | php | {
"resource": ""
} |
q5509 | RepositoryCreator.createContract | train | protected function createContract(ReflectionClass $model, $fileName, $shortName, $namespace, array $methods)
{
$path = app_path($fileName);
$stub = $this->compileStub('contract.stub', [
'namespace' => $namespace,
'class' => $shortName,
'model.fullna... | php | {
"resource": ""
} |
q5510 | RepositoryCreator.compileMethods | train | protected function compileMethods($stub, array $methods)
{
foreach ($methods as $method) {
$stub = str_replace(['{{' . $method . '}}', '{{/' . $method . '}}'], '', $stub);
}
foreach ($this->methods as $method) {
$stub = preg_replace('/{{' . $method . '}}(.*){{\/' . $... | php | {
"resource": ""
} |
q5511 | RepositoryCreator.compileStub | train | protected function compileStub($stub, array $data)
{
$stub = $this->files->get(__DIR__ . '/../stub/' . $stub);
foreach ($data as $key => $value) {
$stub = str_replace('{{' . $key . '}}', $value, $stub);
}
return $stub;
} | php | {
"resource": ""
} |
q5512 | MenuNodeDefinition.menuNodeHierarchy | train | public function menuNodeHierarchy($depth = 10)
{
if ($depth == 0) {
return $this;
}
return $this
->prototype('array')
->children()
->scalarNode('route')->end()
->arrayNode('routeParameters')
... | php | {
"resource": ""
} |
q5513 | AclController.deleteRoleAction | train | public function deleteRoleAction()
{
//wyszukiwanie i usuwanie roli
if ((null !== $role = (new \Cms\Orm\CmsRoleQuery)->findPk($this->id))) {
$this->getMessenger()->addMessage(($deleteResult = (bool) $role->delete()) ? 'messenger.acl.role.deleted' : 'messenger.acl.role.delete.error', $del... | php | {
"resource": ""
} |
q5514 | UploadController.pluploadAction | train | public function pluploadAction()
{
set_time_limit(5 * 60);
//obiekt handlera plupload
$pluploadHandler = new Model\PluploadHandler();
//jeśli wystąpił błąd
if (!$pluploadHandler->handle()) {
return $this->_jsonError($pluploadHandler->getErrorCode(), $pluploadHandl... | php | {
"resource": ""
} |
q5515 | UploadController.deleteAction | train | public function deleteAction()
{
//szukamy rekordu pliku
if (!$this->getPost()->cmsFileId || null === $record = (new CmsFileQuery)->findPk($this->getPost()->cmsFileId)) {
return $this->_jsonError(178);
}
//sprawdzenie zgodności z obiektem formularza
if ($record->o... | php | {
"resource": ""
} |
q5516 | UploadController.downloadAction | train | public function downloadAction()
{
if (null === $file = (new CmsFileQuery)->byObject($this->object, $this->objectId)
->findPk($this->id)) {
return '';
}
$this->getResponse()->redirectToUrl($file->getUrl());
} | php | {
"resource": ""
} |
q5517 | UploadController._savePoster | train | protected function _savePoster($blob, \Cms\Orm\CmsFileRecord $file)
{
//brak danych
if (!\preg_match('/^data:(image\/[a-z]+);base64,(.*)/i', $blob, $match)) {
return;
}
//nazwa postera
$posterFileName = substr($file->name, 0, strpos($file->name, '.')) . '-' . $fil... | php | {
"resource": ""
} |
q5518 | GeneratorFinderCache.getAllClasses | train | public function getAllClasses(MetaDataInterface $metadata = null)
{
$cacheFilename = $this->directories['Cache'] . DIRECTORY_SEPARATOR;
$cacheFilename .= md5('genrator_getAllClasses' . ($metadata !== null) ? get_class($metadata) : '');
if ($this->fileManager->isFile($cacheFilename) === tru... | php | {
"resource": ""
} |
q5519 | Manager.fireEvent | train | public function fireEvent($event, $source, $data = [])
{
if ($this->_listeners) {
list($p1, $p2) = explode(':', $event, 2);
if (isset($this->_listeners[$p1])) {
foreach ($this->_listeners[$p1] as $k => $v) {
/**@var \ManaPHP\Event\Listener $listene... | php | {
"resource": ""
} |
q5520 | ACLType.getStandardPermissions | train | protected function getStandardPermissions(array $options, $master, $owner)
{
switch ($options['permissions']) {
case 'standard::object':
$disable = array ();
// if not owner or master, disable all permissions
if (!$master && !$owner) {
... | php | {
"resource": ""
} |
q5521 | PharController.manacliCommand | train | public function manacliCommand()
{
$this->alias->set('@phar', '@data/manacli_phar');
$pharFile = $this->alias->resolve('@root/manacli.phar');
$this->console->writeLn(['cleaning `:dir` dir', 'dir' => $this->alias->resolve('@phar')]);
$this->filesystem->dirReCreate('@phar');
... | php | {
"resource": ""
} |
q5522 | FileConflictManager.handle | train | public function handle($filePath, $results)
{
$responseCollection = new PredefinedResponseCollection();
$responseCollection->append(
new PredefinedResponse('postpone', 'postpone', self::POSTPONE)
);
$responseCollection->append(
new PredefinedResponse('show dif... | php | {
"resource": ""
} |
q5523 | GeneratorParser.analyzeDependencies | train | private function analyzeDependencies(array $process, PhpStringParser $phpParser, GeneratorDataObject $generator)
{
$generator = clone $generator;
if (isset($process['dependencies']) === true && is_array($process['dependencies']) === true) {
foreach ($process['dependencies'] as $dependen... | php | {
"resource": ""
} |
q5524 | GeneratorParser.analyzePreParser | train | private function analyzePreParser(
array $process,
PhpStringParser $phpParser,
GeneratorDataObject $generator,
$firstIteration
) {
$generator = clone $generator;
if ($this->parserCollection->getPreParse()->count() > 0) {
foreach ($this->parserCollection->... | php | {
"resource": ""
} |
q5525 | GeneratorParser.analyzePostParser | train | private function analyzePostParser(
array $process,
PhpStringParser $phpParser,
GeneratorDataObject $generator,
$firstIteration
) {
$generator = clone $generator;
if ($this->parserCollection->getPostParse()->count() > 0) {
foreach ($this->parserCollection... | php | {
"resource": ""
} |
q5526 | PasswordController.setContainer | train | public function setContainer(ContainerInterface $container = null)
{
parent::setContainer($container);
if (!$this->container->getParameter('fom_user.reset_password')) {
throw new AccessDeniedHttpException();
}
} | php | {
"resource": ""
} |
q5527 | MetaDataConfigDAO.retrieveAll | train | public function retrieveAll()
{
$adapterCollection = new MetaDataSourceCollection();
foreach ($this->fileManager->glob(Installer::BASE_PATH . self::SOURCE_PATH . '*' . self::EXTENSION) as $file) {
// Decode
$config = $this->transtyper->decode($this->fileManager->fileGetConte... | php | {
"resource": ""
} |
q5528 | MySQLMetaDataDAOFactory.getInstance | train | public static function getInstance(DriverConfig $config)
{
$pdoDriver = PdoDriverFactory::getInstance();
return new MySQLMetaDataDAO(
$pdoDriver->getConnection($config),
$config
);
} | php | {
"resource": ""
} |
q5529 | CategoryWidgetController.deleteAttributeRelationAction | train | public function deleteAttributeRelationAction()
{
//usuwanie relacji
(new AttributeController($this->getRequest(), $this->view))->deleteAttributeRelationAction();
$this->getResponse()->redirect('cmsAdmin', 'categoryWidget', 'edit', ['id' => $this->id]);
} | php | {
"resource": ""
} |
q5530 | PostgreSQLMetaDataDAOFactory.getInstance | train | public static function getInstance(DriverConfig $config)
{
$pdoDriver = PdoDriverFactory::getInstance();
return new PostgreSQLMetaDataDAO(
$pdoDriver->getConnection($config),
$config,
new SqlManager()
);
} | php | {
"resource": ""
} |
q5531 | Project.addGuest | train | public function addGuest($id,$guest) {
if(is_string($guest)) {
$params = array('email'=>$guest);
} elseif(is_numeric($guest)) {
$params = array('user_id'=>$guest);
}else {
throw new \Exception('Invalid parameter');
}
return $this->po... | php | {
"resource": ""
} |
q5532 | Category.afterSave | train | public function afterSave()
{
//jeśli czegoś nie uddało się zapisać wcześniej
if (!parent::afterSave()) {
return false;
}
//jeśli nie udało się zapisać powiązań z rolami
if (!$this->_saveRoles()) {
... | php | {
"resource": ""
} |
q5533 | ReplacePlaceholdersInTemplateFiles.getPlaceholderArray | train | protected function getPlaceholderArray()
{
$placeholderArray = [];
foreach ($this->getConfigKey('Placeholders') as $key => $data) {
$placeholderArray[$key] = $data['value'];
}
return $placeholderArray;
} | php | {
"resource": ""
} |
q5534 | TagRelation.beforeSave | train | public function beforeSave()
{
$tag = $this->getElement('tag')->getValue();
//wyszukanie tagu
if (null === $tagRecord = (new \Cms\Orm\CmsTagQuery)
->whereTag()->equals($tag)
->findFirst()) {
//utworzenie tagu
$tagRecord = new \Cms\Orm\CmsTagRec... | php | {
"resource": ""
} |
q5535 | Di.set | train | public function set($name, $definition)
{
if (is_string($definition)) {
if (strpos($definition, '/') !== false || preg_match('#^[\w\\\\]+$#', $definition) !== 1) {
$definition = ['class' => $this->_interClassName($name), $definition, 'shared' => false];
} else {
... | php | {
"resource": ""
} |
q5536 | Di.setShared | train | public function setShared($name, $definition)
{
if (isset($this->_instances[$name])) {
throw new MisuseException(['it\'s too late to setShared(): `:name` instance has been created', 'name' => $name]);
}
if (is_string($definition)) {
if (strpos($definition, '/') !== f... | php | {
"resource": ""
} |
q5537 | Di.remove | train | public function remove($name)
{
unset($this->_definitions[$name], $this->_instances[$name], $this->{$name});
return $this;
} | php | {
"resource": ""
} |
q5538 | Di.get | train | public function get($name, $parameters = null)
{
if (isset($this->_instances[$name])) {
return $this->_instances[$name];
}
if (isset($this->_definitions[$name])) {
$definition = $this->_definitions[$name];
} else {
return $this->getInstance($name,... | php | {
"resource": ""
} |
q5539 | Di.getShared | train | public function getShared($name)
{
if (isset($this->_instances[$name])) {
return $this->_instances[$name];
}
if (isset($this->_definitions[$name])) {
return $this->_instances[$name] = $this->getInstance($this->_definitions[$name], null, $name);
} elseif (strp... | php | {
"resource": ""
} |
q5540 | Timer.reset | train | function reset(){
$tmp = $this->milliseconds();
$this->started = microtime( false );
$this->stopped = null;
return $tmp;
} | php | {
"resource": ""
} |
q5541 | Timer.stop | train | function stop(){
if( $this->is_running() ){
$this->stopped = microtime( false );
return $this->milliseconds();
}
else{
trigger_error("Timer already stopped", E_USER_NOTICE);
return false;
}
} | php | {
"resource": ""
} |
q5542 | Timer.is_running | train | function is_running(){
if( isset( $this->stopped ) ){
return false;
}
if( ! isset( $this->started ) ){
trigger_error("Timer has been stopped some how (".gettype($this->started).")'$this->started'", E_USER_WARNING);
return false;
}
return true;
} | php | {
"resource": ""
} |
q5543 | Timer.milliseconds | train | function milliseconds( $dp = null ){
if( $this->is_running() ){
$now = microtime( false );
}
else {
$now = $this->stopped;
}
$started = self::parse_microtime( $this->started );
$stopped = self::parse_microtime( $now );
$ms = $stopped - $started;
if( ! is_null($dp) ){
$mult = pow( 10, $dp );
... | php | {
"resource": ""
} |
q5544 | Timer.seconds | train | function seconds( $dp = 2 ){
$secs = $this->milliseconds() / 1000;
if( ! is_null($dp) ){
$mult = pow( 10, $dp );
$secs = round( $mult * $secs ) / $mult;
}
return $secs;
} | php | {
"resource": ""
} |
q5545 | Timer.parse_microtime | train | static function parse_microtime( $microtime ){
list($usec, $sec) = explode( ' ', $microtime );
$ms1 = (float) $usec * 1000;
$ms2 = (float) $sec * 1000;
return $ms1 + $ms2;
} | php | {
"resource": ""
} |
q5546 | Doctrine2MetaDataDAO.getMetadataFor | train | public function getMetadataFor($entityName, array $parentName = array())
{
return $this->hydrateDataObject(
$this->entityManager->getMetadataFactory()->getMetadataFor($entityName),
$parentName
);
} | php | {
"resource": ""
} |
q5547 | PLUGCli.init | train | static function init() {
switch( PHP_SAPI ) {
// Ideally we want to be runnning as CLI
case 'cli':
break;
// Special conditions to ensure CGI runs as CLI
case 'cgi':
// Ensure resource constants are defined
if( ! defined('STDERR') ){
define( 'STDERR', fopen('php://stderr', 'w') );
}
if( ! ... | php | {
"resource": ""
} |
q5548 | PLUGCli.arg | train | final static function arg( $a, $default = null ){
if( is_int($a) ){
global $argv;
// note: arg(0) will always be the script path
return isset($argv[$a]) ? $argv[$a] : $default;
}
else {
return isset(self::$args[$a]) ? self::$args[$a] : $default;
}
} | php | {
"resource": ""
} |
q5549 | PLUGCli.stderr | train | final static function stderr( $s ){
if( func_num_args() > 1 ){
$args = func_get_args();
$s = call_user_func_array( 'sprintf', $args );
}
fwrite( STDERR, $s );
} | php | {
"resource": ""
} |
q5550 | PLUGCli.format_logline | train | static function format_logline( PLUGError $Err ){
if( PLUG::is_compiled() ){
return sprintf(
'%s: %s: %s',
basename(self::arg(0)),
$Err->getTypeString(),
$Err->getMessage()
);
}
else {
return sprintf(
'%s: %s: %s in %s#%u',
basename(self::arg(0)),
$Err->getTypeString(),
... | php | {
"resource": ""
} |
q5551 | GlideServer.getLeagueGlideServer | train | public function getLeagueGlideServer()
{
if (null === $this->server) {
$config = $this->config + [
'response' => new LaravelResponseFactory($this->app['request'])
];
$this->server = ServerFactory::create($config);
}
return $this->server;
... | php | {
"resource": ""
} |
q5552 | GlideServer.url | train | public function url($path, array $params = [])
{
$urlBuilder = UrlBuilderFactory::create($this->config['base_url'], $this->config['sign_key']);
return $urlBuilder->getUrl($path, $params);
} | php | {
"resource": ""
} |
q5553 | InvalidLength.rise | train | public function rise(array $params, $line, $filename)
{
$this->message = "The length of \"" . $params[0] . "\" is invalid! Must be " . $params[1] . " then " . $params[2] . ". File: " . $filename . " Line: " . $line;
return $this;
} | php | {
"resource": ""
} |
q5554 | Issue.buildLabels | train | private function buildLabels($labels)
{
$collection = [];
foreach ($labels as $label) {
$collection[] = Label::createFromData($label);
}
return $collection;
} | php | {
"resource": ""
} |
q5555 | Doctrine2MetaDataDAOFactory.getInstance | train | public static function getInstance()
{
$fileManager = new FileManager();
$serviceManager = ZendFramework2Environnement::getDependence($fileManager);
$entityManager = $serviceManager->get('doctrine.entitymanager.orm_default');
if (($entityManager instanceof EntityManager) === fal... | php | {
"resource": ""
} |
q5556 | Client.getUploadResult | train | public function getUploadResult($token)
{
$jwt = new Jwt();
$claims = $jwt->decode($token, false);
if (!isset($claims['scope'])) {
throw new AuthenticationException('scope is not exists');
}
if ($claims['scope'] !== 'bos.object.create.response') {
t... | php | {
"resource": ""
} |
q5557 | GridExporter.passCsv | train | public function passCsv()
{
$csv = fopen('php://output', 'w');
//nagłówek CSV
fputcsv($csv, $this->_getHeader());
//iteracja po danych
foreach ($this->_getData() as $data) {
//zapis linii CSV
fputcsv($csv, $data);
}
fclose($csv);
} | php | {
"resource": ""
} |
q5558 | GridExporter._getHeader | train | protected function _getHeader()
{
$header = [];
foreach ($this->_grid->getColumns() as $column) {
if ($column instanceof Column\IndexColumn || $column instanceof Column\OperationColumn) {
continue;
}
if ($column instanceof Column\CustomColumn && !$... | php | {
"resource": ""
} |
q5559 | ApplicationServiceIterator.accept | train | public function accept()
{
/* @var $serviceId string|object */
$serviceId = $this->current();
if (in_array($serviceId, $this->getIdsOfServicesThatAreDefinedInApplication())) {
return true;
}
if ($this->startsWithPrefix($serviceId, $this->getPrefixesOfApplicationSe... | php | {
"resource": ""
} |
q5560 | ApplicationServiceIterator.getIdsOfServicesThatAreDefinedInApplication | train | protected function getIdsOfServicesThatAreDefinedInApplication()
{
if ($this->serviceIdWhitelist === null) {
$builder = $this->createContainerBuilder();
$this->applyToExtensions(function (ExtensionInterface $extension) use ($builder) {
$extension->load($builder->getEx... | php | {
"resource": ""
} |
q5561 | ApplicationServiceIterator.getPrefixesOfApplicationServices | train | protected function getPrefixesOfApplicationServices()
{
if ($this->allowedServicePrefixes === null) {
$this->allowedServicePrefixes = $this->applyToExtensions(function (ExtensionInterface $extension) {
return $extension->getAlias() . '.';
});
}
return ... | php | {
"resource": ""
} |
q5562 | ApplicationServiceIterator.applyToExtensions | train | protected function applyToExtensions($callback)
{
$results = array();
foreach (new ApplicationBundleIterator($this->kernel) as $bundle) {
/* @var $bundle BundleInterface */
$extension = $bundle->getContainerExtension();
if ($extension !== null) {
$... | php | {
"resource": ""
} |
q5563 | ApplicationServiceIterator.startsWithPrefix | train | protected function startsWithPrefix($serviceId, $allowedPrefixes)
{
foreach ($allowedPrefixes as $prefix) {
/* @var $prefix string */
if (strpos($serviceId, $prefix) === 0) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q5564 | ApplicationServiceIterator.createContainerBuilder | train | protected function createContainerBuilder()
{
$builder = new ContainerBuilder();
$this->kernel->boot();
foreach ($this->kernel->getBundles() as $bundle) {
// Register all extensions, otherwise there might be config parts that cannot be processed.
$extension = $bundle-... | php | {
"resource": ""
} |
q5565 | PullRequest.getCommits | train | public function getCommits()
{
if ('' === ini_get('user_agent')) {
throw new UserAgentNotFoundException();
}
if (!ini_get('allow_url_fopen')) {
throw new AllowUrlFileOpenException();
}
$jsonResponse = $this->getFileContent($this->getCommitsUrl(), ini... | php | {
"resource": ""
} |
q5566 | PullRequest.getFileContent | train | private function getFileContent($url, $userAgent)
{
$opts = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: '. $userAgent
]
]
];
$context = stream_context_create($opts);
return f... | php | {
"resource": ""
} |
q5567 | Helper.downloadRemoteFile | train | static function downloadRemoteFile($url, $destinationFilename) {
if (!ini_get('allow_url_fopen')) {
throw new \Exception('allow_url_fopen is disable', 501);
}
$message = "File was not loaded";
if (function_exists('curl_init')) {
try {
$raw = file_get_contents($url);
... | php | {
"resource": ""
} |
q5568 | LRParseTable.lookup | train | function lookup( $state, $la ){
if( ! isset($this->table[$state][$la]) ){
return null;
}
else {
return $this->table[$state][$la];
}
} | php | {
"resource": ""
} |
q5569 | GridState._applyFilters | train | private function _applyFilters(\Mmi\Orm\Query $query)
{
//iteracja po filtrach
foreach ($this->getFilters() as $filter) {
//filtr nie jest prawidłowy
if (!($filter instanceof GridStateFilter)) {
throw new GridException('Invalid state filter object');
... | php | {
"resource": ""
} |
q5570 | GridState._applyOrder | train | private function _applyOrder(\Mmi\Orm\Query $query)
{
$orders = $this->getOrder();
//resetowanie domyślnego orderu jeśli podany
if (!empty($orders)) {
$query->resetOrder();
}
//iteracja po orderze
foreach ($orders as $order) {
//order nie jest ... | php | {
"resource": ""
} |
q5571 | File.isGoodFile | train | public function isGoodFile(Config $source) {
$info = pathinfo($this->path);
if (!isset($info['extension']) or (!in_array(strtolower($info['extension']), $source->extensions))) {
return false;
}
if (in_array(strtolower($info['extension']), $source->imageExtensions) and !$this->isImage()) {
return... | php | {
"resource": ""
} |
q5572 | File.isImage | train | public function isImage() {
try {
if (!function_exists('exif_imagetype') && !function_exists('Jodit\exif_imagetype')) {
function exif_imagetype($filename) {
if ((list(, , $type) = getimagesize($filename)) !== false) {
return $type;
}
return false;
}
}
return in_arra... | php | {
"resource": ""
} |
q5573 | DbController.listCommand | train | public function listCommand($services = [], $table_pattern = '')
{
foreach ($services ?: $this->_getDbServices() as $service) {
/** @var \ManaPHP\DbInterface $db */
$db = $this->_di->getShared($service);
$this->console->writeLn(['service: `:service`', 'service' => $servi... | php | {
"resource": ""
} |
q5574 | DbController.modelCommand | train | public function modelCommand($table, $service = '', $namespace = 'App\Models', $optimized = false)
{
if (strpos($namespace, '\\') === false) {
$namespace = 'App\\' . ucfirst($namespace) . '\\Models';
}
/** @var \ManaPHP\DbInterface $db */
if ($service) {
$db ... | php | {
"resource": ""
} |
q5575 | DbController.modelsCommand | train | public function modelsCommand($services = [], $table_pattern = '', $namespace = 'App\Models', $optimized = false)
{
if (strpos($namespace, '\\') === false) {
$namespace = 'App\\' . ucfirst($namespace) . '\\Models';
}
foreach ($services ?: $this->_getDbServices() as $service) {
... | php | {
"resource": ""
} |
q5576 | AnnotationDriver.isMetadataFullyLoaded | train | private function isMetadataFullyLoaded(array $metadata)
{
return $metadata[ClassMetadata::LOGIN_PROPERTY]
&& $metadata[ClassMetadata::PASSWORD_PROPERTY]
&& $metadata[ClassMetadata::API_KEY_PROPERTY]
&& $metadata[ClassMetadata::LAST_ACTION_PROPERTY];
} | php | {
"resource": ""
} |
q5577 | Navigation.decorateConfiguration | train | public function decorateConfiguration(\Mmi\Navigation\NavigationConfig $config)
{
$objectArray = (new CmsCategoryQuery)
->lang()
->andFieldStatus()->equals(\Cms\Orm\CmsCategoryRecord::STATUS_ACTIVE)
->orderAscParentId()
->orderAscOrder()
->find()
... | php | {
"resource": ""
} |
q5578 | Navigation._setNavigationElementFromRecord | train | protected function _setNavigationElementFromRecord(CmsCategoryRecord $record, \Mmi\Navigation\NavigationConfigElement $element)
{
$params = [];
parse_str($record->mvcParams, $params);
$params['uri'] = $record->customUri ? $record->customUri : $record->uri;
$config = $record->getConfi... | php | {
"resource": ""
} |
q5579 | Tube.render | train | public function render(array $options = array())
{
$url = $this->service->generateEmbedUrl($this);
$options = array_replace(array(
'width' => 560,
'height' => 315,
'frameborder' => 0,
'allowfullscreen' => ''
), $options);
$html = <<<HT... | php | {
"resource": ""
} |
q5580 | Cron.run | train | public static function run()
{
foreach (Orm\CmsCronQuery::active()->find() as $cron) {
if (!self::_getToExecute($cron)) {
continue;
}
$output = '';
try {
$start = microtime(true);
$output = \Mmi\Mvc\ActionHelper:... | php | {
"resource": ""
} |
q5581 | Cron._getToExecute | train | protected static function _getToExecute($record)
{
return self::_valueMatch(date('i'), $record->minute) &&
self::_valueMatch(date('H'), $record->hour) &&
self::_valueMatch(date('d'), $record->dayOfMonth) &&
self::_valueMatch(date('m'), $record->month) &&
self:... | php | {
"resource": ""
} |
q5582 | GroupController.indexAction | train | public function indexAction() {
$oid = new ObjectIdentity('class', 'FOM\UserBundle\Entity\Group');
$query = $this->getDoctrine()->getManager()->createQuery('SELECT g FROM FOMUserBundle:Group g');
$groups = $query->getResult();
$allowed_groups = array();
// ACL access check
... | php | {
"resource": ""
} |
q5583 | OracleMetaDataDAOFactory.getInstance | train | public static function getInstance(DriverConfig $config)
{
$pdoDriver = PdoDriverFactory::getInstance();
return new OracleMetaDataDAO(
$pdoDriver->getConnection($config)
);
} | php | {
"resource": ""
} |
q5584 | Config.getSource | train | public function getSource($sourceName = null) {
if ($sourceName === 'default') {
$sourceName = null;
}
foreach ($this->sources as $key => $item) {
if ((!$sourceName || $sourceName === $key)) {
return $item;
}
$source = $item !== $this ? $item->getSource($sourceName) : null;
if ($... | php | {
"resource": ""
} |
q5585 | SetupHelper.getRootFolder | train | public static function getRootFolder()
{
$filesystem = new Filesystem();
$folder = $filesystem->normalizePath(__DIR__ . '/../');
if (! is_dir($folder)) {
throw new RuntimeException(
sprintf(
'Could not find a matching folder for folder nam... | php | {
"resource": ""
} |
q5586 | SetupHelper.getFile | train | public static function getFile($fileName)
{
$filesystem = new Filesystem();
$file = $filesystem->normalizePath(__DIR__ . '/../' . $fileName);
if (! file_exists($file)) {
throw new RuntimeException(
sprintf(
'Could not find a matching fil... | php | {
"resource": ""
} |
q5587 | ServiceCreator.create | train | public function create($serviceId)
{
try {
return $this->container->get($serviceId, Container::NULL_ON_INVALID_REFERENCE);
} catch (\Exception $e) {
if ($this->isCausedBySyntheticServiceRequest($e)) {
// Ignore errors that are caused by synthetic services. It ... | php | {
"resource": ""
} |
q5588 | ServiceCreator.isCausedBySyntheticServiceRequest | train | protected function isCausedBySyntheticServiceRequest(\Exception $exception)
{
if (!($exception instanceof RuntimeException)) {
return false;
}
return strpos($exception->getMessage(), 'requested a synthetic service') !== false;
} | php | {
"resource": ""
} |
q5589 | Router._addRoute | train | protected function _addRoute($pattern, $paths = null, $method = null)
{
$route = new Route($pattern, $paths, $method);
if ($method !== 'REST' && strpos($pattern, '{') === false) {
$this->_simple_routes[$method][$pattern] = $route;
} else {
$this->_regex_routes[] = $ro... | php | {
"resource": ""
} |
q5590 | Router.add | train | public function add($pattern, $paths = null, $method = null)
{
return $this->_addRoute($pattern, $paths, $method);
} | php | {
"resource": ""
} |
q5591 | ApiKeyAuthenticator.authenticateToken | train | public function authenticateToken(TokenInterface $token, UserProviderInterface $userProvider, $providerKey)
{
$apiKey = $token->getCredentials();
$user = $this
->om
->getRepository($this->modelName)
->findOneBy(array($this->metadata->getPropertyName(ClassMetadata... | php | {
"resource": ""
} |
q5592 | ApiKeyAuthenticator.createToken | train | public function createToken(Request $request, $providerKey)
{
$apiKey = $request->headers->get($this->header);
if (!$apiKey) {
throw new BadCredentialsException('No ApiKey found in request!');
}
return new PreAuthenticatedToken(
'unauthorized',
$... | php | {
"resource": ""
} |
q5593 | ViewFactory.getInstance | train | public static function getInstance()
{
$classAwake = new ClassAwake();
$viewHelpers = $classAwake->wakeByInterfaces(
array(
__DIR__,
),
'CrudGenerator\View\ViewHelperFactoryInterface'
);
return new View(new ViewRenderer($viewHelpe... | php | {
"resource": ""
} |
q5594 | AttributeController.deleteAttributeRelationAction | train | public function deleteAttributeRelationAction()
{
//wyszukiwanie rekordu relacji
$record = (new \Cms\Orm\CmsAttributeRelationQuery)
->whereObjectId()->equals($this->id)
->findPk($this->relationId);
//jeśli znaleziono rekord
if ($record && $record->delete()) {
... | php | {
"resource": ""
} |
q5595 | Validator.verify | train | public function verify($data, array $callbacks = [], $cast = '')
{
if (empty($callbacks) === true) {
return $this->fields[$cast] = $data;
}
// Create a Closure
$isValid = function ($data) use ($callbacks, $cast) {
if (empty($cast) === false) {
... | php | {
"resource": ""
} |
q5596 | Validator.setLength | train | public function setLength(array $condition)
{
if (is_array($condition) === true) {
$this->{key($condition)} = (int) current($condition);
}
return $this;
} | php | {
"resource": ""
} |
q5597 | Validator.isNotNull | train | protected function isNotNull($value)
{
if (is_null($value) === true || empty($value) === true) {
throw new ExceptionFactory('DataType', [$value, 'string']);
}
return true;
} | php | {
"resource": ""
} |
q5598 | Validator.isAcceptLength | train | protected function isAcceptLength($value)
{
$value = strlen(utf8_decode($value));
if ($value < $this->min) {
throw new ExceptionFactory('InvalidLength', [$value, 'greater', $this->min]);
}
else if ($value > $this->max) {
throw new ExceptionFactory('InvalidLen... | php | {
"resource": ""
} |
q5599 | Validator.isExists | train | protected function isExists(array $value)
{
// validate fields by exist in tables
foreach ($value as $table => $fields) {
// load model metaData
if ($this->isModel($table) === true) {
$model = (new Manager())->load($table, new $table);
// ... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.