_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239400 | PhpMd.ignorePatterns | train | public function ignorePatterns($ignorePatterns)
{
if (!is_array($ignorePatterns)) {
$ignorePatterns = [$ignorePatterns];
}
$this->ignorePatterns = array_unique(array_merge($this->ignorePatterns, $ignorePatterns));
return $this;
} | php | {
"resource": ""
} |
q239401 | ResourceServer.isValidRequest | train | public function isValidRequest($headerOnly = true, $accessToken = null)
{
$accessTokenString = ($accessToken !== null)
? $accessToken
: $this->determineAccessToken($headerOnly);
// Set the access token
$this->accessToken = $thi... | php | {
"resource": ""
} |
q239402 | ResourceServer.determineAccessToken | train | public function determineAccessToken($headerOnly = false)
{
if (!empty($this->getRequest()->headers->get('Authorization'))) {
$accessToken = $this->getTokenType()->determineAccessTokenInHeader($this->getRequest());
} elseif ($headerOnly === false && (! $this->getTokenType() instanceof MA... | php | {
"resource": ""
} |
q239403 | SynchronizeController.indexAction | train | public function indexAction()
{
$models = $this->getAllModels();
foreach($models as $model) {
$this->checkTable(new $model['namespace']);
}
} | php | {
"resource": ""
} |
q239404 | SynchronizeController.checkTable | train | private function checkTable($modelObj)
{
if (!method_exists($modelObj, 'table')) {
return false;
}
// get table name
$tableName = $modelObj->table();
// check table, add if not exist
$existTable = PdoDriver::getInstance()->tableExists($tableName);
... | php | {
"resource": ""
} |
q239405 | SynchronizeController.getAllModels | train | private function getAllModels()
{
$modules = Safan::handler()->getModules();
$modelClasses = [];
foreach ($modules as $moduleName => $modulePath) {
$modelsPath = APP_BASE_PATH . DS . $modulePath . DS . 'Models';
$modelFiles = [];
if (is_dir($models... | php | {
"resource": ""
} |
q239406 | ClauseTrait.quoteAlias | train | protected function quoteAlias($alias, array $settings)/*# : string */
{
if (is_int($alias)) {
return '';
} else {
$prefix = $settings['quotePrefix'];
$suffix = $settings['quoteSuffix'];
return ' AS ' . $this->quoteSpace($alias, $prefix, $suffix);
... | php | {
"resource": ""
} |
q239407 | ClauseTrait.& | train | protected function &getClause(/*# string */ $clauseName)/*# : array */
{
if (empty($clauseName)) {
return $this->clause;
} else {
if (!isset($this->clause[$clauseName])) {
$this->clause[$clauseName] = [];
}
return $this->clause[$clauseN... | php | {
"resource": ""
} |
q239408 | ClauseTrait.processValue | train | protected function processValue(
$value,
array $settings,
/*# bool */ $between = false
)/*# : string */ {
if (is_object($value)) {
return $this->quoteObject($value, $settings);
} elseif (is_array($value)) {
return $this->processArrayValue($value, $sett... | php | {
"resource": ""
} |
q239409 | ClauseTrait.processArrayValue | train | protected function processArrayValue(
array $value,
array $settings,
/*# bool */ $between = false
)/*# : string */ {
if ($between) {
$v1 = $this->processValue($value[0], $settings);
$v2 = $this->processValue($value[1], $settings);
return $v1 . ' AN... | php | {
"resource": ""
} |
q239410 | ClauseTrait.processScalarValue | train | protected function processScalarValue($value)/*# : string */
{
if (ClauseInterface::NO_VALUE == $value) {
return '?';
} elseif (is_null($value) || is_bool($value)) {
return strtoupper(var_export($value, true));
} else {
return $this->getBuilder()->getParam... | php | {
"resource": ""
} |
q239411 | ClauseTrait.joinClause | train | protected function joinClause(
/*# : string */ $prefix,
/*# : string */ $seperator,
array $clause,
array $settings
)/*# : string */ {
if (empty($clause)) {
return '';
} else {
$sepr = $settings['seperator'];
$join = $settings['join'... | php | {
"resource": ""
} |
q239412 | ClauseTrait.buildClause | train | protected function buildClause(
/*# string */ $clauseName,
/*# string */ $clausePrefix,
array $settings,
array $clauseParts = []
)/*# string */ {
$clause = &$this->getClause($clauseName);
foreach ($clause as $alias => $field) {
$part =
$thi... | php | {
"resource": ""
} |
q239413 | Deque.typed | train | public static function typed(string $type, iterable $input = []): Deque
{
$resolver = Resolver::typed($type);
return new static($input, $resolver);
} | php | {
"resource": ""
} |
q239414 | Html.link | train | public function link($target, $caption = null, $attributes = array())
{
// Check if target needs to be resolved
if (is_object($target)) {
// Try to get a link
$target = Url::instance()->show($target);
}
// Create element
$link = new \HtmlObject\Link($target, $caption, $attributes);
retur... | php | {
"resource": ""
} |
q239415 | Html.deleteLink | train | public function deleteLink($target, $caption = null, $confirmMessage = 'Are you sure?', $attributes = array())
{
// Check if target needs to be resolved
if (is_array($target) || is_object($target)) {
// Try to get a link
$target = Url::instance()->delete($target);
}
// Set method to delete
... | php | {
"resource": ""
} |
q239416 | Html.listingFor | train | public function listingFor($items, \Closure $callback, $attributes = array(), $element = 'ul', $childElement = 'li')
{
// Create the element
$list = \HtmlObject\Element::$element('', $attributes);
// Get closure info
$closureMethod = Reflection::getClosureMethod($callback);
$closureArgs = Reflection:... | php | {
"resource": ""
} |
q239417 | Html.listing | train | public function listing($contents = array(), $attributes = array(), $element = 'ul', $childElement = 'li')
{
// Create list
$list = \HtmlObject\Element::$element('', $attributes);
// Array?
if (!is_null($contents) && !is_array($contents)) {
$contents = array($contents);
}
// Loop contents
... | php | {
"resource": ""
} |
q239418 | Html.li | train | public function li($contents = '', $attributes = array())
{
$li = \HtmlObject\Element::li($contents, $attributes);
return $li;
} | php | {
"resource": ""
} |
q239419 | Session.start | train | public function start($name = null, $id = null)
{
if (!session_id()) {
if ($name) {
session_name($name);
}
if ($id) {
session_id($this->id);
}
session_start();
return true;
}
return false;... | php | {
"resource": ""
} |
q239420 | Session.destroy | train | public function destroy()
{
$_SESSION = [];
if ($this->cookieJar) {
$this->cookieJar->remove($this->name());
} else {
$params = session_get_cookie_params();
setcookie($this->name(), '', time() - 42000,
$params["path"], $params["dom... | php | {
"resource": ""
} |
q239421 | Group.getHtmlId | train | public function getHtmlId()
{
$form = $this->getParentOfType('\\Zepi\\Web\\UserInterface\\Form\\Form');
// If the group isn't assigned to a data form we can not generate
// the id of the group.
if (!$form) {
return $this->key;
}
return $form->get... | php | {
"resource": ""
} |
q239422 | AnnotationBuilderTrait.getFormFactory | train | public function getFormFactory()
{
if ($this->formFactory) {
return $this->formFactory;
}
$this->formFactory = new Factory();
return $this->formFactory;
} | php | {
"resource": ""
} |
q239423 | AnnotationBuilderTrait.createForm | train | public function createForm($entity)
{
$formSpec = ArrayUtils::iteratorToArray($this->getFormSpecification($entity));
if (!isset($formSpec['options']['merge_input_filter'])) {
$formSpec['options']['merge_input_filter'] = true;
}
return $this->getFormFactory()->createForm(... | php | {
"resource": ""
} |
q239424 | AnnotationBuilderTrait.configureElement | train | protected function configureElement($annotations, $reflection, $formSpec, $filterSpec)
{
// If the element is marked as exclude, return early
if ($this->checkForExclude($annotations)) {
return;
}
$events = $this->getEventManager();
$name = $this->discoverName($... | php | {
"resource": ""
} |
q239425 | Htsl.compile | train | public function compile( string$fromFile, string$toFile='' )
{
$fromFile= $this->getFilePath($fromFile);
$result= $this->execute(new FileBuffer($this,$fromFile));
if( $toFile ){
return file_put_contents($toFile,$result);
}else{
return $result;
}
} | php | {
"resource": ""
} |
q239426 | Htsl.setBasePath | train | public function setBasePath( string$basePath ):self
{
$this->basePath= '/'===substr($basePath,-1) ? substr($basePath,0,-1) : $basePath;
return $this;
} | php | {
"resource": ""
} |
q239427 | Htsl.getConfig | train | public function getConfig( string...$keys )
{
$result= $this->config;
foreach( $keys as $key ){
if( !isset($result[$key]) )
{ return null; }
$result= $result[$key];
}
return $result;
} | php | {
"resource": ""
} |
q239428 | Htsl.getFilePath | train | public function getFilePath( string$filePath, string$path=null ):string
{
if( !isset($this->basePath) )
{ throw new \Exception('BasePath musbe set.'); }
if( !strlen($filePath) )
{ throw new \Exception('FilePath cannot be empty.'); }
if( '/'===$filePath{0} ){
if( is_null($path) )
{ return $filePath... | php | {
"resource": ""
} |
q239429 | Htsl.getFileContent | train | public function getFileContent( string$filePath ):string
{
return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath);
} | php | {
"resource": ""
} |
q239430 | InputTypeResolverTrait.getInputFor | train | public static function getInputFor(\stdClass $fieldData)
{
$formData = explode(':', $fieldData->type->ui);
$type = $formData[0];
$options = isset($formData[1]) ? $formData[1] : '[]';
if ($type == 'text' ||
$type == 'number' ||
$type == 'textarea' ||
... | php | {
"resource": ""
} |
q239431 | Router.processMap | train | protected function processMap($arr, $prefix='') {
foreach ($arr as $uri => $options) {
$uri = $prefix . $this->preProcessURI($uri);
foreach ($options as $method => $target) {
if (!is_array($target)) continue;
if (array_... | php | {
"resource": ""
} |
q239432 | Router.preProcessURI | train | public function preProcessURI($uri) {
$s = preg_replace("/\{([\w]+)\}/", "[*:$1]", $uri);
if (!empty($s)) {
$uri = $s;
}
return $uri;
} | php | {
"resource": ""
} |
q239433 | Router.evaluate | train | public function evaluate($target) {
switch (Utils::get('type', $target)) {
case 'class' :
$return = $this->processClass(Utils::get('target',$target), Utils::get('match', $target));
break;
case 'controller' :
$... | php | {
"resource": ""
} |
q239434 | Router.resolve | train | public function resolve() {
$return = false;
$match = $this->match();
if (!$match) {
$target = $this->getDefaultRoute();
if ($target) {
$match = ['target' => $target];
}
}
if (substr(Ut... | php | {
"resource": ""
} |
q239435 | AdminController.assets | train | public function assets(Response $response, $asset)
{
$filesystem = new Filesystem(new Adapter(FS2ADMIN));
$expires = 8640000;
try {
// generate cache data
$timestamp_string = gmdate('D, d M Y H:i:s ', $filesystem->getTimestamp($asset)) . 'GMT';
$etag = md... | php | {
"resource": ""
} |
q239436 | QueueController.index | train | public function index()
{
try {
$jobs = FailedJob::orderBy('id', 'DESC')->paginate();
} catch (QueryException $e) {
return $this->setup();
}
return view('laravie/quemon::index', compact('jobs'));
} | php | {
"resource": ""
} |
q239437 | ArrayList.add | train | public function add($value) {
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
$this->_Arr = \array_merge($this->_Arr, \func_get_args());
return $this;
} | php | {
"resource": ""
} |
q239438 | ArrayList.average | train | public function average(){
Number::setScale(static::NUMERIC_FUNCTIONS_SCALE);
return Number::divide($this->sum(), \strval($this->count()));
} | php | {
"resource": ""
} |
q239439 | ArrayList.chunk | train | public function chunk($size){
$outer = new static();
$chunks = \array_chunk($this->_Arr, $size);
foreach($chunks as $chunk){
$outer->pushBack(new static($chunk));
}
return $outer;
} | php | {
"resource": ""
} |
q239440 | ArrayList.concat | train | public function concat(ICollection $coll){
$arr = array();
$coll->copyTo($arr);
return new static(\array_merge($this->_Arr, \array_values($arr)));
} | php | {
"resource": ""
} |
q239441 | ArrayList.copy | train | public function copy($deep = true){
$arr = array();
foreach($this->_Arr as $key => $item){
$arr[$key] = $deep
? Functions\Object::copy($item)
: $item;
}
return new static($arr);
} | php | {
"resource": ""
} |
q239442 | ArrayList.copyTo | train | public function copyTo(array &$arr, $index = 0) {
if(!$this->offsetExists($index)){
throw new \OutOfRangeException('$index is invalid');
}
$arr = \array_slice($this->_Arr, $index);
return $this;
} | php | {
"resource": ""
} |
q239443 | ArrayList.intersect | train | public function intersect(ICollection $coll){
//array_intersect does not work on \Closure objects
$arr = array();
$coll->copyTo($arr);
$ret = array();
foreach($this->_Arr as $outerItem){
foreach($arr as $innerItem){
if($innerItem === $outerItem){
$ret[] = $outerItem;
break;
... | php | {
"resource": ""
} |
q239444 | ArrayList.insert | train | public function insert($index, $value) {
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
//Permit 0-index insertion
if(!$this->offsetExists($index)){
throw new \OutOfRangeException('$index is invalid');
}
\array_splice($this->_Arr, $index, 0, array(... | php | {
"resource": ""
} |
q239445 | ArrayList.insertRange | train | public function insertRange($index, ICollection $coll){
if($this->_ReadOnly){
throw new \RuntimeException(\get_called_class() . ' is read only');
}
if(!$this->offsetExists($index)){
throw new \OutOfRangeException('$index is invalid');
}
$arr = array();
$coll->copyTo($arr);
\array_splice(... | php | {
"resource": ""
} |
q239446 | ArrayList.lastIndexOf | train | public function lastIndexOf($value){
$i = $this->count() - 1;
while($i >= 0 && $this->_Arr[$i] !== $value){
--$i;
}
return $i;
} | php | {
"resource": ""
} |
q239447 | ArrayList.max | train | public function max(){
if($this->isEmpty()){
throw new \UnderflowException(\get_called_class() . ' is empty');
}
$max = $this->front();
for($i = 1, $l = $this->count(); $i < $l; ++$i){
if(Number::greaterThan($this->_Arr[$i], $max)){
$max = $this->_Arr[$i];
}
}
return $max;
} | php | {
"resource": ""
} |
q239448 | ArrayList.min | train | public function min(){
if($this->isEmpty()){
throw new \UnderflowException(\get_called_class() . ' is empty');
}
$min = $this->front();
for($i = 1, $l = $this->count(); $i < $l; ++$i){
if(Number::lessThan($this->_Arr[$i], $min)){
$min = $this->_Arr[$i];
}
}
return $min;
} | php | {
"resource": ""
} |
q239449 | ArrayList.popBack | train | public function popBack(){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
if($this->isEmpty()){
throw new \UnderflowException(\get_called_class() . ' is empty');
}
return \array_pop($this->_Arr);
} | php | {
"resource": ""
} |
q239450 | ArrayList.popFront | train | public function popFront(){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
if($this->isEmpty()){
throw new \UnderflowException(\get_called_class() . ' is empty');
}
return \array_shift($this->_Arr);
} | php | {
"resource": ""
} |
q239451 | ArrayList.product | train | public function product(){
Number::setScale(static::NUMERIC_FUNCTIONS_SCALE);
$total = \strval($this->front());
for($i = 1, $l = $this->count(); $i < $l; ++$i){
$total = Number::multiply($total, \strval($this->_Arr[$i]));
}
return $total;
} | php | {
"resource": ""
} |
q239452 | ArrayList.pushBack | train | public function pushBack(){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
$this->_Arr = \array_merge($this->_Arr, \func_get_args());
return $this;
} | php | {
"resource": ""
} |
q239453 | ArrayList.pushFront | train | public function pushFront(){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
$this->_Arr = \array_merge(\func_get_args(), $this->_Arr);
return $this;
} | php | {
"resource": ""
} |
q239454 | ArrayList.& | train | public function &random(){
if($this->isEmpty()){
throw new \UnderflowException(\get_called_class() . ' is empty');
}
return $this->_Arr[\array_rand($this->_Arr, 1)];
} | php | {
"resource": ""
} |
q239455 | ArrayList.readOnly | train | public function readOnly($bool = true){
$list = $this->copy(false);
$list->setReadOnly();
return $list;
} | php | {
"resource": ""
} |
q239456 | ArrayList.remove | train | public function remove($value) {
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
if(($key = \array_search($value, $this->_Arr)) !== false){
\array_splice($this->_Arr, $key, 1);
}
return $this;
} | php | {
"resource": ""
} |
q239457 | ArrayList.removeAt | train | public function removeAt($index) {
if($this->_ReadOnly){
throw new \RuntimeException(\get_called_class() . ' is read only');
}
if(!$this->offsetExists($index)){
throw new \OutOfRangeException('$index is invalid');
}
\array_splice($this->_Arr, $index, 1);
return $this;
} | php | {
"resource": ""
} |
q239458 | ArrayList.resize | train | public function resize($size, $value = null){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
if(!\is_int($size)){
throw new \InvalidArgumentException('$size is not an int');
}
if($size < 0){
throw new \OutOfBoundsException('$size cannot be less th... | php | {
"resource": ""
} |
q239459 | ArrayList.reverse | train | public function reverse(){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
$this->_Arr = \array_reverse($this->_Arr);
return $this;
} | php | {
"resource": ""
} |
q239460 | ArrayList.sentinelSearch | train | public function sentinelSearch($value){
$l = $this->count();
$arr = $this->_Arr;
$arr[$l] = $value;
$i = 0;
while($arr[$i] !== $value){
++$i;
}
return $i !== $l ? $i : static::NO_INDEX;
} | php | {
"resource": ""
} |
q239461 | ArrayList.slice | train | public function slice($index, $count = null){
if(!$this->offsetExists($index)){
throw new \OutOfRangeException('$index is invalid');
}
$arr = \array_slice($this->_Arr, $index, $count);
return new static($arr);
} | php | {
"resource": ""
} |
q239462 | ArrayList.sort | train | public function sort(\Closure $compare = null){
if($this->_ReadOnly){
throw new ReadOnlyException(\get_called_class() . ' is read only');
}
if(\is_callable($compare)){
\usort($this->_Arr, $compare);
}
else{
\sort($this->_Arr);
}
return $this;
} | php | {
"resource": ""
} |
q239463 | ArrayList.sum | train | public function sum(){
Number::setScale(static::NUMERIC_FUNCTIONS_SCALE);
$total = '0';
foreach($this->_Arr as $item){
$total = Number::add($total, \strval($item));
}
return $total;
} | php | {
"resource": ""
} |
q239464 | ArrayList.stdDev | train | public function stdDev(){
Number::setScale(static::NUMERIC_FUNCTIONS_SCALE);
$mean = $this->average();
$squares = new static();
foreach($this->_Arr as $num){
$squares->add(Number::pow(Number::sub(\strval($num), $mean), '2'));
}
return Number::sqrt($squares->average());
} | php | {
"resource": ""
} |
q239465 | ArrayList.unique | train | public function unique(\Closure $compare = null){
if(\is_callable($compare)){
$arr = new static();
$this->each(function($outerItem) use (&$arr, $compare){
if(!$arr->some(function($cmpItem) use ($outerItem, $compare){
return $compare($outerItem, $cmpItem);
})){
$arr->_Arr[] = $o... | php | {
"resource": ""
} |
q239466 | MethodService.call | train | public function call(MethodArgumentDocument $methodArgument)
{
$serviceName = $methodArgument->getMethod()->getService()->getServiceName();
$service = $this->container->get($serviceName);
if (null === $service) {
throw new UndefinedServiceException(sprintf('"%s" is not a service'... | php | {
"resource": ""
} |
q239467 | SentryAuthenticationHelper.checkProfileEditPermission | train | public function checkProfileEditPermission($user_id) {
$current_user_id = App::make('sentry')->getUser()->id;
// edit his profile
if ($user_id == $current_user_id) {
return true;
}
// has special permission to edit other user profiles
$edit_perm = Config::get('authentication::permissions.... | php | {
"resource": ""
} |
q239468 | SentryAuthenticationHelper.getNotificationRegistrationUsersEmail | train | public function getNotificationRegistrationUsersEmail() {
$group_name = Config::get('authentication::permissions.profile_notification_group');
$user_r = App::make('user_repository');
$users = $user_r->findFromGroupName($group_name)->lists('email');
return $users;
} | php | {
"resource": ""
} |
q239469 | TemplatingModule.addTemplatingEngineClass | train | public function addTemplatingEngineClass(array &$globalConfig, string $templateEngineClass) {
$globalConfig[$this->getModuleKey()][self::CONFIG_ENGINES][] = $templateEngineClass;
} | php | {
"resource": ""
} |
q239470 | TemplatingModule.configureDependencyInjection | train | public function configureDependencyInjection(DependencyInjectionContainer $dic,
array $moduleConfig,
array $globalConfig) {
/**
* @var TemplateEngine[] $engines
*/
$engines = [];
if (empty($moduleConfig[self::CONFIG_ENGINES])) {
throw new ConfigurationException('The templating m... | php | {
"resource": ""
} |
q239471 | Serializer.serializeObject | train | private function serializeObject($object, string $className = null)
{
if (is_null($className)) {
$index = array_search($object, $this->references, true);
if ($index !== false) {
$this->referencesUsed[] = $index;
return ['@ref' => $index];
... | php | {
"resource": ""
} |
q239472 | Serializer.unserializeObject | train | private function unserializeObject($object, &$data, string $className = null) : array
{
$reflectionClass = new \ReflectionClass($className ? $className : $object);
unset($data['@type']);
// parent class
$parent = $reflectionClass->getParentClass();
if ($parent) {
... | php | {
"resource": ""
} |
q239473 | EarthIT_CMIPREST_ResultAssembler_JAOResultAssembler._q45 | train | protected function _q45( EarthIT_Schema_ResourceClass $rc, array $items ) {
$restObjects = array();
foreach( $items as $item ) {
$restObjects[] = $this->internalObjectToJao($rc, $item);
}
return $restObjects;
} | php | {
"resource": ""
} |
q239474 | ResourceFactory.newSimpleOutput | train | public function newSimpleOutput()
{
$config = $this->config->getCurrentResourceConfiguration();
return new SimpleOutput(
$this->newSerializer($config),
$this->newResource($config)
);
} | php | {
"resource": ""
} |
q239475 | ResourceFactory.newSlimOutput | train | public function newSlimOutput(Request $request, Response $response)
{
$config = $this->config->getCurrentResourceConfiguration();
return new SlimOutput(
$request,
$response,
$this->newSerializer($config),
$this->newResource($config)
);
} | php | {
"resource": ""
} |
q239476 | ResourceFactory.generateSlimRoutes | train | public function generateSlimRoutes(Slim $slim)
{
// if we are not on a resources's route, then dont generate any routes
if (!$this->config->getCurrentResourceConfiguration()) {
return;
}
$output = $this->newSlimOutput($slim->request, $slim->response);
$generator... | php | {
"resource": ""
} |
q239477 | ResourceFactory.resourceFor | train | public function resourceFor($resourceName)
{
$resourceConfig = $this->config->resourceConfigurationFor($resourceName);
return $this->newResource($resourceConfig);
} | php | {
"resource": ""
} |
q239478 | ResourceFactory.newRepository | train | protected function newRepository(ResourceConfiguration $config)
{
if ($this->database instanceof EntityManager) {
return $this->newDoctrineRepository($this->database, $config->getEntityClass(), $config->getParent());
} elseif ($this->database instanceof PDO) {
return $this->n... | php | {
"resource": ""
} |
q239479 | ResourceFactory.newSerializer | train | protected function newSerializer(ResourceConfiguration $config)
{
return new JMSSerializer(
SerializerBuilder::create()->build(),
new SerializationContext,
new JMSPropertyExcluder($config->getExcludedProperties())
);
} | php | {
"resource": ""
} |
q239480 | ResourceFactory.newResource | train | protected function newResource(ResourceConfiguration $config)
{
return new Resource(
$this->newRepository($config),
$this->newValidator($config),
$this->newSecurity(),
$this,
$config
);
} | php | {
"resource": ""
} |
q239481 | ResourceFactory.newValidator | train | protected function newValidator(ResourceConfiguration $config)
{
$class = $config->getValidatorClass();
return $config->isUsingYamlValidation() ?
new YamlResourceValidator($config->getYamlValidation()) : new $class();
} | php | {
"resource": ""
} |
q239482 | ResourceFactory.newSecurity | train | protected function newSecurity()
{
$config = $this->config->getCurrentResourceConfiguration();
return new Security(
new SimpleAuthenticationBouncer($config),
new SimpleRoleBouncer($config),
new ParentBouncer($config)
);
} | php | {
"resource": ""
} |
q239483 | HttpClient.callApi | train | public function callApi(Message $req, $method, $uri, $handler)
{
// check handler, php before 5.4 doesn't support Type Hinting of callable
if (!is_callable($handler)) {
throw new GeneralException("Can not find response handler.");
}
$data = [
'json' => (objec... | php | {
"resource": ""
} |
q239484 | AbstractRepository.diff | train | public function diff(Repository $otherRepository)
{
$diffRepository = new Memory();
foreach ($this->unitOfWorkStore as $unitOfWork) {
if (!$otherRepository->contains($unitOfWork)) {
$diffRepository->add($unitOfWork);
}
}
$diffRepository->sort... | php | {
"resource": ""
} |
q239485 | AbstractRepository.find | train | public function find(Uid $uniqueId)
{
if (!array_key_exists((string) $uniqueId, $this->unitOfWorkStore)) {
throw new UnitNotFoundException();
}
return $this->unitOfWorkStore[(string) $uniqueId];
} | php | {
"resource": ""
} |
q239486 | AbstractRepository.add | train | public function add(UnitOfWork $unitOfWork)
{
if ($this->contains($unitOfWork)) {
throw new UnitIsAlreadyPresentException();
}
$this->unitOfWorkStore[$unitOfWork->getUniqueId()] = $unitOfWork;
} | php | {
"resource": ""
} |
q239487 | AbstractRepository.replace | train | public function replace(UnitOfWork $unitOfWork)
{
if (!$this->contains($unitOfWork)) {
throw new UnitNotPresentException;
}
$this->unitOfWorkStore[$unitOfWork->getUniqueId()] = $unitOfWork;
} | php | {
"resource": ""
} |
q239488 | ProtectedMembersAccessor.getReflectionMethod | train | protected function getReflectionMethod($class, $method)
{
if (!isset($this->methodReflectors[$class])) {
$this->methodReflectors[$class] = [];
}
if (!isset($this->methodReflectors[$class][$method])) {
$this->methodReflectors[$class][$method] = new \ReflectionMethod($c... | php | {
"resource": ""
} |
q239489 | ProtectedMembersAccessor.getReflectionProperty | train | protected function getReflectionProperty($class, $property)
{
if (!isset($this->propertyReflectors[$class])) {
$this->propertyReflectors[$class] = [];
}
if (!isset($this->propertyReflectors[$class][$property])) {
$this->propertyReflectors[$class][$property] = new \Ref... | php | {
"resource": ""
} |
q239490 | ProtectedMembersAccessor.getProtectedMethod | train | public function getProtectedMethod(...$params)
{
if (is_string($params[0])) {
list($className, $object, $name) = $params;
} elseif (is_object($params[0])) {
list($object, $name) = $params;
$className = get_class($object);
}
/** @var string $classN... | php | {
"resource": ""
} |
q239491 | ProtectedMembersAccessor.getProtectedProperty | train | public function getProtectedProperty(...$params)
{
if (is_string($params[0])) {
list($className, $object, $name) = $params;
} elseif (is_object($params[0])) {
list($object, $name) = $params;
$className = get_class($object);
}
/** @var string $clas... | php | {
"resource": ""
} |
q239492 | ProtectedMembersAccessor.setProtectedProperty | train | public function setProtectedProperty(...$params)
{
if (is_string($params[0])) {
list($className, $object, $name, $value) = $params;
} elseif (is_object($params[0])) {
list($object, $name, $value) = $params;
$className = get_class($object);
}
/** @... | php | {
"resource": ""
} |
q239493 | VerifyCsrfToken.getTokenString | train | protected function getTokenString()
{
$result = Request::post('_token', '');
if ('' == $result) {
$result = Request::get('_token', '');
}
if ('' == $result) {
$result = isset($_SERVER['X-CSRF-TOKEN']) ? $_SERVER['X-CSRF-TOKEN'] : '';
}
return... | php | {
"resource": ""
} |
q239494 | ArrayUtils.removeKeysFromMultiArray | train | public static function removeKeysFromMultiArray(&$array, $keys)
{
foreach ($array as $key => &$value) {
if (is_array($value)) {
self::traverseArray($value, $keys);
} else {
if (in_array($key, $keys) || '' == $value) {
unset($array[$... | php | {
"resource": ""
} |
q239495 | ArrayUtils.listToMultiArray | train | public static function listToMultiArray($array)
{
$nested = [];
$depths = [];
foreach ($array as $key => $arr) {
if ($arr['depth'] == 0) {
$nested[$key] = $arr;
} else {
$parent =& $nested;
for ($i = 1; $i <= ($arr['d... | php | {
"resource": ""
} |
q239496 | UploaderS3.upload | train | public function upload($filePath, $contentType = 'text/plain')
{
$s3FileName = $this->getFilePathAndUniquePrefix() . basename($filePath);
list($bucket, $prefix) = explode('/', $this->s3path, 2);
$this->s3client->putObject([
'Bucket' => $bucket,
'Key' => (empty($prefi... | php | {
"resource": ""
} |
q239497 | UploaderS3.uploadString | train | public function uploadString($name, $content, $contentType = 'text/plain')
{
$s3FileName = $this->getFilePathAndUniquePrefix() . $name;
list($bucket, $prefix) = explode('/', $this->s3path, 2);
$this->s3client->putObject([
'Bucket' => $bucket,
'Key' => (empty($prefix)... | php | {
"resource": ""
} |
q239498 | Factory.create | train | public static function create(ProviderRepository $providerRepository = null)
{
$container = new Container(
$providerRepository
);
if (!$container->isProvided(AnnotationServiceProvider::class)) {
$container->addProvider(AnnotationServiceProvider::class);
}
... | php | {
"resource": ""
} |
q239499 | TCP.connecting | train | private function connecting() : void
{
$this->connected = false;
$this->closing
? $this->closed()->resolve()
: $this->client = Socket::connect($this->endpoint, $this->events)
;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.