_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q236500 | Mailer.sendTrackingCodeEmailMessage | train | public function sendTrackingCodeEmailMessage(Transaction $transaction)
{
$templateName = 'PaymentBundle:Email:trackingCode.html.twig';
$toEmail = $transaction->getActor()->getEmail();
$context = array(
'order_number' => $transaction->getTransactionKey(),
'tracking_c... | php | {
"resource": ""
} |
q236501 | PowerOnException.log | train | public function log( \Monolog\Logger $logger) {
$reflection = new \ReflectionClass($this);
$logger->error($this->getMessage(), [
'type' => $reflection->getShortName(),
'code' => $this->getCode(),
'line' => $this->getLine(),
'file' => $this->getFile()... | php | {
"resource": ""
} |
q236502 | SlibException.getMessageByCode | train | public function getMessageByCode(& $code, array $data = null)
{
// If we do not use a reference, then that defeats the purpose of
// making the $errorMap a static property.
$map = &static::getErrorMap();
// When you can't find the code, use a default one.
if (!\array_key_exi... | php | {
"resource": ""
} |
q236503 | ElementtypeStructure.getParentDsId | train | public function getParentDsId($dsId)
{
if (!array_key_exists($dsId, $this->parentMap)) {
throw new InvalidArgumentException('Unknown ds_id ', $dsId);
}
return $this->parentMap[$dsId];
} | php | {
"resource": ""
} |
q236504 | ElementtypeStructure.getParentNode | train | public function getParentNode($dsId)
{
$parentDsId = $this->getParentDsId($dsId);
if (null === $parentDsId) {
return null;
}
return $this->dsIdMap[$parentDsId];
} | php | {
"resource": ""
} |
q236505 | ElementtypeStructure.getChildrenDsIds | train | public function getChildrenDsIds($dsId, $level = 1)
{
$childrenDsIds = (array_key_exists($dsId, $this->childrenMap))
? $this->childrenMap[$dsId]
: [];
if (($level > 1) && count($childrenDsIds)) {
$subChildDsIds = [$childrenDsIds];
foreach ($childrenD... | php | {
"resource": ""
} |
q236506 | ElementtypeStructure.getChildNodes | train | public function getChildNodes($dsId, $level = 1)
{
$children = [];
$childrenDsIds = $this->getChildrenDsIds($dsId, $level);
foreach ($childrenDsIds as $childDsId) {
$children[] = $this->getNode($childDsId);
}
return $children;
} | php | {
"resource": ""
} |
q236507 | ElementtypeStructure.hasChildNodes | train | public function hasChildNodes($dsId = null)
{
if (!$dsId) {
// use root as default
$dsId = $this->rootDsId;
}
$childrenDsIds = $this->getChildrenDsIds($dsId);
$hasChildren = count($childrenDsIds) > 0;
return $hasChildren;
} | php | {
"resource": ""
} |
q236508 | ElementtypeStructure.getDsIdsByFieldType | train | public function getDsIdsByFieldType($fieldType)
{
$result = [];
foreach ($this->dsIdMap as $dsId => $node) {
/* @var $node ElementtypeStructureNode */
if ($fieldType === $node->getType()) {
$result[] = $dsId;
}
}
return $result;
... | php | {
"resource": ""
} |
q236509 | ElementtypeStructure.getNamesByFieldType | train | public function getNamesByFieldType($fieldType)
{
$result = [];
foreach ($this->dsIdMap as $node) {
/* @var $node ElementtypeStructureNode */
if ($fieldType === $node->getType()) {
$result[] = $node->getName();
}
}
return $result;
... | php | {
"resource": ""
} |
q236510 | PaymentServiceProviderController.indexAction | train | public function indexAction()
{
$em = $this->getDoctrine()->getManager();
$paymentServiceProviders = $em->getRepository('EcommerceBundle:PaymentServiceProvider')->findAll();
return array(
'paymentServiceProviders' => $paymentServiceProviders,
);
} | php | {
"resource": ""
} |
q236511 | PaymentServiceProviderController.newAction | train | public function newAction(Request $request)
{
$paymentServiceProvider = new PaymentServiceProvider();
$form = $this->createForm('EcommerceBundle\Form\PaymentServiceProviderType', $paymentServiceProvider);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) ... | php | {
"resource": ""
} |
q236512 | PaymentServiceProviderController.showAction | train | public function showAction(PaymentServiceProvider $paymentServiceProvider)
{
$deleteForm = $this->createDeleteForm($paymentServiceProvider);
return array(
'entity' => $paymentServiceProvider,
'delete_form' => $deleteForm->createView(),
);
} | php | {
"resource": ""
} |
q236513 | PaymentServiceProviderController.editAction | train | public function editAction(Request $request, PaymentServiceProvider $paymentServiceProvider)
{
$deleteForm = $this->createDeleteForm($paymentServiceProvider);
$editForm = $this->createForm('EcommerceBundle\Form\PaymentServiceProviderType', $paymentServiceProvider);
$editForm->handleRequest($... | php | {
"resource": ""
} |
q236514 | PaymentServiceProviderController.deleteAction | train | public function deleteAction(Request $request, PaymentServiceProvider $paymentServiceProvider)
{
$form = $this->createDeleteForm($paymentServiceProvider);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager();
... | php | {
"resource": ""
} |
q236515 | PaymentServiceProviderController.createDeleteForm | train | private function createDeleteForm(PaymentServiceProvider $paymentServiceProvider)
{
return $this->createFormBuilder()
->setAction($this->generateUrl('ecommerce_paymentserviceprovider_delete', array('id' => $paymentServiceProvider->getId())))
->setMethod('DELETE')
->getFor... | php | {
"resource": ""
} |
q236516 | Beautifier.parse | train | public function parse(string $template, array $values, ?Enviroment $enviroment = null): string
{
$parser = ParserFactory::factory($enviroment);
return $parser->parse($template, $values);
} | php | {
"resource": ""
} |
q236517 | Beautifier.dump | train | public function dump($value, ?Enviroment $enviroment = null): string
{
$format = FormatFactory::factory($value);
return $this->format($format, $enviroment);
} | php | {
"resource": ""
} |
q236518 | BBCodeManager.getBBCodes | train | public function getBBCodes($setId = 1)
{
$set = $this->getSet($setId);
$bbcodes = $set->getCodes();
return $bbcodes;
} | php | {
"resource": ""
} |
q236519 | Connection.pdo | train | public function pdo()
{
if (!empty($this->pdo)) {
return $this->pdo;
}
$dns = "{$this->driver}:";
if (!empty($this->database)) {
$dns .= "dbname={$this->database};";
}
if (!empty($this->hostname)) {
$dns .= "host={$this->hostname};... | php | {
"resource": ""
} |
q236520 | BaseRepository.getLastInsertID | train | public function getLastInsertID() {
if (count($this->rows) > 0) {
$end = end($this->rows);
if ($end->toRow() && $end->toRow()->getPrimary()) {
return (int) $end->toRow()->getPrimary();
} else if ($end->toRow() === NULL) {
return NULL;
} else {
throw new RepositoryException("Table \"" . self::T... | php | {
"resource": ""
} |
q236521 | BaseRepository.get | train | public function get($key) {
if (isset($this->rows[(int) $key])) {
return $this->rows[(int) $key];
} else {
/** @var ActiveRow|false $item */
$item = $this->buildSql()->get((int) $key);
if ($item) {
return $this->createEntity($item);
} else {
return NULL;
}
}
} | php | {
"resource": ""
} |
q236522 | BaseRepository.limit | train | public function limit($limit, $offset = NULL) {
if ($this->selection)
$this->selection->limit($limit, $offset);
else
throw new RepositoryException("Before using the function limit(...) call read(...).");
return $this;
} | php | {
"resource": ""
} |
q236523 | BaseRepository.fetchPairs | train | public function fetchPairs($key, $value = NULL) {
$return = array();
foreach ($this as $row) {
$return[$row->$key] = $value ? $row->$value : $row->$key;
}
return $return;
} | php | {
"resource": ""
} |
q236524 | BaseRepository.fetchAll | train | public function fetchAll() {
if ($this->selection) {
/** @var ActiveRow $entity */
foreach ($this->selection as $entity) {
$this->createEntity($entity);
}
}
return $this->rows;
} | php | {
"resource": ""
} |
q236525 | BaseRepository.hasNonSaveEntity | train | protected function hasNonSaveEntity() {
foreach($this->rows as $row) {
if ($row->toRow() === NULL) {
return TRUE;
} else {
$reflection = $row->getColumns();
$record = array();
foreach ($reflection as $property) {
$name = $property['name'];
if ($row->toRow()->$name != $row->$name) {
... | php | {
"resource": ""
} |
q236526 | BaseRepository.read | train | public function read(Paginator $paginator = NULL) {
if ($this->hasNonSaveEntity() === FALSE) {
$this->rows = array();
}
$this->selection = $this->buildSql($paginator);
return $this;
} | php | {
"resource": ""
} |
q236527 | BaseRepository.push | train | public function push(Entity $entity) {
$entity->setEntityManager($this->entityManager);
if ($entity->toRow()) {
$this->rows[$entity->getPrimary()] = $entity;
} else {
$this->rows[] = $entity;
}
} | php | {
"resource": ""
} |
q236528 | BaseRepository.updateActiveRow | train | private function updateActiveRow(Entity $entity) {
$reflection = $entity->getColumns();
$record = array();
foreach ($reflection as $property) {
$name = $property['name'];
if ($entity->toRow()->$name != $entity->$name) {
$record[$name] = $entity->$name;
}
}
if (count($record) > 0) {
$entity->to... | php | {
"resource": ""
} |
q236529 | BaseRepository.checkLoop | train | private function checkLoop(Entity $entity) {
foreach($this->protectLoop as $loop) {
if (EntityReflexion::getTable($loop) == EntityReflexion::getTable($entity) && $entity->getPrimary() == $loop->getPrimary()) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q236530 | ErrorHandler.toString | train | public static function toString($type)
{
if (! isset(self::$strings[$type])) {
return $type;
}
return self::$strings[$type];
} | php | {
"resource": ""
} |
q236531 | ErrorHandler.handle | train | public function handle($type, $message, $file, $line)
{
if (self::$catch & $type > 0) {
self::$error = $message;
return;
}
switch ($type) {
case E_USER_NOTICE:
case E_USER_DEPRECATED:
case E_USER_WARNING:
case E_USER_ERR... | php | {
"resource": ""
} |
q236532 | ErrorHandler.detect | train | public static function detect($callable, $mask = -1)
{
$error = null;
set_error_handler(function ($type, $message, $file, $line) use ($error) {
$error = new ErrorException($message, 0, $type, $file, $line);
}, $mask);
$callable();
restore_error_handler();
... | php | {
"resource": ""
} |
q236533 | ThemeAssets.registerAssets | train | protected function registerAssets()
{
do_action("before_theme_register_assets");
$assets = $this->getConfig("assets");
add_action("wp_enqueue_scripts", function () use ($assets) {
foreach ($assets as $id => $asset) :
$file = strpos($asset["file"], "//") === fals... | php | {
"resource": ""
} |
q236534 | UniModule.inform | train | public function inform($cmd, $params = [])
{
switch ($cmd) {
case 'label': // module's short name for menu
if (!empty($this->params['label'])) {
$label = $this->params['label'];
// try to translate label
$tcCat = TranslationsBuilder::getB... | php | {
"resource": ""
} |
q236535 | Image.getData | train | public function getData()
{
if (!$this->data && $this->getLocation()) {
$this->data = file_get_contents($this->getLocation());
}
return $this->data;
} | php | {
"resource": ""
} |
q236536 | Errors.delete | train | final public function delete($code) {
if ( array_key_exists($code, $this->rpc_errors) ) {
unset($this->rpc_errors[$code]);
$this->logger->debug("Deleted error $code");
return true;
} else {
$this->logger->warning("Cannot delete error $code: entry not... | php | {
"resource": ""
} |
q236537 | ClientV1.getLoginUrl | train | protected function getLoginUrl(string $redirect_url = '') {
if (empty($redirect_url)) {
$redirect_url = $this->getClientUrl();
}
return $this->getServerUrl() . self::LOGIN_PATH . '?redirect_url=' . $redirect_url;
} | php | {
"resource": ""
} |
q236538 | ClientV1.login | train | public function login(string $redirect_url = '') {
if ( null === $guid = $this->getGuidFromQuery() ) {
header( 'Location: ' . $this->getLoginUrl($redirect_url) );
exit();
} else {
return $this->verify($guid);
}
} | php | {
"resource": ""
} |
q236539 | ConfigureCacheListener.configureFactory | train | public function configureFactory(SystemEvent $event)
{
$systemConfig = $this->getConfig();
$initialConfig = $systemConfig->getInitialConfig();
if (isset($initialConfig['cache'])) {
$cacheConfig = (array) $initialConfig['cache'];
CacheFactory::setConfig($cacheConfig)... | php | {
"resource": ""
} |
q236540 | ConfigureCacheListener.configureNamespace | train | public function configureNamespace(SystemEvent $event)
{
$systemConfig = $this->getConfig();
$cache = $this->getCache();
if ($cache->get('hash') !== $systemConfig->getInitialConfigHash()) {
$cache->clearNamespace();
$cache->set('hash', $systemConfig->getInitialConfig... | php | {
"resource": ""
} |
q236541 | Model.findBySelector | train | public function findBySelector( $selector, $media = '', $rootId = null )
{
$rootId = ( (int) $rootId ) ?: null;
$rule = $this->getMapper()
->findBySelector( $selector, $media, $rootId );
if ( empty( $rule ) )
{
$rule = $this->getMapper()
... | php | {
"resource": ""
} |
q236542 | CommentController.indexAction | train | public function indexAction($postid)
{
$post = $this->getPost($postid);
$entities = $post->getComments()->toArray();
usort($entities, function (Comment $a, Comment $b) {
return $a->getDateCreated() < $b->getDateCreated();
});
return array(
'post' ... | php | {
"resource": ""
} |
q236543 | CommentController.newAction | train | public function newAction($postid)
{
$post = $this->getPost($postid);
$entity = new Comment();
$form = $this->createForm(new CommentType(), $entity);
return array(
'entity' => $entity,
'post' => $post,
'form' => $form->createView(),
... | php | {
"resource": ""
} |
q236544 | CommentController.createAction | train | public function createAction(Request $request, $postid)
{
$post = $this->getPost($postid);
$entity = new Comment();
$entity->setPost($post);
$entity->setAuthor($this->getCurrentAuthor());
$form = $this->createForm(new CommentType(), $entity);
$form->bind($request);... | php | {
"resource": ""
} |
q236545 | SearchController.Index | train | public function Index($Page = '') {
$this->AddJsFile('search.js');
$this->Title(T('Search'));
SaveToConfig('Garden.Format.EmbedSize', '160x90', FALSE);
Gdn_Theme::Section('SearchResults');
list($Offset, $Limit) = OffsetLimit($Page, C('Garden.Search.PerPage', 20));
$this->SetDat... | php | {
"resource": ""
} |
q236546 | iauFalp03.Falp03 | train | public static function Falp03($t) {
$a;
/* Mean anomaly of the Sun (IERS Conventions 2003). */
$a = fmod(1287104.793048 +
$t * ( 129596581.0481 +
$t * ( - 0.5532 +
$t * ( 0.000136 +
$t * ( - 0.00001149 ) ) ) ), TURNAS) * DAS2R;... | php | {
"resource": ""
} |
q236547 | GetTrait.choice | train | public function choice( array $keys, $default = false )
{
foreach( $keys as $key )
{
if( $this->offsetExists($key) )
{
return $this->items[$key];
}
}
return $default;
} | php | {
"resource": ""
} |
q236548 | iauPmpx.Pmpx | train | public static function Pmpx($rc, $dc, $pr, $pd, $px, $rv, $pmt, array $pob,
array &$pco) {
/* Km/s to au/year */
$VF = DAYSEC * DJM / DAU;
/* Light time for 1 au, Julian years */
$AULTY = AULT / DAYSEC / DJY;
$i;
$sr;
$cr;
$sd;
$cd;
$x;
$y;
$z;
$p = [];
... | php | {
"resource": ""
} |
q236549 | YamlFileLoader.parseImports | train | private function parseImports(array $content, $file)
{
if (!isset($content['imports'])) {
return;
}
if (!is_array($content['imports'])) {
throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file));
... | php | {
"resource": ""
} |
q236550 | YamlFileLoader.parseCallable | train | private function parseCallable($callable, $parameter, $id, $file)
{
if (is_string($callable)) {
if ('' !== $callable && '@' === $callable[0]) {
throw new InvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the ... | php | {
"resource": ""
} |
q236551 | Conversion.clearData | train | protected function clearData($table, $clearLinks = false)
{
if ($this->option('clear')) {
$this->db->statement('SET FOREIGN_KEY_CHECKS=0;');
$this->db->table($table)->truncate();
if ($clearLinks) {
$this->db->table('table_links')->where('new_table', $tab... | php | {
"resource": ""
} |
q236552 | Conversion.getProperty | train | protected function getProperty($object, $key)
{
if (isset($object->{$key}) &&
(
(is_int($object->{$key}) && $object->{$key} != 0) ||
(is_string($object->{$key}) && $object->{$key} != '')
)
) {
return $object->{$key};
}
... | php | {
"resource": ""
} |
q236553 | Conversion.getModifiedDate | train | protected function getModifiedDate($object)
{
if (! isset($object->modified)) {
return date('Y-m-d h:i:s');
}
return $object->modified === '0000-00-00 00:00:00'
? date('Y-m-d h:i:s')
: $object->modified;
} | php | {
"resource": ""
} |
q236554 | Conversion.findLink | train | protected function findLink($originalTable, $originalId)
{
$link = $this->db->table('table_links')
->where('original_table', $originalTable)
->where('original_id', $originalId)
->first();
if (is_null($link)) {
$t... | php | {
"resource": ""
} |
q236555 | CheckerCollectionFactory.make | train | public static function make(): CheckerCollection
{
$checkerCollection = new CheckerCollection();
do_action(self::REGISTER_HOOK, $checkerCollection);
do_action(self::BOOT_HOOK, $checkerCollection);
return $checkerCollection;
} | php | {
"resource": ""
} |
q236556 | Posting.updateAccountBalance | train | public function updateAccountBalance()
{
$this->getAccount()->setBalance($this->getAccount()->getBalance()+$this->getAmount());
$this->setBalanceAfterwards($this->getAccount()->getBalance());
} | php | {
"resource": ""
} |
q236557 | MAbstractDatastore.storeWebfilesFromStream | train | public function storeWebfilesFromStream(MWebfileStream $webfileStream)
{
if ($this->isReadOnly()) {
throw new MDatastoreException("cannot modify data on read-only datastore.");
}
$webfiles = $webfileStream->getWebfiles();
foreach ($webfiles as $webfile) {
... | php | {
"resource": ""
} |
q236558 | Identify.id | train | public function id() : string
{
$id = $this->name();
if ($this->prefix) {
$id = implode('-', $this->prefix)."-$id";
}
$id = preg_replace('/[\W]+/', '-', $id);
return trim(preg_replace('/[-]+/', '-', $id), '-');
} | php | {
"resource": ""
} |
q236559 | StringUtils.stringEndsWith | train | public static function stringEndsWith($haystack, $needle)
{
if (!is_string($haystack) || !is_string($needle)) {
throw new \InvalidArgumentException('Not a string');
}
return (strrpos($haystack, $needle) + strlen($needle)) === strlen($haystack);
} | php | {
"resource": ""
} |
q236560 | StringUtils.stringStartsWith | train | public static function stringStartsWith($haystack, $needle)
{
if (!is_string($haystack) || !is_string($needle)) {
throw new \InvalidArgumentException('Not a string');
}
return strpos($haystack, $needle) === 0;
} | php | {
"resource": ""
} |
q236561 | StringUtils.removePrefix | train | public static function removePrefix($haystack, $prefix)
{
if (!is_string($haystack) || !is_string($prefix)) {
throw new \InvalidArgumentException('Not a string');
}
if (strpos($haystack, $prefix) === 0) {
$haystack = substr($haystack, strlen($prefix));
}
... | php | {
"resource": ""
} |
q236562 | StringUtils.toUnderscore | train | public static function toUnderscore($string)
{
if (!is_string($string)) {
throw new \InvalidArgumentException('Not a string');
}
$transCoder = Transcoder::create('ASCII');
$string = $transCoder->transcode(trim($string));
$words = explode(' ', $string);
r... | php | {
"resource": ""
} |
q236563 | Assert.assertIntegerBetween | train | public static function assertIntegerBetween(int $min, int $max, int $value, string $name)
{
if ($value < $min || $value > $max) {
throw new InvalidArgumentException("Expecting {$name} to be between {$min} and {$max}, got {$value}");
}
} | php | {
"resource": ""
} |
q236564 | AbstractActionController.getClassNameWithoutNamespace | train | public function getClassNameWithoutNamespace()
{
if ($this->classNameWithoutNamespace === null) {
$class = explode('\\', get_class($this));
$this->classNameWithoutNamespace = substr(end($class), 0, -10);
}
return $this->classNameWithoutNamespace;
} | php | {
"resource": ""
} |
q236565 | AbstractActionController.getRouteIdentifierPrefix | train | public function getRouteIdentifierPrefix()
{
if ($this->routeIdentifierPrefix === null) {
$this->routeIdentifierPrefix = strtolower($this->getModuleNamespace() . '/' . $this->getClassNameWithoutNamespace());
}
return $this->routeIdentifierPrefix;
} | php | {
"resource": ""
} |
q236566 | Collector.checkDuplication | train | protected function checkDuplication(
RouteInterface $route,
/*# string */ $routeKey,
/*# string */ $method
) {
if (isset($this->routes[$routeKey][$method])) {
throw new LogicException(
Message::get(
Message::RTE_ROUTE_DUPLICATED,
... | php | {
"resource": ""
} |
q236567 | ObservableTrait.notify | train | protected function notify(ObservationContainerInterface $container): ? ObservationContainerInterface
{
foreach ( $this->observers as $current ) {
$current->update($container);
}
return $container;
} | php | {
"resource": ""
} |
q236568 | RouteServiceProvider.mapWebRoutes | train | protected function mapWebRoutes()
{
Route::group([
'middleware' => config($this->package.'.web_routes_middleware') ?: 'web',
'namespace' => $this->namespace,
'prefix' => $this->prefix,
], function ($router) {
require __DIR__.'/../Routes/web.php';
... | php | {
"resource": ""
} |
q236569 | AbstractValidator.validate | train | public function validate($context = 'default', array $data = [])
{
if (!empty($data)) {
$this->setData($data);
}
$this->setContext($context);
$rules = $this->buildRulesArray();
$validator = $this->factory->make($this->filterArray($rules, $this->data), $rules);
... | php | {
"resource": ""
} |
q236570 | AbstractValidator.buildRulesArray | train | protected function buildRulesArray()
{
if (method_exists($this, $this->context)) {
$rules = $this->{$this->context}();
} elseif (isset($this->rules[$this->context])) {
$rules = $this->rules[$this->context];
} else {
throw new InvalidArgumentException("Unde... | php | {
"resource": ""
} |
q236571 | AbstractValidator.filterArray | train | protected function filterArray($rules, $rawAttributes)
{
$attributes = [];
foreach (array_keys($rules) as $filedName) {
$value = array_get($rawAttributes, $filedName, 'not found in array'); // Default value !== null
if ($value !== 'not found in array') { // Only if field spec... | php | {
"resource": ""
} |
q236572 | RequestHandlerDecorator.handleRequest | train | public function handleRequest(SS_HTTPRequest $request, DataModel $model) {
return $this->original()->handleRequest($request, $model);
} | php | {
"resource": ""
} |
q236573 | Database.getSlaveOkay | train | public function getSlaveOkay()
{
if (version_compare(phpversion('mongo'), '1.3.0', '<')) {
return $this->riak->getSlaveOkay();
}
$readPref = $this->getReadPreference();
return \RiakClient::RP_PRIMARY !== $readPref['type'];
} | php | {
"resource": ""
} |
q236574 | Database.setSlaveOkay | train | public function setSlaveOkay($ok = true)
{
if (version_compare(phpversion('mongo'), '1.3.0', '<')) {
return $this->riak->setSlaveOkay($ok);
}
$prevSlaveOkay = $this->getSlaveOkay();
if ($ok) {
// Preserve existing tags for non-primary read preferences
... | php | {
"resource": ""
} |
q236575 | LineageQuery.filterByAncestorId | train | public function filterByAncestorId($ancestorId = null, $comparison = null)
{
if (is_array($ancestorId)) {
$useMinMax = false;
if (isset($ancestorId['min'])) {
$this->addUsingAlias(LineageTableMap::COL_ANCESTOR_ID, $ancestorId['min'], Criteria::GREATER_EQUAL);
... | php | {
"resource": ""
} |
q236576 | LineageQuery.useAncestorQuery | train | public function useAncestorQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinAncestor($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Ancestor', '\gossi\trixionary\model\SkillQuery');
} | php | {
"resource": ""
} |
q236577 | TreeNode.buildTreeAndGetRoots | train | public static function buildTreeAndGetRoots(array $objects)
{
$nodeClass = get_called_class(); // Use late static binding so new nodes are created as the calling subclass.
// Build a TreeNode for each object.
$nodes = array();
foreach ($objects as $object) {
$nodes[] = n... | php | {
"resource": ""
} |
q236578 | AssetExtension.getAssetUrl | train | public function getAssetUrl($path)
{
if (false !== strpos($path, '://') || 0 === strpos($path, '//')) {
return $path;
}
if (!$this->container->has('request')) {
return $path;
}
if ('/' !== substr($path, 0, 1)) {
$path = '/' . $path;
... | php | {
"resource": ""
} |
q236579 | Base64UrlSafe.encode | train | public static function encode($data, $pad = null) {
$str = str_replace(array('+', '/'), array('-', '_'), base64_encode($data));
if (!$pad) {
$str = rtrim($str, '=');
}
return $str;
} | php | {
"resource": ""
} |
q236580 | Zend_Gdata_YouTube_ActivityEntry.getActivityType | train | public function getActivityType()
{
$categories = $this->getCategory();
foreach($categories as $category) {
if ($category->getScheme() == self::ACTIVITY_CATEGORY_SCHEME) {
return $category->getTerm();
}
}
return null;
} | php | {
"resource": ""
} |
q236581 | Bootstrap._callControllerMethod | train | protected function _callControllerMethod() {
// Make sure the controller we are calling exists
if (!isset($this->_controller) || !is_object($this->_controller)) {
$this->_error("Controller does not exist: " . $this->_url_controller);
return false;
}
// Make sure... | php | {
"resource": ""
} |
q236582 | SchemaContainer.getSchemaByType | train | public function getSchemaByType($modelClass)
{
if (array_key_exists($modelClass, $this->schemaInstances) === true) {
return $this->schemaInstances[$modelClass];
}
if ($this->hasSchemaForModelClass($modelClass) === false) {
throw new InvalidArgumentException("Schema w... | php | {
"resource": ""
} |
q236583 | Getters.& | train | public function & HasValidator ($validatorNameOrInstance) {
if (is_string($validatorNameOrInstance)) {
$validatorClassName = $validatorNameOrInstance;
} else if ($validatorNameOrInstance instanceof \MvcCore\Ext\Forms\IValidator) {
$validatorClassName = get_class($validatorNameOrInstance);
} else {
return... | php | {
"resource": ""
} |
q236584 | PHP_ParserGenerator_ActionTable.acttab_action | train | function acttab_action($lookahead, $action)
{
if ($this->nLookahead === 0) {
$this->aLookahead = array();
$this->mxLookahead = $lookahead;
$this->mnLookahead = $lookahead;
$this->mnAction = $action;
} else {
if ($this->mxLookahead < $lookah... | php | {
"resource": ""
} |
q236585 | MImage.scaled | train | public function scaled( $width, $height, $aspectRatioMode = AspectRatioMode::IGNORE_ASPECT_RATIO )
{
switch( $aspectRatioMode )
{
case AspectRatioMode::IGNORE_ASPECT_RATIO:
break;
case AspectRatioMode::KEEP_ASPECT_RATIO:
$height = ($width * $th... | php | {
"resource": ""
} |
q236586 | MImage.valid | train | public function valid( $x, $y )
{
return ($x > 0 && $x < $this->getWidth() && $y > 0 && $y < $this->getHeight());
} | php | {
"resource": ""
} |
q236587 | AtomicFileWriter.rollbackOpeningFile | train | private function rollbackOpeningFile($temp_file = null)
{
flock($this->getFile(), LOCK_UN);
fclose($this->getFile());
if(is_resource($temp_file))
{
fclose($temp_file);
unlink($this->getTempFilePath());
}
} | php | {
"resource": ""
} |
q236588 | UclassifyReader.classifierExists | train | private function classifierExists($classifier)
{
if (strpos($classifier, '/') !== false) {
$classifierArray = array_map('strtolower', explode('/', $classifier));
$testArray = array_change_key_case($this->classifiers);
// Remap classifiers list to lowercase before validat... | php | {
"resource": ""
} |
q236589 | Kodoc.classes | train | public static function classes(array $list = null) {
if ($list === null) {
$list = Kohana::list_files('classes');
}
$namespaces = Kohana::$config->load('userguide.namespaces');
Debug::stop($namespaces);
$namespaces = \Arr::map(function ($names... | php | {
"resource": ""
} |
q236590 | Item.getIncluded | train | public function getIncluded()
{
$data = [];
$include_params = $this->getIncludeParams();
if (!$include_params) {
return $include_params;
}
foreach ($include_params->getData() as $key => $params) {
$method = 'include' . ucfirst($key);
$tra... | php | {
"resource": ""
} |
q236591 | Model.getColumns | train | private function getColumns()
{
$columns = array();
/**
* Use call_user_func to make sure only public vars are returned
*/
$vars = call_user_func('get_object_vars', $this);
foreach ( $vars as $key => $value )
{
$colum... | php | {
"resource": ""
} |
q236592 | Model.getAttributes | train | private function getAttributes()
{
$attributes = array();
foreach ( $this->_columns as $column )
{
$attributes[$column["name"]] = $this->{$column["name"]};
}
return $attributes;
} | php | {
"resource": ""
} |
q236593 | Model.createModel | train | private static function createModel( $row )
{
$table_name = get_called_class();
$model = new $table_name();
$model->setExists( true );
foreach ( $row as $key => $value )
{
if ( !is_int($key) )
{
$m... | php | {
"resource": ""
} |
q236594 | Model.findFirst | train | public static function findFirst( $sub_sql = null, $params = null )
{
$params["find_first"] = true;
return self::find( $sub_sql, $params );
} | php | {
"resource": ""
} |
q236595 | Model.save | train | public function save()
{
$di = DI::getDefault();
$database = $di->getService( "database" );
/**
* Decide if we should update or insert
* (if we know the record exists in the database...)
*/
if ( $this->_exists_in_db )
{
/**... | php | {
"resource": ""
} |
q236596 | GeneratorService.setRenderersConfig | train | public function setRenderersConfig(array $renderers)
{
foreach ($renderers as $name => $class) {
$renderer = new $class;
if (!$renderer instanceof RendererInterface) {
throw new GeneratorServiceException(
'Configured class of renderer must implemen... | php | {
"resource": ""
} |
q236597 | GeneratorService.setDocumentTypesConfig | train | public function setDocumentTypesConfig(array $documentTypes)
{
foreach ($documentTypes as $name => $class) {
$documentType = new $class;
if (!$documentType instanceof AbstractDocumentType) {
throw new GeneratorServiceException(
'Configured class of... | php | {
"resource": ""
} |
q236598 | ObjectQuery.filterByFixed | train | public function filterByFixed($fixed = null, $comparison = null)
{
if (is_string($fixed)) {
$fixed = in_array(strtolower($fixed), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(ObjectTableMap::COL_FIXED, $fixed, $comparison);
} | php | {
"resource": ""
} |
q236599 | ObjectQuery.filterBySportId | train | public function filterBySportId($sportId = null, $comparison = null)
{
if (is_array($sportId)) {
$useMinMax = false;
if (isset($sportId['min'])) {
$this->addUsingAlias(ObjectTableMap::COL_SPORT_ID, $sportId['min'], Criteria::GREATER_EQUAL);
$useMinMax ... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.