_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q256600
Hooks.set
test
public function set($name, $content) { if ($this->has($name)) { throw new LogicException(sprintf('A hook "%s" is already defined', $name)); } $path = $this->getPath($name); file_put_contents($path, $content); chmod($path, 0777); }
php
{ "resource": "" }
q256601
Hooks.remove
test
public function remove($name) { if (!$this->has($name)) { throw new LogicException(sprintf('The hook "%s" was not found', $name)); } unlink($this->getPath($name)); }
php
{ "resource": "" }
q256602
Log.countCommits
test
public function countCommits() { if (null !== $this->revisions && count($this->revisions)) { $output = $this->repository->run('rev-list', array_merge(array('--count'), $this->revisions->getAsTextArray(), array('--'), $this->paths)); } else { $output = $this->repository->run('...
php
{ "resource": "" }
q256603
Repository.getReferences
test
public function getReferences() { if (null === $this->referenceBag) { $this->referenceBag = new ReferenceBag($this); } return $this->referenceBag; }
php
{ "resource": "" }
q256604
Repository.getCommit
test
public function getCommit($hash) { if (!isset($this->objects[$hash])) { $this->objects[$hash] = new Commit($this, $hash); } return $this->objects[$hash]; }
php
{ "resource": "" }
q256605
Repository.getTree
test
public function getTree($hash) { if (!isset($this->objects[$hash])) { $this->objects[$hash] = new Tree($this, $hash); } return $this->objects[$hash]; }
php
{ "resource": "" }
q256606
Repository.getBlob
test
public function getBlob($hash) { if (!isset($this->objects[$hash])) { $this->objects[$hash] = new Blob($this, $hash); } return $this->objects[$hash]; }
php
{ "resource": "" }
q256607
Repository.getLog
test
public function getLog($revisions = null, $paths = null, $offset = null, $limit = null) { return new Log($this, $revisions, $paths, $offset, $limit); }
php
{ "resource": "" }
q256608
Repository.getSize
test
public function getSize() { $commandlineArguments = array('du', '-skc', $this->gitDir); $commandline = $this->normalizeCommandlineArguments($commandlineArguments); $process = new Process($commandline); $process->run(); if (!preg_match('/(\d+)\s+total$/', trim($process->getOu...
php
{ "resource": "" }
q256609
Repository.shell
test
public function shell($command, array $env = array()) { $argument = sprintf('%s \'%s\'', $command, $this->gitDir); $prefix = ''; foreach ($env as $name => $value) { $prefix .= sprintf('export %s=%s;', escapeshellarg($name), escapeshellarg($value)); } proc_open($...
php
{ "resource": "" }
q256610
Repository.getDescription
test
public function getDescription() { $file = $this->gitDir.'/description'; $exists = is_file($file); if (null !== $this->logger && true === $this->debug) { if (false === $exists) { $this->logger->debug(sprintf('no description file in repository ("%s")', $file)); ...
php
{ "resource": "" }
q256611
Repository.run
test
public function run($command, $args = array()) { $process = $this->getProcess($command, $args); if ($this->logger) { $this->logger->info(sprintf('run command: %s "%s" ', $command, implode(' ', $args))); $before = microtime(true); } $process->run(); ...
php
{ "resource": "" }
q256612
Repository.cloneTo
test
public function cloneTo($path, $bare = true, array $options = array()) { return Admin::cloneTo($path, $this->gitDir, $bare, $options); }
php
{ "resource": "" }
q256613
Commit.getParents
test
public function getParents() { $result = array(); foreach ($this->getData('parentHashes') as $parentHash) { $result[] = $this->repository->getCommit($parentHash); } return $result; }
php
{ "resource": "" }
q256614
Commit.getShortMessage
test
public function getShortMessage($length = 50, $preserve = false, $separator = '...') { $message = $this->getData('subjectMessage'); if (StringHelper::strlen($message) > $length) { if ($preserve && false !== ($breakpoint = StringHelper::strpos($message, ' ', $length))) { ...
php
{ "resource": "" }
q256615
Commit.getIncludingBranches
test
public function getIncludingBranches($local = true, $remote = true) { $arguments = array('--contains', $this->revision); if ($local && $remote) { $arguments[] = '-a'; } elseif (!$local && $remote) { $arguments[] = '-r'; } elseif (!$local && !$remote) { ...
php
{ "resource": "" }
q256616
Admin.init
test
public static function init($path, $bare = true, array $options = array()) { $process = static::getProcess('init', array_merge(array('-q'), $bare ? array('--bare') : array(), array($path)), $options); $process->run(); if (!$process->isSuccessFul()) { throw new RuntimeException(...
php
{ "resource": "" }
q256617
Admin.isValidRepository
test
public static function isValidRepository($url, array $options = array()) { $process = static::getProcess('ls-remote', array($url), $options); $process->run(); return $process->isSuccessFul(); }
php
{ "resource": "" }
q256618
Admin.cloneTo
test
public static function cloneTo($path, $url, $bare = true, array $options = array()) { $args = $bare ? array('--bare') : array(); return static::cloneRepository($path, $url, $args, $options); }
php
{ "resource": "" }
q256619
Admin.cloneBranchTo
test
public static function cloneBranchTo($path, $url, $branch, $bare = true, $options = array()) { $args = array('--branch', $branch); if ($bare) { $args[] = '--bare'; } return static::cloneRepository($path, $url, $args, $options); }
php
{ "resource": "" }
q256620
Admin.cloneRepository
test
public static function cloneRepository($path, $url, array $args = array(), array $options = array()) { $process = static::getProcess('clone', array_merge(array('-q'), $args, array($url, $path)), $options); $process->run(); if (!$process->isSuccessFul()) { throw new RuntimeExcep...
php
{ "resource": "" }
q256621
Blame.getGroupedLines
test
public function getGroupedLines() { $result = array(); $commit = null; $current = array(); foreach ($this->getLines() as $lineNumber => $line) { if ($commit !== $line->getCommit()) { if (count($current)) { $result[] = array($commit, $c...
php
{ "resource": "" }
q256622
Blame.getLines
test
public function getLines() { if (null !== $this->lines) { return $this->lines; } $args = array('-p'); if (null !== $this->lineRange) { $args[] = '-L'; $args[] = $this->lineRange; } $args[] = $this->revision->getRevision(); ...
php
{ "resource": "" }
q256623
ReferenceBag.get
test
public function get($fullname) { $this->initialize(); if (!isset($this->references[$fullname])) { throw new ReferenceNotFoundException($fullname); } return $this->references[$fullname]; }
php
{ "resource": "" }
q256624
ReferenceBag.getBranches
test
public function getBranches() { $this->initialize(); $result = array(); foreach ($this->references as $reference) { if ($reference instanceof Reference\Branch) { $result[] = $reference; } } return $result; }
php
{ "resource": "" }
q256625
ReferenceBag.getLocalBranches
test
public function getLocalBranches() { $result = array(); foreach ($this->getBranches() as $branch) { if ($branch->isLocal()) { $result[] = $branch; } } return $result; }
php
{ "resource": "" }
q256626
ReferenceBag.getRemoteBranches
test
public function getRemoteBranches() { $result = array(); foreach ($this->getBranches() as $branch) { if ($branch->isRemote()) { $result[] = $branch; } } return $result; }
php
{ "resource": "" }
q256627
Blob.getContent
test
public function getContent() { if (null === $this->content) { $this->content = $this->repository->run('cat-file', array('-p', $this->hash)); } return $this->content; }
php
{ "resource": "" }
q256628
Blob.getMimetype
test
public function getMimetype() { if (null === $this->mimetype) { $finfo = new \finfo(FILEINFO_MIME); $this->mimetype = $finfo->buffer($this->getContent()); } return $this->mimetype; }
php
{ "resource": "" }
q256629
Diff.toArray
test
public function toArray() { return array( 'rawDiff' => $this->rawDiff, 'files' => array_map( function (File $file) { return $file->toArray(); }, $this->files ), ); }
php
{ "resource": "" }
q256630
EmailParser.parse
test
public function parse($text) { $text = str_replace(array("\r\n", "\r"), "\n", $text); foreach ($this->quoteHeadersRegex as $regex) { if (preg_match($regex, $text, $matches)) { $text = str_replace($matches[1], str_replace("\n", ' ', $matches[1]), $text); } ...
php
{ "resource": "" }
q256631
GenericBuilder.writeFormatted
test
public function writeFormatted(QueryInterface $query) { if (null === $this->sqlFormatter) { $this->sqlFormatter = (new \ReflectionClass($this->sqlFormatterClass))->newInstance(); } return $this->sqlFormatter->format($this->write($query)); }
php
{ "resource": "" }
q256632
GenericBuilder.writeColumnName
test
public function writeColumnName(Column $column) { $name = $column->getName(); if ($name === Column::ALL) { return $this->writeColumnAll(); } return $name; }
php
{ "resource": "" }
q256633
SyntaxFactory.createColumns
test
public static function createColumns(array &$arguments, $table = null) { $createdColumns = []; foreach ($arguments as $index => $column) { if (!is_object($column)) { $newColumn = array($column); $column = self::createColumn($newColumn, $table); ...
php
{ "resource": "" }
q256634
SyntaxFactory.createColumn
test
public static function createColumn(array &$argument, $table = null) { $columnName = \array_values($argument); $columnName = $columnName[0]; $columnAlias = \array_keys($argument); $columnAlias = $columnAlias[0]; if (\is_numeric($columnAlias) || \strpos($columnName, '*') !==...
php
{ "resource": "" }
q256635
SyntaxFactory.createTable
test
public static function createTable($table) { $tableName = $table; if (\is_array($table)) { $tableName = \current($table); $tableAlias = \key($table); } $newTable = new Table($tableName); if (isset($tableAlias) && !is_numeric($tableAlias)) { ...
php
{ "resource": "" }
q256636
AbstractBaseQuery.getSql
test
public function getSql($formatted = false) { if ($formatted) { return $this->getBuilder()->writeFormatted($this); } return $this->getBuilder()->write($this); }
php
{ "resource": "" }
q256637
CacheableEloquent.bootCacheableEloquent
test
public static function bootCacheableEloquent(): void { static::updated(function (Model $cachedModel) { ! $cachedModel->isCacheClearEnabled() || $cachedModel::forgetCache(); }); static::created(function (Model $cachedModel) { ! $cachedModel->isCacheClearEnabled() || $...
php
{ "resource": "" }
q256638
CacheableEloquent.storeCacheKey
test
protected static function storeCacheKey(string $modelName, string $cacheKey): void { $keysFile = storage_path('framework/cache/data/rinvex.cacheable.json'); $cacheKeys = static::getCacheKeys($keysFile); if (! isset($cacheKeys[$modelName]) || ! in_array($cacheKey, $cacheKeys[$modelName])) { ...
php
{ "resource": "" }
q256639
CacheableEloquent.getCacheKeys
test
protected static function getCacheKeys($file): array { if (! file_exists($file)) { $dir = dirname($file); is_dir($dir) || mkdir($dir); file_put_contents($file, null); } return json_decode(file_get_contents($file), true) ?: []; }
php
{ "resource": "" }
q256640
CacheableEloquent.flushCacheKeys
test
protected static function flushCacheKeys(string $modelName): array { $flushedKeys = []; $keysFile = storage_path('framework/cache/data/rinvex.cacheable.json'); $cacheKeys = static::getCacheKeys($keysFile); if (isset($cacheKeys[$modelName])) { $flushedKeys = $cacheKeys[$m...
php
{ "resource": "" }
q256641
CacheableEloquent.forgetCache
test
public static function forgetCache() { static::fireCacheFlushEvent('cache.flushing'); // Flush cache tags if (method_exists(app('cache')->getStore(), 'tags')) { app('cache')->tags(static::class)->flush(); } else { // Flush cache keys, then forget actual cache...
php
{ "resource": "" }
q256642
CacheableEloquent.resetCacheConfig
test
public function resetCacheConfig() { ! $this->cacheDriver || $this->cacheDriver = null; ! $this->cacheLifetime || $this->cacheLifetime = -1; return $this; }
php
{ "resource": "" }
q256643
CacheableEloquent.generateCacheKey
test
protected function generateCacheKey($builder, array $columns): string { $query = $builder instanceof Builder ? $builder->getQuery() : $builder; $vars = [ 'aggregate' => $query->aggregate, 'columns' => $query->columns, 'distinct' => $query->distinct, 'f...
php
{ "resource": "" }
q256644
CacheableEloquent.cacheQuery
test
public function cacheQuery($builder, array $columns, Closure $closure) { $modelName = $this->getMorphClass(); $lifetime = $this->getCacheLifetime(); $cacheKey = $this->generateCacheKey($builder, $columns); // Switch cache driver on runtime if ($driver = $this->getCacheDriver...
php
{ "resource": "" }
q256645
ValidationUtils.validate
test
public static function validate( HppRequest $hppRequest ) { self::Initialise(); $violations = self::$validator->validate( $hppRequest ); if ( $violations->count() > 0 ) { $validationMessages = array(); foreach ( $violations as $violation ) { /* @var ConstraintViolationInterface $violation */ $va...
php
{ "resource": "" }
q256646
ValidationUtils.validateResponse
test
public static function validateResponse( HppResponse $hppResponse, $secret ) { self::Initialise(); if ( ! $hppResponse->isHashValid( $secret ) ) { self::$logger->error( "HppResponse contains an invalid security hash." ); throw new RealexValidationException( "HppResponse contains an invalid security hash", ar...
php
{ "resource": "" }
q256647
HppRequest.addAutoSettleFlag
test
public function addAutoSettleFlag( $autoSettleFlag ) { if ( is_bool( $autoSettleFlag ) ) { $this->autoSettleFlag = $autoSettleFlag ? Flag::TRUE : Flag::FALSE; } else { $this->autoSettleFlag = $autoSettleFlag; } return $this; }
php
{ "resource": "" }
q256648
HppRequest.addReturnTss
test
public function addReturnTss( $returnTss ) { if ( is_bool( $returnTss ) ) { $this->returnTss = $returnTss ? Flag::TRUE : Flag::FALSE; } else { $this->returnTss = $returnTss; } return $this; }
php
{ "resource": "" }
q256649
HppRequest.addValidateCardOnly
test
public function addValidateCardOnly( $validateCardOnly ) { if ( is_bool( $validateCardOnly ) ) { $this->validateCardOnly = $validateCardOnly ? Flag::TRUE : Flag::FALSE; } else { $this->validateCardOnly = $validateCardOnly; } return $this; }
php
{ "resource": "" }
q256650
HppRequest.addDccEnable
test
public function addDccEnable( $dccEnable ) { if ( is_bool( $dccEnable ) ) { $this->dccEnable = $dccEnable ? Flag::TRUE : Flag::FALSE; } else { $this->dccEnable = $dccEnable; } return $this; }
php
{ "resource": "" }
q256651
HppRequest.addCardStorageEnable
test
public function addCardStorageEnable( $cardStorageEnable ) { if ( is_bool( $cardStorageEnable ) ) { $this->cardStorageEnable = $cardStorageEnable ? Flag::TRUE : Flag::FALSE; } else { $this->cardStorageEnable = $cardStorageEnable; } return $this; }
php
{ "resource": "" }
q256652
HppRequest.addOfferSaveCard
test
public function addOfferSaveCard( $offerSaveCard ) { if ( is_bool( $offerSaveCard ) ) { $this->offerSaveCard = $offerSaveCard ? Flag::TRUE : Flag::FALSE; } else { $this->offerSaveCard = $offerSaveCard; } return $this; }
php
{ "resource": "" }
q256653
HppRequest.addPayerExists
test
public function addPayerExists( $payerExists ) { if ( is_bool( $payerExists ) ) { $this->payerExists = $payerExists ? Flag::TRUE : Flag::FALSE; } else { $this->payerExists = $payerExists; } return $this; }
php
{ "resource": "" }
q256654
HppRequest.addHppVersion
test
public function addHppVersion( $hppVersion ){ if ( is_bool( $hppVersion ) ) { $this->cardStorageEnable = $hppVersion ? Flag::TRUE : Flag::FALSE; } else { $this->hppVersion = $hppVersion; } return $this; }
php
{ "resource": "" }
q256655
HppRequest.generateDefaults
test
public function generateDefaults( $secret ) { //generate timestamp if not set if ( is_null( $this->timeStamp ) ) { $this->timeStamp = GenerationUtils::generateTimestamp(); } //generate order ID if not set if ( is_null( $this->orderId ) ) { $this->orderId = GenerationUtils::generateOrderId(); } //...
php
{ "resource": "" }
q256656
HppRequest.encode
test
public function encode( $charSet ) { $this->account = base64_encode( $this->account ); $this->amount = base64_encode( $this->amount ); $this->autoSettleFlag = base64_encode( $this->autoSettleFlag ); $this->billingCode = base64_encode( $this->billingCode ); $this->...
php
{ "resource": "" }
q256657
HppRequest.decode
test
public function decode( $charSet ) { $this->account = base64_decode( $this->account ); $this->amount = base64_decode( $this->amount ); $this->autoSettleFlag = base64_decode( $this->autoSettleFlag ); $this->billingCode = base64_decode( $this->billingCode ); $this->...
php
{ "resource": "" }
q256658
HppResponse.encode
test
public function encode( $charset ) { $this->merchantId = base64_encode( $this->merchantId ); $this->account = base64_encode( $this->account ); $this->amount = base64_encode( $this->amount ); $this->authCode = base64_encode( $this->authCode ); $this->batchId ...
php
{ "resource": "" }
q256659
HppResponse.decode
test
public function decode( $charset ) { $this->merchantId = base64_decode( $this->merchantId ); $this->account = base64_decode( $this->account ); $this->amount = base64_decode( $this->amount ); $this->authCode = base64_decode( $this->authCode ); $this->batchId ...
php
{ "resource": "" }
q256660
TypeValidationRule.getFieldConfigRules
test
private function getFieldConfigRules() { return [ 'name' => ['type' => TypeService::TYPE_STRING, 'required' => true], 'type' => ['type' => TypeService::TYPE_ANY, 'required' => true], 'args' => ['type' => TypeService::TYPE_ARRAY], ...
php
{ "resource": "" }
q256661
Processor.unpackDeferredResults
test
public static function unpackDeferredResults($result) { while ($result instanceof DeferredResult) { $result = $result->result; } if (is_array($result)) { foreach ($result as $key => $value) { $result[$key] = static::unpackDeferredResults($value); ...
php
{ "resource": "" }
q256662
Processor.deferredResolve
test
protected function deferredResolve($resolvedValue, FieldInterface $field, callable $callback) { if ($resolvedValue instanceof DeferredResolverInterface) { $deferredResult = new DeferredResult($resolvedValue, function ($resolvedValue) use ($field, $callback) { // Allow nested deferred...
php
{ "resource": "" }
q256663
ArrayConnection.cursorToKey
test
public static function cursorToKey($cursor) { if ($decoded = base64_decode($cursor)) { return substr($decoded, strlen(self::PREFIX)); } return null; }
php
{ "resource": "" }
q256664
ArrayConnection.cursorToOffsetWithDefault
test
public static function cursorToOffsetWithDefault($cursor, $default, $array = []) { if (!is_string($cursor)) { return $default; } $key = self::cursorToKey($cursor); if (empty($array)) { $offset = $key; } else { $offset = array_search($k...
php
{ "resource": "" }
q256665
Compiler.listNodeCompiler
test
public function listNodeCompiler(array &$theme): void { $this->checkNode($theme); $attr = $this->getNodeAttribute($theme); foreach ([ 'key', 'value', 'index', ] as $key) { null === $attr[$key] && $attr[$key] = '$'.$key; } ...
php
{ "resource": "" }
q256666
JsonRpcProtocol.createRequestData
test
public function createRequestData(array $payload, $method) { if (! is_string($method)) { throw new \InvalidArgumentException('The $method argument has to be null or of type string'); } // Every JSON RPC request has a unique ID so that the request and its response can be linked. ...
php
{ "resource": "" }
q256667
SentencesBag.getAllSentences
test
public function getAllSentences() { $splitTexts = $this->responseContent->splitted_texts; $sentences = []; foreach ($splitTexts as $splitText) { foreach ($splitText as $sentence) { $sentences[] = $sentence; } } return $sentences; ...
php
{ "resource": "" }
q256668
DeepLy.splitText
test
public function splitText($text, $from = self::LANG_AUTO) { $splitTextBag = $this->requestSplitText($text, $from); $sentences = $splitTextBag->getAllSentences(); return $sentences; }
php
{ "resource": "" }
q256669
DeepLy.detectLanguage
test
public function detectLanguage($text) { // Note: We always use English as the target language. If the source language is English as well, // DeepL automatically seems to set the target language to French so this is not a problem. $translationBag = $this->requestTranslation($text, self::LANG_...
php
{ "resource": "" }
q256670
DeepLy.getLangCodes
test
public function getLangCodes($withAuto = true) { if (! is_bool($withAuto)) { throw new \InvalidArgumentException('The $withAuto argument has to be boolean'); } if ($withAuto) { return self::LANG_CODES; } // ATTENTION! This only works as long as self:...
php
{ "resource": "" }
q256671
Table.getDefaults
test
public function getDefaults(array $overrides = null): array { if (empty($overrides)) { return $this->defaults; } $diff = array_diff_key($overrides, $this->fields); if (!empty($diff)) { throw new SimpleCrudException( sprintf('The field %s does...
php
{ "resource": "" }
q256672
Table.cache
test
public function cache(Row $row): Row { if ($row->id) { $this->cache[$row->id] = $row; } return $row; }
php
{ "resource": "" }
q256673
Table.getCached
test
public function getCached($id): ?Row { if (!$this->isCached($id)) { return null; } $row = $this->cache[$id]; if ($row && !$row->id) { return $this->cache[$id] = null; } return $row; }
php
{ "resource": "" }
q256674
Table.offsetExists
test
public function offsetExists($offset): bool { if ($this->isCached($offset)) { return $this->getCached($offset) !== null; } return $this->selectAggregate('COUNT') ->where('id = ', $offset) ->limit(1) ->run() === 1; }
php
{ "resource": "" }
q256675
Table.offsetGet
test
public function offsetGet($offset): ?Row { if ($this->isCached($offset)) { return $this->getCached($offset); } return $this->cache[$offset] = $this->select() ->one() ->where('id = ', $offset) ->run(); }
php
{ "resource": "" }
q256676
Table.offsetSet
test
public function offsetSet($offset, $value): Row { //Insert on missing offset if ($offset === null) { $value['id'] = null; return $this->create($value)->save(); } //Update if the element is cached and exists $row = $this->getCached($offset); ...
php
{ "resource": "" }
q256677
Table.offsetUnset
test
public function offsetUnset($offset) { $this->cache[$offset] = null; $this->delete() ->where('id = ', $offset) ->run(); }
php
{ "resource": "" }
q256678
Table.getJoinField
test
public function getJoinField(Table $table): ?Field { $field = $table->getForeignKey(); return $this->fields[$field] ?? null; }
php
{ "resource": "" }
q256679
RowCollection.delete
test
public function delete(): self { $ids = array_values($this->id); if (count($ids)) { $this->table->delete() ->where('id IN ', $ids) ->run(); $this->id = null; } return $this; }
php
{ "resource": "" }
q256680
FieldFactory.getClassName
test
private function getClassName(string $name, string $type): ?string { foreach ($this->fields as $className => $definition) { foreach ($definition['names'] as $defName) { if ($defName === $name || ($defName[0] === '/' && preg_match($defName, $name))) { return $c...
php
{ "resource": "" }
q256681
Database.setConfig
test
public function setConfig(string $name, $value): self { $this->config[$name] = $value; return $this; }
php
{ "resource": "" }
q256682
Database.getFieldFactory
test
public function getFieldFactory(): FieldFactory { if ($this->fieldFactory === null) { return $this->fieldFactory = new FieldFactory(); } return $this->fieldFactory; }
php
{ "resource": "" }
q256683
Database.execute
test
public function execute(string $query, array $marks = null): PDOStatement { $statement = $this->connection->prepare($query); $statement->execute($marks); return $statement; }
php
{ "resource": "" }
q256684
Database.executeTransaction
test
public function executeTransaction(callable $callable) { try { $transaction = $this->beginTransaction(); $return = $callable($this); if ($transaction) { $this->commit(); } } catch (Exception $exception) { if ($transaction)...
php
{ "resource": "" }
q256685
Database.beginTransaction
test
public function beginTransaction(): bool { if (!$this->inTransaction()) { $this->connection->beginTransaction(); return $this->inTransaction = true; } return false; }
php
{ "resource": "" }
q256686
Point.isValid
test
private static function isValid($data): bool { if (!is_array($data)) { return false; } if (!isset($data[0]) || !isset($data[1]) || count($data) > 2) { return false; } return is_numeric($data[0]) && is_numeric($data[1]); }
php
{ "resource": "" }
q256687
Row.__isset
test
public function __isset(string $name): bool { $valueName = $this->getValueName($name); return (isset($valueName) && !is_null($this->getValue($valueName))) || isset($this->data[$name]); }
php
{ "resource": "" }
q256688
Row.edit
test
public function edit(array $values): self { foreach ($values as $name => $value) { $this->__set($name, $value); } return $this; }
php
{ "resource": "" }
q256689
Row.delete
test
public function delete(): self { $id = $this->id; if (!empty($id)) { $this->table->delete() ->where('id = ', $id) ->run(); $this->values['id'] = null; } return $this; }
php
{ "resource": "" }
q256690
Row.relate
test
public function relate(Row ...$rows): self { $table1 = $this->table; foreach ($rows as $row) { $table2 = $row->getTable(); //Has one if ($field = $table1->getJoinField($table2)) { $this->{$field->getName()} = $row->id; continue; ...
php
{ "resource": "" }
q256691
Row.unrelate
test
public function unrelate(Row ...$rows): self { $table1 = $this->table; foreach ($rows as $row) { $table2 = $row->getTable(); //Has one if ($field = $table1->getJoinField($table2)) { $this->{$field->getName()} = null; continue; ...
php
{ "resource": "" }
q256692
Row.unrelateAll
test
public function unrelateAll(Table ...$tables): self { $table1 = $this->table; foreach ($tables as $table2) { //Has one if ($field = $table1->getJoinField($table2)) { $this->{$field->getName()} = null; continue; } //Has...
php
{ "resource": "" }
q256693
Row.select
test
public function select(Table $table): Select { //Has one if ($this->table->getJoinField($table)) { return $table->select()->one()->relatedWith($this); } return $table->select()->relatedWith($this); }
php
{ "resource": "" }
q256694
Row.getValueName
test
private function getValueName(string $name): ?string { if (array_key_exists($name, $this->values)) { return $name; } //It's a localizable field $language = $this->table->getDatabase()->getConfig(Database::CONFIG_LOCALE); if (!is_null($language)) { $n...
php
{ "resource": "" }
q256695
Quota.setLimits
test
public function setLimits($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\QuotaLimit::class); $this->limits = $arr; return $this; }
php
{ "resource": "" }
q256696
Quota.setMetricRules
test
public function setMetricRules($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\MetricRule::class); $this->metric_rules = $arr; return $this; }
php
{ "resource": "" }
q256697
Logging.setProducerDestinations
test
public function setProducerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); $this->producer_destinations = $arr; return $this; }
php
{ "resource": "" }
q256698
Logging.setConsumerDestinations
test
public function setConsumerDestinations($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Logging\LoggingDestination::class); $this->consumer_destinations = $arr; return $this; }
php
{ "resource": "" }
q256699
ConfigChange.setAdvices
test
public function setAdvices($var) { $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Api\Advice::class); $this->advices = $arr; return $this; }
php
{ "resource": "" }