_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q13600
CacheableRepository.serializeCriteria
train
protected function serializeCriteria() { try { return serialize($this->getCriteria()); } catch (Exception $e) { return serialize($this->getCriteria()->map(function ($criterion) { return $this->serializeCriterion($criterion); })); } }
php
{ "resource": "" }
q13601
CacheableRepository.serializeCriterion
train
protected function serializeCriterion($criterion) { try { serialize($criterion); return $criterion; } catch (Exception $e) { // We want to take care of the closure serialization errors, // other than that we will simply re-throw the exception. if ($e->getMessage() !== "Serialization of 'Closure' is not allowed") { throw $e; } $r = new ReflectionObject($criterion); return [ 'hash' => md5((string) $r), 'properties' => $r->getProperties(), ]; } }
php
{ "resource": "" }
q13602
ComparesVersionsTrait.versionCompare
train
public function versionCompare($frameworkVersion, $compareVersion, $operator = null) { // Lumen (5.5.2) (Laravel Components 5.5.*) $lumenPattern = '/Lumen \((\d\.\d\.[\d|\*])\)( \(Laravel Components (\d\.\d\.[\d|\*])\))?/'; if (preg_match($lumenPattern, $frameworkVersion, $matches)) { $frameworkVersion = isset($matches[3]) ? $matches[3] : $matches[1]; // Prefer Laravel Components version. } return version_compare($frameworkVersion, $compareVersion, $operator); }
php
{ "resource": "" }
q13603
ValidatorGenerator.getRules
train
public function getRules() { if (!$this->rules) { return '[]'; } $results = '[' . PHP_EOL; foreach ($this->getSchemaParser()->toArray() as $column => $value) { $results .= "\t\t'{$column}'\t=>'\t{$value}'," . PHP_EOL; } return $results . "\t" . ']'; }
php
{ "resource": "" }
q13604
ControllerGenerator.getValidator
train
public function getValidator() { $validatorGenerator = new ValidatorGenerator([ 'name' => $this->name, ]); $validator = $validatorGenerator->getRootNamespace() . '\\' . $validatorGenerator->getName(); return 'use ' . str_replace([ "\\", '/' ], '\\', $validator) . 'Validator;'; }
php
{ "resource": "" }
q13605
ControllerGenerator.getRepository
train
public function getRepository() { $repositoryGenerator = new RepositoryInterfaceGenerator([ 'name' => $this->name, ]); $repository = $repositoryGenerator->getRootNamespace() . '\\' . $repositoryGenerator->getName(); return 'use ' . str_replace([ "\\", '/' ], '\\', $repository) . 'Repository;'; }
php
{ "resource": "" }
q13606
BindingsGenerator.getEloquentRepository
train
public function getEloquentRepository() { $repositoryGenerator = new RepositoryEloquentGenerator([ 'name' => $this->name, ]); $repository = $repositoryGenerator->getRootNamespace() . '\\' . $repositoryGenerator->getName(); return str_replace([ "\\", '/' ], '\\', $repository) . 'RepositoryEloquent'; }
php
{ "resource": "" }
q13607
BaseRepository.validator
train
public function validator() { if (isset($this->rules) && !is_null($this->rules) && is_array($this->rules) && !empty($this->rules)) { if (class_exists('Prettus\Validator\LaravelValidator')) { $validator = app('Prettus\Validator\LaravelValidator'); if ($validator instanceof ValidatorInterface) { $validator->setRules($this->rules); return $validator; } } else { throw new Exception(trans('repository::packages.prettus_laravel_validation_required')); } } return null; }
php
{ "resource": "" }
q13608
BaseRepository.first
train
public function first($columns = ['*']) { $this->applyCriteria(); $this->applyScope(); $results = $this->model->first($columns); $this->resetModel(); return $this->parserResult($results); }
php
{ "resource": "" }
q13609
BaseRepository.find
train
public function find($id, $columns = ['*']) { $this->applyCriteria(); $this->applyScope(); $model = $this->model->findOrFail($id, $columns); $this->resetModel(); return $this->parserResult($model); }
php
{ "resource": "" }
q13610
BaseRepository.findWhereIn
train
public function findWhereIn($field, array $values, $columns = ['*']) { $this->applyCriteria(); $this->applyScope(); $model = $this->model->whereIn($field, $values)->get($columns); $this->resetModel(); return $this->parserResult($model); }
php
{ "resource": "" }
q13611
BaseRepository.findWhereNotIn
train
public function findWhereNotIn($field, array $values, $columns = ['*']) { $this->applyCriteria(); $this->applyScope(); $model = $this->model->whereNotIn($field, $values)->get($columns); $this->resetModel(); return $this->parserResult($model); }
php
{ "resource": "" }
q13612
BaseRepository.whereHas
train
public function whereHas($relation, $closure) { $this->model = $this->model->whereHas($relation, $closure); return $this; }
php
{ "resource": "" }
q13613
BaseRepository.pushCriteria
train
public function pushCriteria($criteria) { if (is_string($criteria)) { $criteria = new $criteria; } if (!$criteria instanceof CriteriaInterface) { throw new RepositoryException("Class " . get_class($criteria) . " must be an instance of Prettus\\Repository\\Contracts\\CriteriaInterface"); } $this->criteria->push($criteria); return $this; }
php
{ "resource": "" }
q13614
BaseRepository.applyConditions
train
protected function applyConditions(array $where) { foreach ($where as $field => $value) { if (is_array($value)) { list($field, $condition, $val) = $value; $this->model = $this->model->where($field, $condition, $val); } else { $this->model = $this->model->where($field, '=', $value); } } }
php
{ "resource": "" }
q13615
BaseRepository.parserResult
train
public function parserResult($result) { if ($this->presenter instanceof PresenterInterface) { if ($result instanceof Collection || $result instanceof LengthAwarePaginator) { $result->each(function ($model) { if ($model instanceof Presentable) { $model->setPresenter($this->presenter); } return $model; }); } elseif ($result instanceof Presentable) { $result = $result->setPresenter($this->presenter); } if (!$this->skipPresenter) { return $this->presenter->present($result); } } return $result; }
php
{ "resource": "" }
q13616
Generator.getName
train
public function getName() { $name = $this->name; if (str_contains($this->name, '\\')) { $name = str_replace('\\', '/', $this->name); } if (str_contains($this->name, '/')) { $name = str_replace('/', '/', $this->name); } return Str::studly(str_replace(' ', '/', ucwords(str_replace('/', ' ', $name)))); }
php
{ "resource": "" }
q13617
Generator.getConfigGeneratorClassPath
train
public function getConfigGeneratorClassPath($class, $directoryPath = false) { switch ($class) { case ('models' === $class): $path = config('repository.generator.paths.models', 'Entities'); break; case ('repositories' === $class): $path = config('repository.generator.paths.repositories', 'Repositories'); break; case ('interfaces' === $class): $path = config('repository.generator.paths.interfaces', 'Repositories'); break; case ('presenters' === $class): $path = config('repository.generator.paths.presenters', 'Presenters'); break; case ('transformers' === $class): $path = config('repository.generator.paths.transformers', 'Transformers'); break; case ('validators' === $class): $path = config('repository.generator.paths.validators', 'Validators'); break; case ('controllers' === $class): $path = config('repository.generator.paths.controllers', 'Http\Controllers'); break; case ('provider' === $class): $path = config('repository.generator.paths.provider', 'RepositoryServiceProvider'); break; case ('criteria' === $class): $path = config('repository.generator.paths.criteria', 'Criteria'); break; default: $path = ''; } if ($directoryPath) { $path = str_replace('\\', '/', $path); } else { $path = str_replace('/', '\\', $path); } return $path; }
php
{ "resource": "" }
q13618
BackupJob.dumpDatabases
train
protected function dumpDatabases(): array { return $this->dbDumpers->map(function (DbDumper $dbDumper, $key) { consoleOutput()->info("Dumping database {$dbDumper->getDbName()}..."); $dbType = mb_strtolower(basename(str_replace('\\', '/', get_class($dbDumper)))); $dbName = $dbDumper->getDbName(); if ($dbDumper instanceof Sqlite) { $dbName = $key.'-database'; } $fileName = "{$dbType}-{$dbName}.{$this->getExtension($dbDumper)}"; if (config('backup.backup.gzip_database_dump')) { $dbDumper->useCompressor(new GzipCompressor()); $fileName .= '.'.$dbDumper->getCompressorExtension(); } if ($compressor = config('backup.backup.database_dump_compressor')) { $dbDumper->useCompressor(new $compressor()); $fileName .= '.'.$dbDumper->getCompressorExtension(); } $temporaryFilePath = $this->temporaryDirectory->path('db-dumps'.DIRECTORY_SEPARATOR.$fileName); $dbDumper->dumpToFile($temporaryFilePath); return $temporaryFilePath; })->toArray(); }
php
{ "resource": "" }
q13619
FileSelection.excludeFilesFrom
train
public function excludeFilesFrom($excludeFilesAndDirectories): self { $this->excludeFilesAndDirectories = $this->excludeFilesAndDirectories->merge($this->sanitize($excludeFilesAndDirectories)); return $this; }
php
{ "resource": "" }
q13620
AMQPWriter.write_bits
train
public function write_bits($bits) { $value = 0; foreach ($bits as $n => $bit) { $bit = $bit ? 1 : 0; $value |= ($bit << $n); } $this->out .= chr($value); return $this; }
php
{ "resource": "" }
q13621
AMQPWriter.write_octet
train
public function write_octet($n) { if ($n < 0 || $n > 255) { throw new AMQPInvalidArgumentException('Octet out of range: ' . $n); } $this->out .= chr($n); return $this; }
php
{ "resource": "" }
q13622
AMQPWriter.write_short
train
public function write_short($n) { if ($n < 0 || $n > 65535) { throw new AMQPInvalidArgumentException('Short out of range: ' . $n); } $this->out .= pack('n', $n); return $this; }
php
{ "resource": "" }
q13623
AMQPWriter.write_long
train
public function write_long($n) { if (($n < 0) || ($n > 4294967295)) { throw new AMQPInvalidArgumentException('Long out of range: ' . $n); } //Numeric strings >PHP_INT_MAX on 32bit are casted to PHP_INT_MAX, damn PHP if (empty($this->is64bits) && is_string($n)) { $n = (float) $n; } $this->out .= pack('N', $n); return $this; }
php
{ "resource": "" }
q13624
AMQPWriter.write_longlong
train
public function write_longlong($n) { if ($n < 0) { throw new AMQPInvalidArgumentException('Longlong out of range: ' . $n); } // if PHP_INT_MAX is big enough for that // direct $n<=PHP_INT_MAX check is unreliable on 64bit (values close to max) due to limited float precision if (bcadd($n, -PHP_INT_MAX, 0) <= 0) { // trick explained in http://www.php.net/manual/fr/function.pack.php#109328 if ($this->is64bits) { list($hi, $lo) = $this->splitIntoQuads($n); } else { $hi = 0; $lo = $n; } //on 32bits hi quad is 0 a priori $this->out .= pack('NN', $hi, $lo); } else { try { $this->out .= self::packBigEndian($n, 8); } catch (AMQPOutOfBoundsException $ex) { throw new AMQPInvalidArgumentException('Longlong out of range: ' . $n, 0, $ex); } } return $this; }
php
{ "resource": "" }
q13625
AMQPWriter.write_shortstr
train
public function write_shortstr($s) { $len = mb_strlen($s, 'ASCII'); if ($len > 255) { throw new AMQPInvalidArgumentException('String too long'); } $this->write_octet($len); $this->out .= $s; return $this; }
php
{ "resource": "" }
q13626
AbstractChannel.prepare_method_frame
train
protected function prepare_method_frame($method_sig, $args = '', $pkt = null) { return $this->connection->prepare_channel_method_frame($this->channel_id, $method_sig, $args, $pkt); }
php
{ "resource": "" }
q13627
AbstractChannel.wait
train
public function wait($allowed_methods = null, $non_blocking = false, $timeout = 0) { $this->debug->debug_allowed_methods($allowed_methods); $deferred = $this->process_deferred_methods($allowed_methods); if ($deferred['dispatch'] === true) { return $this->dispatch_deferred_method($deferred['queued_method']); } // timeouts must be deactivated for non-blocking actions if (true === $non_blocking) { $timeout = null; } // No deferred methods? wait for new ones while (true) { try { list($frame_type, $payload) = $this->next_frame($timeout); } catch (AMQPNoDataException $e) { // no data ready for non-blocking actions - stop and exit break; } catch (AMQPConnectionClosedException $exception) { if ($this instanceof AMQPChannel) { $this->do_close(); } throw $exception; } $this->validate_method_frame($frame_type); $this->validate_frame_payload($payload); $method_sig = $this->build_method_signature($payload); $args = $this->extract_args($payload); $this->debug->debug_method_signature('> %s', $method_sig); $amqpMessage = $this->maybe_wait_for_content($method_sig); if ($this->should_dispatch_method($allowed_methods, $method_sig)) { return $this->dispatch($method_sig, $args, $amqpMessage); } // Wasn't what we were looking for? save it for later $this->debug->debug_method_signature('Queueing for later: %s', $method_sig); $this->method_queue[] = array($method_sig, $args, $amqpMessage); if ($non_blocking) { break; } } }
php
{ "resource": "" }
q13628
GenericContent.has
train
public function has($name) { return isset($this->properties[$name]) || isset($this->delivery_info[$name]); }
php
{ "resource": "" }
q13629
GenericContent.get
train
public function get($name) { if (isset($this->properties[$name])) { return $this->properties[$name]; } if (isset($this->delivery_info[$name])) { return $this->delivery_info[$name]; } throw new \OutOfBoundsException(sprintf( 'No "%s" property', $name )); }
php
{ "resource": "" }
q13630
AbstractIO.write_heartbeat
train
protected function write_heartbeat() { $pkt = new AMQPWriter(); $pkt->write_octet(8); $pkt->write_short(0); $pkt->write_long(0); $pkt->write_octet(0xCE); $this->write($pkt->getvalue()); }
php
{ "resource": "" }
q13631
AbstractIO.cleanup_error_handler
train
protected function cleanup_error_handler() { restore_error_handler(); if ($this->last_error !== null) { throw new \ErrorException( $this->last_error['errstr'], 0, $this->last_error['errno'], $this->last_error['errfile'], $this->last_error['errline'] ); } }
php
{ "resource": "" }
q13632
AbstractIO.error_handler
train
public function error_handler($errno, $errstr, $errfile, $errline, $errcontext = null) { // throwing an exception in an error handler will halt execution // set the last error and continue $this->last_error = compact('errno', 'errstr', 'errfile', 'errline', 'errcontext'); }
php
{ "resource": "" }
q13633
AMQPReader.reuse
train
public function reuse($str) { $this->str = $str; $this->str_length = mb_strlen($this->str, 'ASCII'); $this->offset = 0; $this->bitcount = $this->bits = 0; }
php
{ "resource": "" }
q13634
AMQPReader.wait
train
protected function wait() { $timeout = $this->getTimeout(); if (null === $timeout) { // timeout=null just poll state and return instantly $sec = 0; $usec = 0; } elseif ($timeout > 0) { list($sec, $usec) = MiscHelper::splitSecondsMicroseconds($this->getTimeout()); } else { // wait indefinitely for data if timeout=0 $sec = null; $usec = 0; } $result = $this->io->select($sec, $usec); if ($result === false) { throw new AMQPIOWaitException('A network error occurred while awaiting for incoming data'); } if ($result === 0) { if ($timeout > 0) { throw new AMQPTimeoutException(sprintf( 'The connection timed out after %s sec while awaiting incoming data', $timeout )); } else { throw new AMQPNoDataException('No data is ready to read'); } } }
php
{ "resource": "" }
q13635
AMQPReader.read_longlong
train
public function read_longlong() { $this->bitcount = $this->bits = 0; list(, $hi, $lo) = unpack('N2', $this->rawread(8)); $msb = self::getLongMSB($hi); if (empty($this->is64bits)) { if ($msb) { $hi = sprintf('%u', $hi); } if (self::getLongMSB($lo)) { $lo = sprintf('%u', $lo); } } return bcadd($this->is64bits && !$msb ? $hi << 32 : bcmul($hi, '4294967296', 0), $lo, 0); }
php
{ "resource": "" }
q13636
AMQPReader.read_array
train
public function read_array($returnObject = false) { $this->bitcount = $this->bits = 0; // Determine array length and its end position $arrayLength = $this->read_php_int(); $endOffset = $this->offset + $arrayLength; $result = $returnObject ? new AMQPArray() : array(); // Read values until we reach the end of the array while ($this->offset < $endOffset) { $fieldType = AMQPAbstractCollection::getDataTypeForSymbol($this->rawread(1)); $fieldValue = $this->read_value($fieldType, $returnObject); $returnObject ? $result->push($fieldValue, $fieldType) : $result[] = $fieldValue; } return $result; }
php
{ "resource": "" }
q13637
AMQPReader.read_value
train
public function read_value($fieldType, $collectionsAsObjects = false) { $this->bitcount = $this->bits = 0; switch ($fieldType) { case AMQPAbstractCollection::T_INT_SHORTSHORT: //according to AMQP091 spec, 'b' is not bit, it is short-short-int, also valid for rabbit/qpid //$val=$this->read_bit(); $val = $this->read_signed_octet(); break; case AMQPAbstractCollection::T_INT_SHORTSHORT_U: $val = $this->read_octet(); break; case AMQPAbstractCollection::T_INT_SHORT: $val = $this->read_signed_short(); break; case AMQPAbstractCollection::T_INT_SHORT_U: $val = $this->read_short(); break; case AMQPAbstractCollection::T_INT_LONG: $val = $this->read_signed_long(); break; case AMQPAbstractCollection::T_INT_LONG_U: $val = $this->read_long(); break; case AMQPAbstractCollection::T_INT_LONGLONG: $val = $this->read_signed_longlong(); break; case AMQPAbstractCollection::T_INT_LONGLONG_U: $val = $this->read_longlong(); break; case AMQPAbstractCollection::T_DECIMAL: $e = $this->read_octet(); $n = $this->read_signed_long(); $val = new AMQPDecimal($n, $e); break; case AMQPAbstractCollection::T_TIMESTAMP: $val = $this->read_timestamp(); break; case AMQPAbstractCollection::T_BOOL: $val = $this->read_octet(); break; case AMQPAbstractCollection::T_STRING_SHORT: $val = $this->read_shortstr(); break; case AMQPAbstractCollection::T_STRING_LONG: $val = $this->read_longstr(); break; case AMQPAbstractCollection::T_ARRAY: $val = $this->read_array($collectionsAsObjects); break; case AMQPAbstractCollection::T_TABLE: $val = $this->read_table($collectionsAsObjects); break; case AMQPAbstractCollection::T_VOID: $val = null; break; case AMQPAbstractCollection::T_BYTES: $val = $this->read_longstr(); break; default: throw new AMQPInvalidArgumentException(sprintf( 'Unsupported type "%s"', $fieldType )); } return isset($val) ? $val : null; }
php
{ "resource": "" }
q13638
AbstractConnection.connect
train
protected function connect() { try { // Loop until we connect while (!$this->isConnected()) { // Assume we will connect, until we dont $this->setIsConnected(true); // Connect the socket $this->io->connect(); $this->channels = array(); // The connection object itself is treated as channel 0 parent::__construct($this, 0); $this->input = new AMQPReader(null, $this->io); $this->write($this->amqp_protocol_header); $this->wait(array($this->waitHelper->get_wait('connection.start')),false,$this->connection_timeout); $this->x_start_ok( $this->getLibraryProperties(), $this->login_method, $this->login_response, $this->locale ); $this->wait_tune_ok = true; while ($this->wait_tune_ok) { $this->wait(array( $this->waitHelper->get_wait('connection.secure'), $this->waitHelper->get_wait('connection.tune') )); } $host = $this->x_open($this->vhost, '', $this->insist); if (!$host) { //Reconnected $this->io->reenableHeartbeat(); return null; // we weren't redirected } $this->setIsConnected(false); $this->closeChannels(); // we were redirected, close the socket, loop and try again $this->close_socket(); } } catch (\Exception $e) { // Something went wrong, set the connection status $this->setIsConnected(false); $this->closeChannels(); $this->close_input(); $this->close_socket(); throw $e; // Rethrow exception } }
php
{ "resource": "" }
q13639
AbstractConnection.reconnect
train
public function reconnect() { // Try to close the AMQP connection $this->safeClose(); // Reconnect the socket/stream then AMQP $this->io->close(); $this->setIsConnected(false); // getIO can initiate the connection setting via LazyConnection, set it here to be sure $this->connect(); }
php
{ "resource": "" }
q13640
AbstractConnection.safeClose
train
protected function safeClose() { try { if (isset($this->input) && $this->input) { $this->close(); } } catch (\Exception $e) { // Nothing here } }
php
{ "resource": "" }
q13641
AbstractConnection.wait_frame
train
protected function wait_frame($timeout = 0) { if (is_null($this->input)) { $this->setIsConnected(false); throw new AMQPConnectionClosedException('Broken pipe or closed connection'); } $currentTimeout = $this->input->getTimeout(); $this->input->setTimeout($timeout); try { // frame_type + channel_id + size $this->wait_frame_reader->reuse( $this->input->read(AMQPReader::OCTET + AMQPReader::SHORT + AMQPReader::LONG) ); $frame_type = $this->wait_frame_reader->read_octet(); $class = self::$PROTOCOL_CONSTANTS_CLASS; if (!array_key_exists($frame_type, $class::$FRAME_TYPES)) { throw new AMQPInvalidFrameException('Invalid frame type ' . $frame_type); } $channel = $this->wait_frame_reader->read_short(); $size = $this->wait_frame_reader->read_long(); // payload + ch $this->wait_frame_reader->reuse($this->input->read(AMQPReader::OCTET + (int) $size)); $payload = $this->wait_frame_reader->read($size); $ch = $this->wait_frame_reader->read_octet(); } catch (AMQPTimeoutException $e) { $this->input->setTimeout($currentTimeout); throw $e; } catch (AMQPNoDataException $e) { if ($this->input) { $this->input->setTimeout($currentTimeout); } throw $e; } catch (AMQPConnectionClosedException $exception) { $this->do_close(); throw $exception; } $this->input->setTimeout($currentTimeout); if ($ch != 0xCE) { throw new AMQPInvalidFrameException(sprintf( 'Framing error, unexpected byte: %x', $ch )); } return array($frame_type, $channel, $payload); }
php
{ "resource": "" }
q13642
AbstractConnection.wait_channel
train
protected function wait_channel($channel_id, $timeout = 0) { // Keeping the original timeout unchanged. $_timeout = $timeout; while (true) { $now = time(); try { list($frame_type, $frame_channel, $payload) = $this->wait_frame($_timeout); } catch (AMQPTimeoutException $e) { if ( $this->heartbeat && microtime(true) - ($this->heartbeat*2) > $this->last_frame ) { $this->debug->debug_msg("missed server heartbeat (at threshold * 2)"); $this->setIsConnected(false); throw new AMQPHeartbeatMissedException("Missed server heartbeat"); } throw $e; } $this->last_frame = microtime(true); if ($frame_channel === 0 && $frame_type === 8) { // skip heartbeat frames and reduce the timeout by the time passed $this->debug->debug_msg("received server heartbeat"); if($_timeout > 0) { $_timeout -= time() - $now; if($_timeout <= 0) { // If timeout has been reached, throw the exception without calling wait_frame throw new AMQPTimeoutException("Timeout waiting on channel"); } } continue; } else { if ($frame_channel == $channel_id) { return array($frame_type, $payload); } // Not the channel we were looking for. Queue this frame //for later, when the other channel is looking for frames. // Make sure the channel still exists, it could have been // closed by a previous Exception. if (isset($this->channels[$frame_channel])) { array_push($this->channels[$frame_channel]->frame_queue, array($frame_type, $payload)); } // If we just queued up a method for channel 0 (the Connection // itself) it's probably a close method in reaction to some // error, so deal with it right away. if (($frame_type == 1) && ($frame_channel == 0)) { $this->wait(); } } } }
php
{ "resource": "" }
q13643
AbstractConnection.close
train
public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0)) { $result = null; $this->io->disableHeartbeat(); if (empty($this->protocolWriter) || !$this->isConnected()) { return $result; } try { $this->closeChannels(); list($class_id, $method_id, $args) = $this->protocolWriter->connectionClose( $reply_code, $reply_text, $method_sig[0], $method_sig[1] ); $this->send_method_frame(array($class_id, $method_id), $args); $result = $this->wait( array($this->waitHelper->get_wait('connection.close_ok')), false, $this->connection_timeout ); } catch (\Exception $exception) { $this->do_close(); throw $exception; } $this->setIsConnected(false); return $result; }
php
{ "resource": "" }
q13644
AbstractConnection.connection_open_ok
train
protected function connection_open_ok($args) { $this->known_hosts = $args->read_shortstr(); $this->debug->debug_msg('Open OK! known_hosts: ' . $this->known_hosts); }
php
{ "resource": "" }
q13645
AbstractConnection.connection_redirect
train
protected function connection_redirect($args) { $host = $args->read_shortstr(); $this->known_hosts = $args->read_shortstr(); $this->debug->debug_msg(sprintf( 'Redirected to [%s], known_hosts [%s]', $host, $this->known_hosts )); return $host; }
php
{ "resource": "" }
q13646
AbstractConnection.x_secure_ok
train
protected function x_secure_ok($response) { $args = new AMQPWriter(); $args->write_longstr($response); $this->send_method_frame(array(10, 21), $args); }
php
{ "resource": "" }
q13647
AbstractConnection.connection_start
train
protected function connection_start($args) { $this->version_major = $args->read_octet(); $this->version_minor = $args->read_octet(); $this->server_properties = $args->read_table(); $this->mechanisms = explode(' ', $args->read_longstr()); $this->locales = explode(' ', $args->read_longstr()); $this->debug->debug_connection_start( $this->version_major, $this->version_minor, $this->server_properties, $this->mechanisms, $this->locales ); }
php
{ "resource": "" }
q13648
AbstractConnection.connection_tune
train
protected function connection_tune($args) { $v = $args->read_short(); if ($v) { $this->channel_max = $v; } $v = $args->read_long(); if ($v) { $this->frame_max = $v; } // use server proposed value if not set if ($this->heartbeat === null) { $this->heartbeat = $args->read_short(); } $this->x_tune_ok($this->channel_max, $this->frame_max, $this->heartbeat); }
php
{ "resource": "" }
q13649
AbstractConnection.x_tune_ok
train
protected function x_tune_ok($channel_max, $frame_max, $heartbeat) { $args = new AMQPWriter(); $args->write_short($channel_max); $args->write_long($frame_max); $args->write_short($heartbeat); $this->send_method_frame(array(10, 31), $args); $this->wait_tune_ok = false; }
php
{ "resource": "" }
q13650
AbstractConnection.closeChannels
train
protected function closeChannels() { foreach ($this->channels as $key => $channel) { // channels[0] is this connection object, so don't close it yet if ($key === 0) { continue; } try { $channel->close(); } catch (\Exception $e) { /* Ignore closing errors */ } } }
php
{ "resource": "" }
q13651
AMQPChannel.channel_alert
train
protected function channel_alert($reader) { $reply_code = $reader->read_short(); $reply_text = $reader->read_shortstr(); $details = $reader->read_table(); array_push($this->alerts, array($reply_code, $reply_text, $details)); }
php
{ "resource": "" }
q13652
AMQPChannel.close
train
public function close($reply_code = 0, $reply_text = '', $method_sig = array(0, 0)) { $this->callbacks = array(); if ($this->is_open === false || $this->connection === null) { $this->do_close(); return null; // already closed } list($class_id, $method_id, $args) = $this->protocolWriter->channelClose( $reply_code, $reply_text, $method_sig[0], $method_sig[1] ); try { $this->send_method_frame(array($class_id, $method_id), $args); } catch (\Exception $e) { $this->do_close(); throw $e; } return $this->wait(array( $this->waitHelper->get_wait('channel.close_ok') ), false, $this->channel_rpc_timeout ); }
php
{ "resource": "" }
q13653
AMQPChannel.access_request
train
public function access_request( $realm, $exclusive = false, $passive = false, $active = false, $write = false, $read = false ) { list($class_id, $method_id, $args) = $this->protocolWriter->accessRequest( $realm, $exclusive, $passive, $active, $write, $read ); $this->send_method_frame(array($class_id, $method_id), $args); return $this->wait(array( $this->waitHelper->get_wait('access.request_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13654
AMQPChannel.exchange_delete
train
public function exchange_delete( $exchange, $if_unused = false, $nowait = false, $ticket = null ) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->exchangeDelete( $ticket, $exchange, $if_unused, $nowait ); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } return $this->wait(array( $this->waitHelper->get_wait('exchange.delete_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13655
AMQPChannel.exchange_bind
train
public function exchange_bind( $destination, $source, $routing_key = '', $nowait = false, $arguments = array(), $ticket = null ) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->exchangeBind( $ticket, $destination, $source, $routing_key, $nowait, $arguments ); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } return $this->wait(array( $this->waitHelper->get_wait('exchange.bind_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13656
AMQPChannel.queue_bind
train
public function queue_bind( $queue, $exchange, $routing_key = '', $nowait = false, $arguments = array(), $ticket = null ) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->queueBind( $ticket, $queue, $exchange, $routing_key, $nowait, $arguments ); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } return $this->wait(array( $this->waitHelper->get_wait('queue.bind_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13657
AMQPChannel.queue_unbind
train
public function queue_unbind( $queue, $exchange, $routing_key = '', $arguments = array(), $ticket = null ) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->queueUnbind( $ticket, $queue, $exchange, $routing_key, $arguments ); $this->send_method_frame(array($class_id, $method_id), $args); return $this->wait(array( $this->waitHelper->get_wait('queue.unbind_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13658
AMQPChannel.queue_declare_ok
train
protected function queue_declare_ok($reader) { $queue = $reader->read_shortstr(); $message_count = $reader->read_long(); $consumer_count = $reader->read_long(); return array($queue, $message_count, $consumer_count); }
php
{ "resource": "" }
q13659
AMQPChannel.queue_delete
train
public function queue_delete($queue = '', $if_unused = false, $if_empty = false, $nowait = false, $ticket = null) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->queueDelete( $ticket, $queue, $if_unused, $if_empty, $nowait ); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } return $this->wait(array( $this->waitHelper->get_wait('queue.delete_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13660
AMQPChannel.queue_purge
train
public function queue_purge($queue = '', $nowait = false, $ticket = null) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->queuePurge($ticket, $queue, $nowait); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } return $this->wait(array( $this->waitHelper->get_wait('queue.purge_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13661
AMQPChannel.basic_ack
train
public function basic_ack($delivery_tag, $multiple = false) { list($class_id, $method_id, $args) = $this->protocolWriter->basicAck($delivery_tag, $multiple); $this->send_method_frame(array($class_id, $method_id), $args); }
php
{ "resource": "" }
q13662
AMQPChannel.basic_ack_from_server
train
protected function basic_ack_from_server(AMQPReader $reader) { $delivery_tag = $reader->read_longlong(); $multiple = (bool) $reader->read_bit(); if (!isset($this->published_messages[$delivery_tag])) { throw new AMQPRuntimeException(sprintf( 'Server ack\'ed unknown delivery_tag "%s"', $delivery_tag )); } $this->internal_ack_handler($delivery_tag, $multiple, $this->ack_handler); }
php
{ "resource": "" }
q13663
AMQPChannel.basic_nack_from_server
train
protected function basic_nack_from_server($reader) { $delivery_tag = $reader->read_longlong(); $multiple = (bool) $reader->read_bit(); if (!isset($this->published_messages[$delivery_tag])) { throw new AMQPRuntimeException(sprintf( 'Server nack\'ed unknown delivery_tag "%s"', $delivery_tag )); } $this->internal_ack_handler($delivery_tag, $multiple, $this->nack_handler); }
php
{ "resource": "" }
q13664
AMQPChannel.basic_nack
train
public function basic_nack($delivery_tag, $multiple = false, $requeue = false) { list($class_id, $method_id, $args) = $this->protocolWriter->basicNack($delivery_tag, $multiple, $requeue); $this->send_method_frame(array($class_id, $method_id), $args); }
php
{ "resource": "" }
q13665
AMQPChannel.basic_cancel
train
public function basic_cancel($consumer_tag, $nowait = false, $noreturn = false) { list($class_id, $method_id, $args) = $this->protocolWriter->basicCancel($consumer_tag, $nowait); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait || $noreturn) { unset($this->callbacks[$consumer_tag]); return $consumer_tag; } return $this->wait(array( $this->waitHelper->get_wait('basic.cancel_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13666
AMQPChannel.basic_consume
train
public function basic_consume( $queue = '', $consumer_tag = '', $no_local = false, $no_ack = false, $exclusive = false, $nowait = false, $callback = null, $ticket = null, $arguments = array() ) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->basicConsume( $ticket, $queue, $consumer_tag, $no_local, $no_ack, $exclusive, $nowait, $this->protocolVersion == '0.9.1' ? $arguments : null ); $this->send_method_frame(array($class_id, $method_id), $args); if (false === $nowait) { $consumer_tag = $this->wait(array( $this->waitHelper->get_wait('basic.consume_ok') ), false, $this->channel_rpc_timeout); } $this->callbacks[$consumer_tag] = $callback; return $consumer_tag; }
php
{ "resource": "" }
q13667
AMQPChannel.basic_deliver
train
protected function basic_deliver($reader, $message) { $consumer_tag = $reader->read_shortstr(); $delivery_tag = $reader->read_longlong(); $redelivered = $reader->read_bit(); $exchange = $reader->read_shortstr(); $routing_key = $reader->read_shortstr(); $message->delivery_info = array( 'channel' => $this, 'consumer_tag' => $consumer_tag, 'delivery_tag' => $delivery_tag, 'redelivered' => $redelivered, 'exchange' => $exchange, 'routing_key' => $routing_key ); if (isset($this->callbacks[$consumer_tag])) { call_user_func($this->callbacks[$consumer_tag], $message); } }
php
{ "resource": "" }
q13668
AMQPChannel.basic_get
train
public function basic_get($queue = '', $no_ack = false, $ticket = null) { $ticket = $this->getTicket($ticket); list($class_id, $method_id, $args) = $this->protocolWriter->basicGet($ticket, $queue, $no_ack); $this->send_method_frame(array($class_id, $method_id), $args); return $this->wait(array( $this->waitHelper->get_wait('basic.get_ok'), $this->waitHelper->get_wait('basic.get_empty') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13669
AMQPChannel.basic_get_ok
train
protected function basic_get_ok($reader, $message) { $delivery_tag = $reader->read_longlong(); $redelivered = $reader->read_bit(); $exchange = $reader->read_shortstr(); $routing_key = $reader->read_shortstr(); $message_count = $reader->read_long(); $message->delivery_info = array( 'delivery_tag' => $delivery_tag, 'redelivered' => $redelivered, 'exchange' => $exchange, 'routing_key' => $routing_key, 'message_count' => $message_count ); return $message; }
php
{ "resource": "" }
q13670
AMQPChannel.basic_publish
train
public function basic_publish( $msg, $exchange = '', $routing_key = '', $mandatory = false, $immediate = false, $ticket = null ) { $pkt = new AMQPWriter(); $pkt->write($this->pre_publish($exchange, $routing_key, $mandatory, $immediate, $ticket)); try { $this->connection->send_content( $this->channel_id, 60, 0, mb_strlen($msg->body, 'ASCII'), $msg->serialize_properties(), $msg->body, $pkt ); } catch (AMQPConnectionClosedException $e) { $this->do_close(); throw $e; } if ($this->next_delivery_tag > 0) { $this->published_messages[$this->next_delivery_tag] = $msg; $this->next_delivery_tag = bcadd($this->next_delivery_tag, '1', 0); } }
php
{ "resource": "" }
q13671
AMQPChannel.basic_recover
train
public function basic_recover($requeue = false) { list($class_id, $method_id, $args) = $this->protocolWriter->basicRecover($requeue); $this->send_method_frame(array($class_id, $method_id), $args); return $this->wait(array( $this->waitHelper->get_wait('basic.recover_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13672
AMQPChannel.basic_reject
train
public function basic_reject($delivery_tag, $requeue) { list($class_id, $method_id, $args) = $this->protocolWriter->basicReject($delivery_tag, $requeue); $this->send_method_frame(array($class_id, $method_id), $args); }
php
{ "resource": "" }
q13673
AMQPChannel.basic_return
train
protected function basic_return($reader, $message) { $callback = $this->basic_return_callback; if (!is_callable($callback)) { $this->debug->debug_msg('Skipping unhandled basic_return message'); return null; } $reply_code = $reader->read_short(); $reply_text = $reader->read_shortstr(); $exchange = $reader->read_shortstr(); $routing_key = $reader->read_shortstr(); call_user_func_array($callback, array( $reply_code, $reply_text, $exchange, $routing_key, $message, )); }
php
{ "resource": "" }
q13674
AMQPChannel.tx_rollback
train
public function tx_rollback() { $this->send_method_frame(array(90, 30)); return $this->wait(array( $this->waitHelper->get_wait('tx.rollback_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13675
AMQPChannel.confirm_select
train
public function confirm_select($nowait = false) { list($class_id, $method_id, $args) = $this->protocolWriter->confirmSelect($nowait); $this->send_method_frame(array($class_id, $method_id), $args); if ($nowait) { return null; } $this->wait(array( $this->waitHelper->get_wait('confirm.select_ok') ), false, $this->channel_rpc_timeout); $this->next_delivery_tag = 1; }
php
{ "resource": "" }
q13676
AMQPChannel.wait_for_pending_acks
train
public function wait_for_pending_acks($timeout = 0) { $functions = array( $this->waitHelper->get_wait('basic.ack'), $this->waitHelper->get_wait('basic.nack'), ); while (count($this->published_messages) !== 0) { if ($timeout > 0) { $this->wait($functions, true, $timeout); } else { $this->wait($functions); } } }
php
{ "resource": "" }
q13677
AMQPChannel.tx_select
train
public function tx_select() { $this->send_method_frame(array(90, 10)); return $this->wait(array( $this->waitHelper->get_wait('tx.select_ok') ), false, $this->channel_rpc_timeout); }
php
{ "resource": "" }
q13678
AMQPChannel.set_return_listener
train
public function set_return_listener($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException(sprintf( 'Given callback "%s" should be callable. %s type was given.', $callback, gettype($callback) )); } $this->basic_return_callback = $callback; }
php
{ "resource": "" }
q13679
AMQPChannel.set_nack_handler
train
public function set_nack_handler($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException(sprintf( 'Given callback "%s" should be callable. %s type was given.', $callback, gettype($callback) )); } $this->nack_handler = $callback; }
php
{ "resource": "" }
q13680
AMQPChannel.set_ack_handler
train
public function set_ack_handler($callback) { if (!is_callable($callback)) { throw new \InvalidArgumentException(sprintf( 'Given callback "%s" should be callable. %s type was given.', $callback, gettype($callback) )); } $this->ack_handler = $callback; }
php
{ "resource": "" }
q13681
Consumer.start
train
public function start() { if ($this->restart) { echo 'Restarting consumer.' . PHP_EOL; $this->restart = false; } else { echo 'Starting consumer.' . PHP_EOL; } $exchange = 'router'; $queue = 'msgs'; $this->channel = $this->connection->channel(); $this->channel->queue_declare($queue, false, true, false, false); $this->channel->exchange_declare($exchange, AMQPExchangeType::DIRECT, false, true, false); $this->channel->queue_bind($queue, $exchange); $this->channel->basic_consume( $queue, $this->consumerTag, false, false, false, false, [$this,'messageHandler'], null, ['x-cancel-on-ha-failover' => ['t', true]] // fail over to another node ); echo 'Enter wait.' . PHP_EOL; while ($this->channel->is_consuming()) { $this->channel->wait(); } echo 'Exit wait.' . PHP_EOL; }
php
{ "resource": "" }
q13682
MiscHelper.hexdump
train
public static function hexdump($data, $htmloutput = true, $uppercase = false, $return = false) { // Init $hexi = ''; $ascii = ''; $dump = $htmloutput ? '<pre>' : ''; $offset = 0; $len = mb_strlen($data, 'ASCII'); // Upper or lower case hexidecimal $hexFormat = $uppercase ? 'X' : 'x'; // Iterate string for ($i = $j = 0; $i < $len; $i++) { // Convert to hexidecimal // We must use concatenation here because the $hexFormat value // is needed for sprintf() to parse the format $hexi .= sprintf('%02' . $hexFormat . ' ', ord($data[$i])); // Replace non-viewable bytes with '.' if (ord($data[$i]) >= 32) { $ascii .= $htmloutput ? htmlentities($data[$i]) : $data[$i]; } else { $ascii .= '.'; } // Add extra column spacing if ($j === 7) { $hexi .= ' '; $ascii .= ' '; } // Add row if (++$j === 16 || $i === $len - 1) { // Join the hexi / ascii output // We must use concatenation here because the $hexFormat value // is needed for sprintf() to parse the format $dump .= sprintf('%04' . $hexFormat . ' %-49s %s', $offset, $hexi, $ascii); // Reset vars $hexi = $ascii = ''; $offset += 16; $j = 0; // Add newline if ($i !== $len - 1) { $dump .= PHP_EOL; } } } // Finish dump $dump .= $htmloutput ? '</pre>' : ''; $dump .= PHP_EOL; if ($return) { return $dump; } echo $dump; }
php
{ "resource": "" }
q13683
Discussion.getApiDocument
train
protected function getApiDocument(User $actor, array $params) { $response = $this->api->send('Flarum\Api\Controller\ShowDiscussionController', $actor, $params); $statusCode = $response->getStatusCode(); if ($statusCode === 404) { throw new RouteNotFoundException; } return json_decode($response->getBody()); }
php
{ "resource": "" }
q13684
Application.url
train
public function url($path = null) { $config = $this->make('flarum.config'); $url = array_get($config, 'url', array_get($_SERVER, 'REQUEST_URI')); if (is_array($url)) { if (isset($url[$path])) { return $url[$path]; } $url = $url['base']; } if ($path) { $url .= '/'.array_get($config, "paths.$path", $path); } return $url; }
php
{ "resource": "" }
q13685
NotificationServiceProvider.registerNotificationTypes
train
public function registerNotificationTypes() { $blueprints = [ DiscussionRenamedBlueprint::class => ['alert'] ]; $this->app->make('events')->fire( new ConfigureNotificationTypes($blueprints) ); foreach ($blueprints as $blueprint => $enabled) { Notification::setSubjectModel( $type = $blueprint::getType(), $blueprint::getSubjectModel() ); User::addPreference( User::getNotificationPreferenceKey($type, 'alert'), 'boolval', in_array('alert', $enabled) ); if ((new ReflectionClass($blueprint))->implementsInterface(MailableInterface::class)) { User::addPreference( User::getNotificationPreferenceKey($type, 'email'), 'boolval', in_array('email', $enabled) ); } } }
php
{ "resource": "" }
q13686
RevisionCompiler.getFilenameForRevision
train
protected function getFilenameForRevision(string $revision): string { $ext = pathinfo($this->filename, PATHINFO_EXTENSION); return substr_replace($this->filename, '-'.$revision, -strlen($ext) - 1, 0); }
php
{ "resource": "" }
q13687
NotificationRepository.findByUser
train
public function findByUser(User $user, $limit = null, $offset = 0) { $primaries = Notification::select( app('flarum.db')->raw('MAX(id) AS id'), app('flarum.db')->raw('SUM(read_at IS NULL) AS unread_count') ) ->where('user_id', $user->id) ->whereIn('type', $user->getAlertableNotificationTypes()) ->where('is_deleted', false) ->whereSubjectVisibleTo($user) ->groupBy('type', 'subject_id') ->orderByRaw('MAX(created_at) DESC') ->skip($offset) ->take($limit); return Notification::select('notifications.*', app('flarum.db')->raw('p.unread_count')) ->mergeBindings($primaries->getQuery()) ->join(app('flarum.db')->raw('('.$primaries->toSql().') p'), 'notifications.id', '=', app('flarum.db')->raw('p.id')) ->latest() ->get(); }
php
{ "resource": "" }
q13688
NotificationRepository.markAllAsRead
train
public function markAllAsRead(User $user) { Notification::where('user_id', $user->id)->update(['read_at' => Carbon::now()]); }
php
{ "resource": "" }
q13689
AccessToken.generate
train
public static function generate($userId, $lifetime = 3600) { $token = new static; $token->token = str_random(40); $token->user_id = $userId; $token->created_at = Carbon::now(); $token->last_activity_at = Carbon::now(); $token->lifetime_seconds = $lifetime; return $token; }
php
{ "resource": "" }
q13690
RouteCollectionUrlGenerator.route
train
public function route($name, $parameters = []) { $path = $this->routes->getPath($name, $parameters); $path = ltrim($path, '/'); return $this->baseUrl.'/'.$path; }
php
{ "resource": "" }
q13691
AbstractValidator.assertValid
train
public function assertValid(array $attributes) { $validator = $this->makeValidator($attributes); if ($validator->fails()) { throw new ValidationException($validator); } }
php
{ "resource": "" }
q13692
AbstractValidator.makeValidator
train
protected function makeValidator(array $attributes) { $rules = array_only($this->getRules(), array_keys($attributes)); $validator = $this->validator->make($attributes, $rules, $this->getMessages()); $this->events->dispatch( new Validating($this, $validator) ); return $validator; }
php
{ "resource": "" }
q13693
Index.getApiDocument
train
private function getApiDocument(User $actor, array $params) { return json_decode($this->api->send(ListDiscussionsController::class, $actor, $params)->getBody()); }
php
{ "resource": "" }
q13694
ApiServiceProvider.registerNotificationSerializers
train
protected function registerNotificationSerializers() { $blueprints = []; $serializers = [ 'discussionRenamed' => BasicDiscussionSerializer::class ]; $this->app->make('events')->fire( new ConfigureNotificationTypes($blueprints, $serializers) ); foreach ($serializers as $type => $serializer) { NotificationSerializer::setSubjectSerializer($type, $serializer); } }
php
{ "resource": "" }
q13695
ApiServiceProvider.populateRoutes
train
protected function populateRoutes(RouteCollection $routes) { $factory = $this->app->make(RouteHandlerFactory::class); $callback = include __DIR__.'/routes.php'; $callback($routes, $factory); $this->app->make('events')->fire( new ConfigureApiRoutes($routes, $factory) ); }
php
{ "resource": "" }
q13696
User.rename
train
public function rename($username) { if ($username !== $this->username) { $oldUsername = $this->username; $this->username = $username; $this->raise(new Renamed($this, $oldUsername)); } return $this; }
php
{ "resource": "" }
q13697
User.changeEmail
train
public function changeEmail($email) { if ($email !== $this->email) { $this->email = $email; $this->raise(new EmailChanged($this)); } return $this; }
php
{ "resource": "" }
q13698
User.requestEmailChange
train
public function requestEmailChange($email) { if ($email !== $this->email) { $this->raise(new EmailChangeRequested($this, $email)); } return $this; }
php
{ "resource": "" }
q13699
User.changeAvatarPath
train
public function changeAvatarPath($path) { $this->avatar_url = $path; $this->raise(new AvatarChanged($this)); return $this; }
php
{ "resource": "" }