repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
propelorm/Propel2 | src/Propel/Common/Config/PropelConfiguration.php | PropelConfiguration.getConfigTreeBuilder | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('propel');
$this->addGeneralSection($rootNode);
$this->addExcludeTablesSection($rootNode);
$this->addPathsSection($rootNode);
$this->addDatabaseSection($rootNode... | php | public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('propel');
$this->addGeneralSection($rootNode);
$this->addExcludeTablesSection($rootNode);
$this->addPathsSection($rootNode);
$this->addDatabaseSection($rootNode... | [
"public",
"function",
"getConfigTreeBuilder",
"(",
")",
"{",
"$",
"treeBuilder",
"=",
"new",
"TreeBuilder",
"(",
")",
";",
"$",
"rootNode",
"=",
"$",
"treeBuilder",
"->",
"root",
"(",
"'propel'",
")",
";",
"$",
"this",
"->",
"addGeneralSection",
"(",
"$",
... | Generates the configuration tree builder.
@return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder | [
"Generates",
"the",
"configuration",
"tree",
"builder",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Common/Config/PropelConfiguration.php#L30-L45 |
propelorm/Propel2 | src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php | QueryInheritanceBuilder.getParentClassName | protected function getParentClassName()
{
if (is_null($this->getChild()->getAncestor())) {
return $this->getNewStubQueryBuilder($this->getTable())->getUnqualifiedClassName();
}
$ancestorClassName = ClassTools::classname($this->getChild()->getAncestor());
if ($this->getDa... | php | protected function getParentClassName()
{
if (is_null($this->getChild()->getAncestor())) {
return $this->getNewStubQueryBuilder($this->getTable())->getUnqualifiedClassName();
}
$ancestorClassName = ClassTools::classname($this->getChild()->getAncestor());
if ($this->getDa... | [
"protected",
"function",
"getParentClassName",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"getChild",
"(",
")",
"->",
"getAncestor",
"(",
")",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getNewStubQueryBuilder",
"(",
"$",
"this",
"->",... | Returns classpath to parent class.
@return string | [
"Returns",
"classpath",
"to",
"parent",
"class",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php#L98-L115 |
propelorm/Propel2 | src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php | QueryInheritanceBuilder.addClassOpen | protected function addClassOpen(&$script)
{
$table = $this->getTable();
$tableName = $table->getName();
$tableDesc = $table->getDescription();
$baseBuilder = $this->getStubQueryBuilder();
$this->declareClassFromBuilder($baseBuilder);
$baseClassName = $this->getParent... | php | protected function addClassOpen(&$script)
{
$table = $this->getTable();
$tableName = $table->getName();
$tableDesc = $table->getDescription();
$baseBuilder = $this->getStubQueryBuilder();
$this->declareClassFromBuilder($baseBuilder);
$baseClassName = $this->getParent... | [
"protected",
"function",
"addClassOpen",
"(",
"&",
"$",
"script",
")",
"{",
"$",
"table",
"=",
"$",
"this",
"->",
"getTable",
"(",
")",
";",
"$",
"tableName",
"=",
"$",
"table",
"->",
"getName",
"(",
")",
";",
"$",
"tableDesc",
"=",
"$",
"table",
"... | Adds class phpdoc comment and opening of class.
@param string &$script | [
"Adds",
"class",
"phpdoc",
"comment",
"and",
"opening",
"of",
"class",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php#L122-L155 |
propelorm/Propel2 | src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php | QueryInheritanceBuilder.addClassBody | protected function addClassBody(&$script)
{
$this->declareClassFromBuilder($this->getTableMapBuilder());
$this->declareClasses(
'\Propel\Runtime\Connection\ConnectionInterface',
'\Propel\Runtime\ActiveQuery\Criteria'
);
$this->addFactory($script);
$thi... | php | protected function addClassBody(&$script)
{
$this->declareClassFromBuilder($this->getTableMapBuilder());
$this->declareClasses(
'\Propel\Runtime\Connection\ConnectionInterface',
'\Propel\Runtime\ActiveQuery\Criteria'
);
$this->addFactory($script);
$thi... | [
"protected",
"function",
"addClassBody",
"(",
"&",
"$",
"script",
")",
"{",
"$",
"this",
"->",
"declareClassFromBuilder",
"(",
"$",
"this",
"->",
"getTableMapBuilder",
"(",
")",
")",
";",
"$",
"this",
"->",
"declareClasses",
"(",
"'\\Propel\\Runtime\\Connection\... | Specifies the methods that are added as part of the stub object class.
By default there are no methods for the empty stub classes; override this
method if you want to change that behavior.
@param string $script
@see ObjectBuilder::addClassBody() | [
"Specifies",
"the",
"methods",
"that",
"are",
"added",
"as",
"part",
"of",
"the",
"stub",
"object",
"class",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php#L166-L178 |
propelorm/Propel2 | src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php | QueryInheritanceBuilder.addFactory | protected function addFactory(&$script)
{
$builder = $this->getNewStubQueryInheritanceBuilder($this->getChild());
$this->declareClassFromBuilder($builder, 'Child');
$classname = $builder->getClassName();
$script .= "
/**
* Returns a new " . $classname . " object.
*
... | php | protected function addFactory(&$script)
{
$builder = $this->getNewStubQueryInheritanceBuilder($this->getChild());
$this->declareClassFromBuilder($builder, 'Child');
$classname = $builder->getClassName();
$script .= "
/**
* Returns a new " . $classname . " object.
*
... | [
"protected",
"function",
"addFactory",
"(",
"&",
"$",
"script",
")",
"{",
"$",
"builder",
"=",
"$",
"this",
"->",
"getNewStubQueryInheritanceBuilder",
"(",
"$",
"this",
"->",
"getChild",
"(",
")",
")",
";",
"$",
"this",
"->",
"declareClassFromBuilder",
"(",
... | Adds the factory for this object.
@param string &$script | [
"Adds",
"the",
"factory",
"for",
"this",
"object",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Generator/Builder/Om/QueryInheritanceBuilder.php#L185-L215 |
propelorm/Propel2 | src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php | BaseModelCriteria.setFormatter | public function setFormatter($formatter)
{
if (is_string($formatter)) {
$formatter = new $formatter($this);
}
if (!$formatter instanceof AbstractFormatter) {
throw new InvalidArgumentException('setFormatter() only accepts classes extending AbstractFormatter');
... | php | public function setFormatter($formatter)
{
if (is_string($formatter)) {
$formatter = new $formatter($this);
}
if (!$formatter instanceof AbstractFormatter) {
throw new InvalidArgumentException('setFormatter() only accepts classes extending AbstractFormatter');
... | [
"public",
"function",
"setFormatter",
"(",
"$",
"formatter",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"formatter",
")",
")",
"{",
"$",
"formatter",
"=",
"new",
"$",
"formatter",
"(",
"$",
"this",
")",
";",
"}",
"if",
"(",
"!",
"$",
"formatter",
... | Sets the formatter to use for the find() output
Formatters must extend AbstractFormatter
Use the ModelCriteria constants for class names:
<code>
$c->setFormatter(ModelCriteria::FORMAT_ARRAY);
</code>
@param string|AbstractFormatter $formatter a formatter class name, or a formatter instance
@return $this|ModelCriteria... | [
"Sets",
"the",
"formatter",
"to",
"use",
"for",
"the",
"find",
"()",
"output",
"Formatters",
"must",
"extend",
"AbstractFormatter",
"Use",
"the",
"ModelCriteria",
"constants",
"for",
"class",
"names",
":",
"<code",
">",
"$c",
"-",
">",
"setFormatter",
"(",
"... | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php#L84-L97 |
propelorm/Propel2 | src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php | BaseModelCriteria.getFormatter | public function getFormatter()
{
if (null === $this->formatter) {
$formatterClass = $this->defaultFormatterClass;
$this->formatter = new $formatterClass();
}
return $this->formatter;
} | php | public function getFormatter()
{
if (null === $this->formatter) {
$formatterClass = $this->defaultFormatterClass;
$this->formatter = new $formatterClass();
}
return $this->formatter;
} | [
"public",
"function",
"getFormatter",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"formatter",
")",
"{",
"$",
"formatterClass",
"=",
"$",
"this",
"->",
"defaultFormatterClass",
";",
"$",
"this",
"->",
"formatter",
"=",
"new",
"$",
"format... | Gets the formatter to use for the find() output
Defaults to an instance of ModelCriteria::$defaultFormatterClass, i.e. PropelObjectsFormatter
@return AbstractFormatter | [
"Gets",
"the",
"formatter",
"to",
"use",
"for",
"the",
"find",
"()",
"output",
"Defaults",
"to",
"an",
"instance",
"of",
"ModelCriteria",
"::",
"$defaultFormatterClass",
"i",
".",
"e",
".",
"PropelObjectsFormatter"
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php#L105-L113 |
propelorm/Propel2 | src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php | BaseModelCriteria.setModelName | public function setModelName($modelName)
{
if (0 === strpos($modelName, '\\')) {
$this->modelName = substr($modelName, 1);
} else {
$this->modelName = $modelName;
}
if ($this->modelName && !$this->modelTableMapName) {
$this->modelTableMapName = con... | php | public function setModelName($modelName)
{
if (0 === strpos($modelName, '\\')) {
$this->modelName = substr($modelName, 1);
} else {
$this->modelName = $modelName;
}
if ($this->modelName && !$this->modelTableMapName) {
$this->modelTableMapName = con... | [
"public",
"function",
"setModelName",
"(",
"$",
"modelName",
")",
"{",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"modelName",
",",
"'\\\\'",
")",
")",
"{",
"$",
"this",
"->",
"modelName",
"=",
"substr",
"(",
"$",
"modelName",
",",
"1",
")",
";",
"... | Sets the model name.
This also sets `this->modelTableMapName` and `this->tableMap`.
@param string $modelName
@return $this|ModelCriteria The current object, for fluid interface | [
"Sets",
"the",
"model",
"name",
".",
"This",
"also",
"sets",
"this",
"-",
">",
"modelTableMapName",
"and",
"this",
"-",
">",
"tableMap",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php#L133-L148 |
propelorm/Propel2 | src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php | BaseModelCriteria.setModelAlias | public function setModelAlias($modelAlias, $useAliasInSQL = false)
{
if ($useAliasInSQL) {
$this->addAlias($modelAlias, $this->tableMap->getName());
$this->useAliasInSQL = true;
}
$this->modelAlias = $modelAlias;
return $this;
} | php | public function setModelAlias($modelAlias, $useAliasInSQL = false)
{
if ($useAliasInSQL) {
$this->addAlias($modelAlias, $this->tableMap->getName());
$this->useAliasInSQL = true;
}
$this->modelAlias = $modelAlias;
return $this;
} | [
"public",
"function",
"setModelAlias",
"(",
"$",
"modelAlias",
",",
"$",
"useAliasInSQL",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"useAliasInSQL",
")",
"{",
"$",
"this",
"->",
"addAlias",
"(",
"$",
"modelAlias",
",",
"$",
"this",
"->",
"tableMap",
"->",
... | Sets the alias for the model in this query
@param string $modelAlias The model alias
@param boolean $useAliasInSQL Whether to use the alias in the SQL code (false by default)
@return $this|ModelCriteria The current object, for fluid interface | [
"Sets",
"the",
"alias",
"for",
"the",
"model",
"in",
"this",
"query"
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php#L163-L173 |
propelorm/Propel2 | src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php | BaseModelCriteria.getIterator | public function getIterator()
{
$res = $this->find(null); // use the default connection
if ($res instanceof \IteratorAggregate) {
return $res->getIterator();
}
if ($res instanceof \Traversable) {
return $res;
}
if (is_array($res)) {
... | php | public function getIterator()
{
$res = $this->find(null); // use the default connection
if ($res instanceof \IteratorAggregate) {
return $res->getIterator();
}
if ($res instanceof \Traversable) {
return $res;
}
if (is_array($res)) {
... | [
"public",
"function",
"getIterator",
"(",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"find",
"(",
"null",
")",
";",
"// use the default connection",
"if",
"(",
"$",
"res",
"instanceof",
"\\",
"IteratorAggregate",
")",
"{",
"return",
"$",
"res",
"->",
... | Execute the query with a find(), and return a Traversable object.
The return value depends on the query formatter. By default, this returns an ArrayIterator
constructed on a Propel\Runtime\Collection\PropelCollection.
Compulsory for implementation of \IteratorAggregate.
@return \Traversable
@throws LogicException | [
"Execute",
"the",
"query",
"with",
"a",
"find",
"()",
"and",
"return",
"a",
"Traversable",
"object",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/ActiveQuery/BaseModelCriteria.php#L226-L239 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.beginTransaction | public function beginTransaction()
{
$return = true;
if (!$this->nestedTransactionCount) {
$return = $this->connection->beginTransaction();
if ($this->useDebug) {
$this->log('Begin transaction');
}
$this->isUncommitable = false;
... | php | public function beginTransaction()
{
$return = true;
if (!$this->nestedTransactionCount) {
$return = $this->connection->beginTransaction();
if ($this->useDebug) {
$this->log('Begin transaction');
}
$this->isUncommitable = false;
... | [
"public",
"function",
"beginTransaction",
"(",
")",
"{",
"$",
"return",
"=",
"true",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"nestedTransactionCount",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"connection",
"->",
"beginTransaction",
"(",
")",
";",... | Overrides PDO::beginTransaction() to prevent errors due to already-in-progress transaction.
@return boolean | [
"Overrides",
"PDO",
"::",
"beginTransaction",
"()",
"to",
"prevent",
"errors",
"due",
"to",
"already",
"-",
"in",
"-",
"progress",
"transaction",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L201-L214 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.commit | public function commit()
{
$return = true;
$opcount = $this->nestedTransactionCount;
if ($opcount > 0) {
if (1 === $opcount) {
if ($this->isUncommitable) {
throw new RollbackException('Cannot commit because a nested transaction was rolled back... | php | public function commit()
{
$return = true;
$opcount = $this->nestedTransactionCount;
if ($opcount > 0) {
if (1 === $opcount) {
if ($this->isUncommitable) {
throw new RollbackException('Cannot commit because a nested transaction was rolled back... | [
"public",
"function",
"commit",
"(",
")",
"{",
"$",
"return",
"=",
"true",
";",
"$",
"opcount",
"=",
"$",
"this",
"->",
"nestedTransactionCount",
";",
"if",
"(",
"$",
"opcount",
">",
"0",
")",
"{",
"if",
"(",
"1",
"===",
"$",
"opcount",
")",
"{",
... | Overrides PDO::commit() to only commit the transaction if we are in the outermost
transaction nesting level.
@return boolean | [
"Overrides",
"PDO",
"::",
"commit",
"()",
"to",
"only",
"commit",
"the",
"transaction",
"if",
"we",
"are",
"in",
"the",
"outermost",
"transaction",
"nesting",
"level",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L222-L243 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.rollBack | public function rollBack()
{
$return = true;
$opcount = $this->nestedTransactionCount;
if ($opcount > 0) {
if (1 === $opcount) {
$return = $this->connection->rollBack();
if ($this->useDebug) {
$this->log('Rollback transaction')... | php | public function rollBack()
{
$return = true;
$opcount = $this->nestedTransactionCount;
if ($opcount > 0) {
if (1 === $opcount) {
$return = $this->connection->rollBack();
if ($this->useDebug) {
$this->log('Rollback transaction')... | [
"public",
"function",
"rollBack",
"(",
")",
"{",
"$",
"return",
"=",
"true",
";",
"$",
"opcount",
"=",
"$",
"this",
"->",
"nestedTransactionCount",
";",
"if",
"(",
"$",
"opcount",
">",
"0",
")",
"{",
"if",
"(",
"1",
"===",
"$",
"opcount",
")",
"{",... | Overrides PDO::rollBack() to only rollback the transaction if we are in the outermost
transaction nesting level
@return boolean Whether operation was successful. | [
"Overrides",
"PDO",
"::",
"rollBack",
"()",
"to",
"only",
"rollback",
"the",
"transaction",
"if",
"we",
"are",
"in",
"the",
"outermost",
"transaction",
"nesting",
"level"
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L251-L270 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.forceRollBack | public function forceRollBack()
{
$return = true;
if ($this->nestedTransactionCount) {
// If we're in a transaction, always roll it back
// regardless of nesting level.
$return = $this->connection->rollBack();
// reset nested transaction count to 0 s... | php | public function forceRollBack()
{
$return = true;
if ($this->nestedTransactionCount) {
// If we're in a transaction, always roll it back
// regardless of nesting level.
$return = $this->connection->rollBack();
// reset nested transaction count to 0 s... | [
"public",
"function",
"forceRollBack",
"(",
")",
"{",
"$",
"return",
"=",
"true",
";",
"if",
"(",
"$",
"this",
"->",
"nestedTransactionCount",
")",
"{",
"// If we're in a transaction, always roll it back",
"// regardless of nesting level.",
"$",
"return",
"=",
"$",
... | Rollback the whole transaction, even if this is a nested rollback
and reset the nested transaction count to 0.
@return boolean Whether operation was successful. | [
"Rollback",
"the",
"whole",
"transaction",
"even",
"if",
"this",
"is",
"a",
"nested",
"rollback",
"and",
"reset",
"the",
"nested",
"transaction",
"count",
"to",
"0",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L278-L297 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.getAttribute | public function getAttribute($attribute)
{
switch ($attribute) {
case self::PROPEL_ATTR_CACHE_PREPARES:
return $this->isCachePreparedStatements;
break;
default:
return $this->connection->getAttribute($attribute);
}
} | php | public function getAttribute($attribute)
{
switch ($attribute) {
case self::PROPEL_ATTR_CACHE_PREPARES:
return $this->isCachePreparedStatements;
break;
default:
return $this->connection->getAttribute($attribute);
}
} | [
"public",
"function",
"getAttribute",
"(",
"$",
"attribute",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"self",
"::",
"PROPEL_ATTR_CACHE_PREPARES",
":",
"return",
"$",
"this",
"->",
"isCachePreparedStatements",
";",
"break",
";",
"default",
"... | Retrieve a database connection attribute.
@param string $attribute The name of the attribute to retrieve,
e.g. PDO::ATTR_AUTOCOMMIT
@return mixed A successful call returns the value of the requested attribute.
An unsuccessful call returns null. | [
"Retrieve",
"a",
"database",
"connection",
"attribute",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L318-L327 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.setAttribute | public function setAttribute($attribute, $value)
{
if (is_string($attribute)) {
if (false === strpos($attribute, '::')) {
if (defined('\PDO::' . $attribute)) {
$attribute = '\PDO::' . $attribute;
} else {
$attribute = __CLAS... | php | public function setAttribute($attribute, $value)
{
if (is_string($attribute)) {
if (false === strpos($attribute, '::')) {
if (defined('\PDO::' . $attribute)) {
$attribute = '\PDO::' . $attribute;
} else {
$attribute = __CLAS... | [
"public",
"function",
"setAttribute",
"(",
"$",
"attribute",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"attribute",
")",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"attribute",
",",
"'::'",
")",
")",
"{",
"if",
"(... | Set an attribute.
@param string $attribute The attribute name, or the constant name containing the attribute name (e.g. 'PDO::ATTR_CASE')
@param mixed $value | [
"Set",
"an",
"attribute",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L335-L360 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.prepare | public function prepare($statement, $driver_options = null)
{
$statementWrapper = null;
if ($this->isCachePreparedStatements && isset($this->cachedPreparedStatements[$statement])) {
$statementWrapper = $this->cachedPreparedStatements[$statement];
} else {
$statementW... | php | public function prepare($statement, $driver_options = null)
{
$statementWrapper = null;
if ($this->isCachePreparedStatements && isset($this->cachedPreparedStatements[$statement])) {
$statementWrapper = $this->cachedPreparedStatements[$statement];
} else {
$statementW... | [
"public",
"function",
"prepare",
"(",
"$",
"statement",
",",
"$",
"driver_options",
"=",
"null",
")",
"{",
"$",
"statementWrapper",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"isCachePreparedStatements",
"&&",
"isset",
"(",
"$",
"this",
"->",
"cachedP... | Prepares a statement for execution and returns a statement object.
Overrides PDO::prepare() in order to:
- Add logging and query counting if logging is true.
- Add query caching support if the PropelPDO::PROPEL_ATTR_CACHE_PREPARES was set to true.
@param string $statement This must be a valid SQL statement for t... | [
"Prepares",
"a",
"statement",
"for",
"execution",
"and",
"returns",
"a",
"statement",
"object",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L375-L394 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.exec | public function exec($sql)
{
$return = $this->connection->exec($sql);
if ($this->useDebug) {
$this->log($sql);
$this->setLastExecutedQuery($sql);
$this->incrementQueryCount();
}
return $return;
} | php | public function exec($sql)
{
$return = $this->connection->exec($sql);
if ($this->useDebug) {
$this->log($sql);
$this->setLastExecutedQuery($sql);
$this->incrementQueryCount();
}
return $return;
} | [
"public",
"function",
"exec",
"(",
"$",
"sql",
")",
"{",
"$",
"return",
"=",
"$",
"this",
"->",
"connection",
"->",
"exec",
"(",
"$",
"sql",
")",
";",
"if",
"(",
"$",
"this",
"->",
"useDebug",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"$",
"sql"... | Execute an SQL statement and return the number of affected rows.
Overrides PDO::exec() to log queries when required
@param string $sql
@return integer | [
"Execute",
"an",
"SQL",
"statement",
"and",
"return",
"the",
"number",
"of",
"affected",
"rows",
".",
"Overrides",
"PDO",
"::",
"exec",
"()",
"to",
"log",
"queries",
"when",
"required"
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L403-L414 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.query | public function query($statement)
{
$args = func_get_args();
$sql = array_shift($args);
$statementWrapper = $this->createStatementWrapper($sql);
$return = call_user_func_array([$statementWrapper, 'query'], $args);
if ($this->useDebug) {
$this->log($sql);
... | php | public function query($statement)
{
$args = func_get_args();
$sql = array_shift($args);
$statementWrapper = $this->createStatementWrapper($sql);
$return = call_user_func_array([$statementWrapper, 'query'], $args);
if ($this->useDebug) {
$this->log($sql);
... | [
"public",
"function",
"query",
"(",
"$",
"statement",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"sql",
"=",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"statementWrapper",
"=",
"$",
"this",
"->",
"createStatementWrapper",
"(",
... | Executes an SQL statement, returning a result set as a PDOStatement object.
Despite its signature here, this method takes a variety of parameters.
Overrides PDO::query() to log queries when required
@see http://php.net/manual/en/pdo.query.php for a description of the possible parameters.
@param string $statement The... | [
"Executes",
"an",
"SQL",
"statement",
"returning",
"a",
"result",
"set",
"as",
"a",
"PDOStatement",
"object",
".",
"Despite",
"its",
"signature",
"here",
"this",
"method",
"takes",
"a",
"variety",
"of",
"parameters",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L429-L443 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.useDebug | public function useDebug($value = true)
{
if (!$value) {
// reset query logging
$this->setLastExecutedQuery('');
$this->queryCount = 0;
}
$this->clearStatementCache();
$this->useDebug = $value;
} | php | public function useDebug($value = true)
{
if (!$value) {
// reset query logging
$this->setLastExecutedQuery('');
$this->queryCount = 0;
}
$this->clearStatementCache();
$this->useDebug = $value;
} | [
"public",
"function",
"useDebug",
"(",
"$",
"value",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"value",
")",
"{",
"// reset query logging",
"$",
"this",
"->",
"setLastExecutedQuery",
"(",
"''",
")",
";",
"$",
"this",
"->",
"queryCount",
"=",
"0",
";"... | Enable or disable the query debug features
@param boolean $value True to enable debug (default), false to disable it | [
"Enable",
"or",
"disable",
"the",
"query",
"debug",
"features"
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L573-L582 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.getLogger | public function getLogger()
{
if (null === $this->logger) {
return Propel::getServiceContainer()->getLogger($this->getName());
}
return $this->logger;
} | php | public function getLogger()
{
if (null === $this->logger) {
return Propel::getServiceContainer()->getLogger($this->getName());
}
return $this->logger;
} | [
"public",
"function",
"getLogger",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"logger",
")",
"{",
"return",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getLogger",
"(",
"$",
"this",
"->",
"getName",
"(",
")",
")",
";",
"}... | Gets the logger to use for this connection.
If no logger was set, returns the default logger from the Service Container.
@return LoggerInterface A logger. | [
"Gets",
"the",
"logger",
"to",
"use",
"for",
"this",
"connection",
".",
"If",
"no",
"logger",
"was",
"set",
"returns",
"the",
"default",
"logger",
"from",
"the",
"Service",
"Container",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L619-L626 |
propelorm/Propel2 | src/Propel/Runtime/Connection/ConnectionWrapper.php | ConnectionWrapper.log | public function log($msg)
{
$backtrace = debug_backtrace();
if (!isset($backtrace[1]['function'])) {
return;
}
$i = 1;
$stackSize = count($backtrace);
do {
$callingMethod = $backtrace[$i]['function'];
$i++;
} while ($callin... | php | public function log($msg)
{
$backtrace = debug_backtrace();
if (!isset($backtrace[1]['function'])) {
return;
}
$i = 1;
$stackSize = count($backtrace);
do {
$callingMethod = $backtrace[$i]['function'];
$i++;
} while ($callin... | [
"public",
"function",
"log",
"(",
"$",
"msg",
")",
"{",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"backtrace",
"[",
"1",
"]",
"[",
"'function'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"i",
... | Logs the method call or the executed SQL statement.
@param string $msg Message to log. | [
"Logs",
"the",
"method",
"call",
"or",
"the",
"executed",
"SQL",
"statement",
"."
] | train | https://github.com/propelorm/Propel2/blob/6c4996fc130c7555d82d9dca04396c6f3eeef306/src/Propel/Runtime/Connection/ConnectionWrapper.php#L633-L652 |
bugsnag/bugsnag-php | src/Request/PhpRequest.php | PhpRequest.getContext | public function getContext()
{
if (isset($this->server['REQUEST_METHOD']) && isset($this->server['REQUEST_URI'])) {
return $this->server['REQUEST_METHOD'].' '.strtok($this->server['REQUEST_URI'], '?');
}
} | php | public function getContext()
{
if (isset($this->server['REQUEST_METHOD']) && isset($this->server['REQUEST_URI'])) {
return $this->server['REQUEST_METHOD'].' '.strtok($this->server['REQUEST_URI'], '?');
}
} | [
"public",
"function",
"getContext",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"server",
"[",
"'REQUEST_METHOD'",
"]",
")",
"&&",
"isset",
"(",
"$",
"this",
"->",
"server",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"return",
"$",
"thi... | Get the request context.
@return string|null | [
"Get",
"the",
"request",
"context",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/PhpRequest.php#L127-L132 |
bugsnag/bugsnag-php | src/Request/PhpRequest.php | PhpRequest.getCurrentUrl | protected function getCurrentUrl()
{
$schema = ((!empty($this->server['HTTPS']) && $this->server['HTTPS'] !== 'off') || (!empty($this->server['SERVER_PORT']) && $this->server['SERVER_PORT'] == 443)) ? 'https://' : 'http://';
$host = isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : '... | php | protected function getCurrentUrl()
{
$schema = ((!empty($this->server['HTTPS']) && $this->server['HTTPS'] !== 'off') || (!empty($this->server['SERVER_PORT']) && $this->server['SERVER_PORT'] == 443)) ? 'https://' : 'http://';
$host = isset($this->server['HTTP_HOST']) ? $this->server['HTTP_HOST'] : '... | [
"protected",
"function",
"getCurrentUrl",
"(",
")",
"{",
"$",
"schema",
"=",
"(",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"server",
"[",
"'HTTPS'",
"]",
")",
"&&",
"$",
"this",
"->",
"server",
"[",
"'HTTPS'",
"]",
"!==",
"'off'",
")",
"||",
"(",... | Get the request url.
@return string | [
"Get",
"the",
"request",
"url",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/PhpRequest.php#L149-L156 |
bugsnag/bugsnag-php | src/Request/PhpRequest.php | PhpRequest.getRequestIp | protected function getRequestIp()
{
if (isset($this->server['HTTP_X_FORWARDED_FOR'])) {
return $this->server['HTTP_X_FORWARDED_FOR'];
}
if (isset($this->server['REMOTE_ADDR'])) {
return $this->server['REMOTE_ADDR'];
}
} | php | protected function getRequestIp()
{
if (isset($this->server['HTTP_X_FORWARDED_FOR'])) {
return $this->server['HTTP_X_FORWARDED_FOR'];
}
if (isset($this->server['REMOTE_ADDR'])) {
return $this->server['REMOTE_ADDR'];
}
} | [
"protected",
"function",
"getRequestIp",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"server",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"server",
"[",
"'HTTP_X_FORWARDED_FOR'",
"]",
";",
"}",
"if",
"(... | Get the request ip.
@return string|null | [
"Get",
"the",
"request",
"ip",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/PhpRequest.php#L163-L172 |
bugsnag/bugsnag-php | src/Request/BasicResolver.php | BasicResolver.resolve | public function resolve()
{
if (isset($_SERVER['REQUEST_METHOD'])) {
if (strtoupper($_SERVER['REQUEST_METHOD']) === 'GET') {
$params = static::getInputParams($_SERVER, $_GET, false);
} else {
$params = static::getInputParams($_SERVER, $_POST, true);
... | php | public function resolve()
{
if (isset($_SERVER['REQUEST_METHOD'])) {
if (strtoupper($_SERVER['REQUEST_METHOD']) === 'GET') {
$params = static::getInputParams($_SERVER, $_GET, false);
} else {
$params = static::getInputParams($_SERVER, $_POST, true);
... | [
"public",
"function",
"resolve",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
")",
"{",
"if",
"(",
"strtoupper",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METHOD'",
"]",
")",
"===",
"'GET'",
")",
"{",
"$",
"par... | Resolve the current request.
@return \Bugsnag\Request\RequestInterface | [
"Resolve",
"the",
"current",
"request",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/BasicResolver.php#L12-L33 |
bugsnag/bugsnag-php | src/Request/BasicResolver.php | BasicResolver.getRequestHeaders | protected static function getRequestHeaders(array $server)
{
static $headers;
if ($headers !== null) {
return $headers;
}
$headers = [];
foreach ($server as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replac... | php | protected static function getRequestHeaders(array $server)
{
static $headers;
if ($headers !== null) {
return $headers;
}
$headers = [];
foreach ($server as $name => $value) {
if (substr($name, 0, 5) == 'HTTP_') {
$headers[str_replac... | [
"protected",
"static",
"function",
"getRequestHeaders",
"(",
"array",
"$",
"server",
")",
"{",
"static",
"$",
"headers",
";",
"if",
"(",
"$",
"headers",
"!==",
"null",
")",
"{",
"return",
"$",
"headers",
";",
"}",
"$",
"headers",
"=",
"[",
"]",
";",
... | Get the request headers.
Note how we're caching this result for ever, across all instances.
This is because PHP is natively only designed to process one request,
then shutdown. Some applications can be designed to handle multiple
requests using their own request objects, thus will need to implement
their own bugsnag ... | [
"Get",
"the",
"request",
"headers",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/BasicResolver.php#L49-L66 |
bugsnag/bugsnag-php | src/Request/BasicResolver.php | BasicResolver.getInputParams | protected static function getInputParams(array $server, array $params, $fallbackToInput = false)
{
static $result;
if ($result !== null) {
return $result ?: null;
}
$result = $params;
if ($fallbackToInput === true) {
$result = $result ?: static::par... | php | protected static function getInputParams(array $server, array $params, $fallbackToInput = false)
{
static $result;
if ($result !== null) {
return $result ?: null;
}
$result = $params;
if ($fallbackToInput === true) {
$result = $result ?: static::par... | [
"protected",
"static",
"function",
"getInputParams",
"(",
"array",
"$",
"server",
",",
"array",
"$",
"params",
",",
"$",
"fallbackToInput",
"=",
"false",
")",
"{",
"static",
"$",
"result",
";",
"if",
"(",
"$",
"result",
"!==",
"null",
")",
"{",
"return",... | Get the input params.
Note how we're caching this result for ever, across all instances.
This is because the input stream can only be read once on PHP 5.5, and
PHP is natively only designed to process one request, then shutdown.
Some applications can be designed to handle multiple requests using
their own request obj... | [
"Get",
"the",
"input",
"params",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/BasicResolver.php#L85-L100 |
bugsnag/bugsnag-php | src/Request/BasicResolver.php | BasicResolver.parseInput | protected static function parseInput(array $server, $input)
{
if (!$input) {
return;
}
if (isset($server['CONTENT_TYPE']) && stripos($server['CONTENT_TYPE'], 'application/json') === 0) {
return (array) json_decode($input, true) ?: null;
}
if (strtoup... | php | protected static function parseInput(array $server, $input)
{
if (!$input) {
return;
}
if (isset($server['CONTENT_TYPE']) && stripos($server['CONTENT_TYPE'], 'application/json') === 0) {
return (array) json_decode($input, true) ?: null;
}
if (strtoup... | [
"protected",
"static",
"function",
"parseInput",
"(",
"array",
"$",
"server",
",",
"$",
"input",
")",
"{",
"if",
"(",
"!",
"$",
"input",
")",
"{",
"return",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"server",
"[",
"'CONTENT_TYPE'",
"]",
")",
"&&",
"s... | Parse the given input string.
@param array $server the server variables
@param string|null $input the http request input
@return array|null | [
"Parse",
"the",
"given",
"input",
"string",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/BasicResolver.php#L120-L135 |
bugsnag/bugsnag-php | src/ErrorTypes.php | ErrorTypes.getLevelsForSeverity | public static function getLevelsForSeverity($severity)
{
$levels = 0;
foreach (static::$ERROR_TYPES as $level => $info) {
if ($info['severity'] == $severity) {
$levels |= $level;
}
}
return $levels;
} | php | public static function getLevelsForSeverity($severity)
{
$levels = 0;
foreach (static::$ERROR_TYPES as $level => $info) {
if ($info['severity'] == $severity) {
$levels |= $level;
}
}
return $levels;
} | [
"public",
"static",
"function",
"getLevelsForSeverity",
"(",
"$",
"severity",
")",
"{",
"$",
"levels",
"=",
"0",
";",
"foreach",
"(",
"static",
"::",
"$",
"ERROR_TYPES",
"as",
"$",
"level",
"=>",
"$",
"info",
")",
"{",
"if",
"(",
"$",
"info",
"[",
"'... | Get the the levels for the given severity.
@param string $severity the given severity
@return int | [
"Get",
"the",
"the",
"levels",
"for",
"the",
"given",
"severity",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/ErrorTypes.php#L140-L151 |
bugsnag/bugsnag-php | src/Client.php | Client.make | public static function make($apiKey = null, $endpoint = null, $defaults = true)
{
$config = new Configuration($apiKey ?: getenv('BUGSNAG_API_KEY'));
$guzzle = static::makeGuzzle($endpoint ?: getenv('BUGSNAG_ENDPOINT'));
$client = new static($config, null, $guzzle);
if ($defaults) {... | php | public static function make($apiKey = null, $endpoint = null, $defaults = true)
{
$config = new Configuration($apiKey ?: getenv('BUGSNAG_API_KEY'));
$guzzle = static::makeGuzzle($endpoint ?: getenv('BUGSNAG_ENDPOINT'));
$client = new static($config, null, $guzzle);
if ($defaults) {... | [
"public",
"static",
"function",
"make",
"(",
"$",
"apiKey",
"=",
"null",
",",
"$",
"endpoint",
"=",
"null",
",",
"$",
"defaults",
"=",
"true",
")",
"{",
"$",
"config",
"=",
"new",
"Configuration",
"(",
"$",
"apiKey",
"?",
":",
"getenv",
"(",
"'BUGSNA... | Make a new client instance.
If you don't pass in a key, we'll try to read it from the env variables.
@param string|null $apiKey your bugsnag api key
@param string|null $endpoint your bugsnag endpoint
@param bool $default if we should register our default callbacks
@return static | [
"Make",
"a",
"new",
"client",
"instance",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L88-L100 |
bugsnag/bugsnag-php | src/Client.php | Client.makeGuzzle | public static function makeGuzzle($base = null, array $options = [])
{
$key = version_compare(ClientInterface::VERSION, '6') === 1 ? 'base_uri' : 'base_url';
$options[$key] = $base ?: static::ENDPOINT;
if ($path = static::getCaBundlePath()) {
$options['verify'] = $path;
... | php | public static function makeGuzzle($base = null, array $options = [])
{
$key = version_compare(ClientInterface::VERSION, '6') === 1 ? 'base_uri' : 'base_url';
$options[$key] = $base ?: static::ENDPOINT;
if ($path = static::getCaBundlePath()) {
$options['verify'] = $path;
... | [
"public",
"static",
"function",
"makeGuzzle",
"(",
"$",
"base",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"key",
"=",
"version_compare",
"(",
"ClientInterface",
"::",
"VERSION",
",",
"'6'",
")",
"===",
"1",
"?",
"'base_ur... | Make a new guzzle client instance.
@param string|null $base
@param array $options
@return \GuzzleHttp\ClientInterface | [
"Make",
"a",
"new",
"guzzle",
"client",
"instance",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L135-L146 |
bugsnag/bugsnag-php | src/Client.php | Client.registerDefaultCallbacks | public function registerDefaultCallbacks()
{
$this->registerCallback(new GlobalMetaData($this->config))
->registerCallback(new RequestMetaData($this->resolver))
->registerCallback(new RequestCookies($this->resolver))
->registerCallback(new RequestSession($this->resolve... | php | public function registerDefaultCallbacks()
{
$this->registerCallback(new GlobalMetaData($this->config))
->registerCallback(new RequestMetaData($this->resolver))
->registerCallback(new RequestCookies($this->resolver))
->registerCallback(new RequestSession($this->resolve... | [
"public",
"function",
"registerDefaultCallbacks",
"(",
")",
"{",
"$",
"this",
"->",
"registerCallback",
"(",
"new",
"GlobalMetaData",
"(",
"$",
"this",
"->",
"config",
")",
")",
"->",
"registerCallback",
"(",
"new",
"RequestMetaData",
"(",
"$",
"this",
"->",
... | Regsier all our default callbacks.
@return $this | [
"Regsier",
"all",
"our",
"default",
"callbacks",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L201-L211 |
bugsnag/bugsnag-php | src/Client.php | Client.leaveBreadcrumb | public function leaveBreadcrumb($name, $type = null, array $metaData = [])
{
try {
$name = (new ReflectionClass($name))->getShortName();
} catch (ReflectionException $e) {
//
}
$name = substr((string) $name, 0, Breadcrumb::MAX_LENGTH);
$type = in_arr... | php | public function leaveBreadcrumb($name, $type = null, array $metaData = [])
{
try {
$name = (new ReflectionClass($name))->getShortName();
} catch (ReflectionException $e) {
//
}
$name = substr((string) $name, 0, Breadcrumb::MAX_LENGTH);
$type = in_arr... | [
"public",
"function",
"leaveBreadcrumb",
"(",
"$",
"name",
",",
"$",
"type",
"=",
"null",
",",
"array",
"$",
"metaData",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"name",
"=",
"(",
"new",
"ReflectionClass",
"(",
"$",
"name",
")",
")",
"->",
"getSho... | Record the given breadcrumb.
@param string $name the name of the breadcrumb
@param string|null $type the type of breadcrumb
@param array $metaData additional information about the breadcrumb
@return void | [
"Record",
"the",
"given",
"breadcrumb",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L236-L249 |
bugsnag/bugsnag-php | src/Client.php | Client.notifyException | public function notifyException($throwable, callable $callback = null)
{
$report = Report::fromPHPThrowable($this->config, $throwable);
$this->notify($report, $callback);
} | php | public function notifyException($throwable, callable $callback = null)
{
$report = Report::fromPHPThrowable($this->config, $throwable);
$this->notify($report, $callback);
} | [
"public",
"function",
"notifyException",
"(",
"$",
"throwable",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"report",
"=",
"Report",
"::",
"fromPHPThrowable",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"throwable",
")",
";",
"$",
"this... | Notify Bugsnag of a non-fatal/handled throwable.
@param \Throwable $throwable the throwable to notify Bugsnag about
@param callable|null $callback the customization callback
@return void | [
"Notify",
"Bugsnag",
"of",
"a",
"non",
"-",
"fatal",
"/",
"handled",
"throwable",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L269-L274 |
bugsnag/bugsnag-php | src/Client.php | Client.notifyError | public function notifyError($name, $message, callable $callback = null)
{
$report = Report::fromNamedError($this->config, $name, $message);
$this->notify($report, $callback);
} | php | public function notifyError($name, $message, callable $callback = null)
{
$report = Report::fromNamedError($this->config, $name, $message);
$this->notify($report, $callback);
} | [
"public",
"function",
"notifyError",
"(",
"$",
"name",
",",
"$",
"message",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"report",
"=",
"Report",
"::",
"fromNamedError",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"name",
",",
"$",
"... | Notify Bugsnag of a non-fatal/handled error.
@param string $name the name of the error, a short (1 word) string
@param string $message the error message
@param callable|null $callback the customization callback
@return void | [
"Notify",
"Bugsnag",
"of",
"a",
"non",
"-",
"fatal",
"/",
"handled",
"error",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L285-L290 |
bugsnag/bugsnag-php | src/Client.php | Client.notify | public function notify(Report $report, callable $callback = null)
{
$this->pipeline->execute($report, function ($report) use ($callback) {
if ($callback) {
$resolvedReport = null;
$bridge = new CallbackBridge($callback);
$bridge($report, function ... | php | public function notify(Report $report, callable $callback = null)
{
$this->pipeline->execute($report, function ($report) use ($callback) {
if ($callback) {
$resolvedReport = null;
$bridge = new CallbackBridge($callback);
$bridge($report, function ... | [
"public",
"function",
"notify",
"(",
"Report",
"$",
"report",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"pipeline",
"->",
"execute",
"(",
"$",
"report",
",",
"function",
"(",
"$",
"report",
")",
"use",
"(",
"$",
"cal... | Notify Bugsnag of the given error report.
This may simply involve queuing it for later if we're batching.
@param \Bugsnag\Report $report the error report to send
@param callable|null $callback the customization callback
@return void | [
"Notify",
"Bugsnag",
"of",
"the",
"given",
"error",
"report",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L302-L327 |
bugsnag/bugsnag-php | src/Client.php | Client.deploy | public function deploy($repository = null, $branch = null, $revision = null)
{
$this->build($repository, $revision);
} | php | public function deploy($repository = null, $branch = null, $revision = null)
{
$this->build($repository, $revision);
} | [
"public",
"function",
"deploy",
"(",
"$",
"repository",
"=",
"null",
",",
"$",
"branch",
"=",
"null",
",",
"$",
"revision",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"build",
"(",
"$",
"repository",
",",
"$",
"revision",
")",
";",
"}"
] | Notify Bugsnag of a deployment.
@deprecated This function is being deprecated in favour of `build`.
@param string|null $repository the repository from which you are deploying the code
@param string|null $branch the source control branch from which you are deploying
@param string|null $revision the source contro... | [
"Notify",
"Bugsnag",
"of",
"a",
"deployment",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L340-L343 |
bugsnag/bugsnag-php | src/Client.php | Client.build | public function build($repository = null, $revision = null, $provider = null, $builderName = null)
{
$data = [];
if ($repository) {
$data['repository'] = $repository;
}
if ($revision) {
$data['revision'] = $revision;
}
if ($provider) {
... | php | public function build($repository = null, $revision = null, $provider = null, $builderName = null)
{
$data = [];
if ($repository) {
$data['repository'] = $repository;
}
if ($revision) {
$data['revision'] = $revision;
}
if ($provider) {
... | [
"public",
"function",
"build",
"(",
"$",
"repository",
"=",
"null",
",",
"$",
"revision",
"=",
"null",
",",
"$",
"provider",
"=",
"null",
",",
"$",
"builderName",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"repository",... | Notify Bugsnag of a build.
@param string|null $repository the repository from which you are deploying the code
@param string|null $revision the source control revision you are currently deploying
@param string|null $provider the provider of the source control for the build
@param string|null $builderName the na... | [
"Notify",
"Bugsnag",
"of",
"a",
"build",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L355-L376 |
bugsnag/bugsnag-php | src/Client.php | Client.setMetaData | public function setMetaData(array $metaData, $merge = true)
{
$this->config->setMetaData($metaData, $merge);
return $this;
} | php | public function setMetaData(array $metaData, $merge = true)
{
$this->config->setMetaData($metaData, $merge);
return $this;
} | [
"public",
"function",
"setMetaData",
"(",
"array",
"$",
"metaData",
",",
"$",
"merge",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"config",
"->",
"setMetaData",
"(",
"$",
"metaData",
",",
"$",
"merge",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set custom metadata to send to Bugsnag.
You can use this to add custom tabs of data to each error on your
Bugsnag dashboard.
@param array[] $metaData an array of arrays of custom data
@param bool $merge should we merge the meta data
@return $this | [
"Set",
"custom",
"metadata",
"to",
"send",
"to",
"Bugsnag",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Client.php#L727-L732 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.generate | public static function generate(Configuration $config)
{
// Reduce memory usage by omitting args and objects from backtrace
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS & ~DEBUG_BACKTRACE_PROVIDE_OBJECT);
return static::fromBacktrace($config, $backtrace, '[generator]', 0);
} | php | public static function generate(Configuration $config)
{
// Reduce memory usage by omitting args and objects from backtrace
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS & ~DEBUG_BACKTRACE_PROVIDE_OBJECT);
return static::fromBacktrace($config, $backtrace, '[generator]', 0);
} | [
"public",
"static",
"function",
"generate",
"(",
"Configuration",
"$",
"config",
")",
"{",
"// Reduce memory usage by omitting args and objects from backtrace",
"$",
"backtrace",
"=",
"debug_backtrace",
"(",
"DEBUG_BACKTRACE_IGNORE_ARGS",
"&",
"~",
"DEBUG_BACKTRACE_PROVIDE_OBJE... | Generate a new stacktrace using the given config.
@param \Bugsnag\Configuration $config the configuration instance
@return static | [
"Generate",
"a",
"new",
"stacktrace",
"using",
"the",
"given",
"config",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L46-L52 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.fromFrame | public static function fromFrame(Configuration $config, $file, $line)
{
$stacktrace = new static($config);
$stacktrace->addFrame($file, $line, '[unknown]');
return $stacktrace;
} | php | public static function fromFrame(Configuration $config, $file, $line)
{
$stacktrace = new static($config);
$stacktrace->addFrame($file, $line, '[unknown]');
return $stacktrace;
} | [
"public",
"static",
"function",
"fromFrame",
"(",
"Configuration",
"$",
"config",
",",
"$",
"file",
",",
"$",
"line",
")",
"{",
"$",
"stacktrace",
"=",
"new",
"static",
"(",
"$",
"config",
")",
";",
"$",
"stacktrace",
"->",
"addFrame",
"(",
"$",
"file"... | Create a new stacktrace instance from a frame.
@param \Bugsnag\Configuration $config the configuration instance
@param string $file the associated file
@param int $line the line number
@return static | [
"Create",
"a",
"new",
"stacktrace",
"instance",
"from",
"a",
"frame",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L63-L69 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.fromBacktrace | public static function fromBacktrace(Configuration $config, array $backtrace, $topFile, $topLine)
{
$stacktrace = new static($config);
// PHP backtrace's are misaligned, we need to shift the file/line down a frame
foreach ($backtrace as $frame) {
if (!static::frameInsideBugsnag(... | php | public static function fromBacktrace(Configuration $config, array $backtrace, $topFile, $topLine)
{
$stacktrace = new static($config);
// PHP backtrace's are misaligned, we need to shift the file/line down a frame
foreach ($backtrace as $frame) {
if (!static::frameInsideBugsnag(... | [
"public",
"static",
"function",
"fromBacktrace",
"(",
"Configuration",
"$",
"config",
",",
"array",
"$",
"backtrace",
",",
"$",
"topFile",
",",
"$",
"topLine",
")",
"{",
"$",
"stacktrace",
"=",
"new",
"static",
"(",
"$",
"config",
")",
";",
"// PHP backtra... | Create a new stacktrace instance from a backtrace.
@param \Bugsnag\Configuration $config the configuration instance
@param array $backtrace the associated backtrace
@param int $topFile the top file to use
@param int $topLine the top line to use
@return sta... | [
"Create",
"a",
"new",
"stacktrace",
"instance",
"from",
"a",
"backtrace",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L81-L109 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.addFrame | public function addFrame($file, $line, $method, $class = null)
{
// Account for special "filenames" in eval'd code
$matches = [];
if (preg_match("/^(.*?)\((\d+)\) : (?:eval\(\)'d code|runtime-created function)$/", $file, $matches)) {
$file = $matches[1];
$line = $matc... | php | public function addFrame($file, $line, $method, $class = null)
{
// Account for special "filenames" in eval'd code
$matches = [];
if (preg_match("/^(.*?)\((\d+)\) : (?:eval\(\)'d code|runtime-created function)$/", $file, $matches)) {
$file = $matches[1];
$line = $matc... | [
"public",
"function",
"addFrame",
"(",
"$",
"file",
",",
"$",
"line",
",",
"$",
"method",
",",
"$",
"class",
"=",
"null",
")",
"{",
"// Account for special \"filenames\" in eval'd code",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"preg_match",
"(",
"\"... | Add the given frame to the stacktrace.
@param string $file the associated file
@param int $line the line number
@param string $method the method called
@param string|null $class the associated class
@return void | [
"Add",
"the",
"given",
"frame",
"to",
"the",
"stacktrace",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L167-L194 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.removeFrame | public function removeFrame($index)
{
if (!isset($this->frames[$index])) {
throw new InvalidArgumentException('Invalid frame index to remove.');
}
array_splice($this->frames, $index, 1);
} | php | public function removeFrame($index)
{
if (!isset($this->frames[$index])) {
throw new InvalidArgumentException('Invalid frame index to remove.');
}
array_splice($this->frames, $index, 1);
} | [
"public",
"function",
"removeFrame",
"(",
"$",
"index",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"frames",
"[",
"$",
"index",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Invalid frame index to remove.'",
")",
";... | Remove the frame at the given index from the stacktrace.
@param int $index
@throws \InvalidArgumentException
@return void | [
"Remove",
"the",
"frame",
"at",
"the",
"given",
"index",
"from",
"the",
"stacktrace",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L205-L212 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.getCode | protected function getCode($path, $line, $numLines)
{
if (empty($path) || empty($line) || !file_exists($path)) {
return;
}
try {
$file = new SplFileObject($path);
$file->seek(PHP_INT_MAX);
$bounds = static::getBounds($line, $numLines, $file->... | php | protected function getCode($path, $line, $numLines)
{
if (empty($path) || empty($line) || !file_exists($path)) {
return;
}
try {
$file = new SplFileObject($path);
$file->seek(PHP_INT_MAX);
$bounds = static::getBounds($line, $numLines, $file->... | [
"protected",
"function",
"getCode",
"(",
"$",
"path",
",",
"$",
"line",
",",
"$",
"numLines",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"path",
")",
"||",
"empty",
"(",
"$",
"line",
")",
"||",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
... | Extract the code for the given file and lines.
@param string $path the path to the file
@param int $line the line to centre about
@param string $numLines the number of lines to fetch
@return string[]|null | [
"Extract",
"the",
"code",
"for",
"the",
"given",
"file",
"and",
"lines",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L223-L247 |
bugsnag/bugsnag-php | src/Stacktrace.php | Stacktrace.getBounds | protected static function getBounds($line, $num, $max)
{
$start = max($line - floor($num / 2), 1);
$end = $start + ($num - 1);
if ($end > $max) {
$end = $max;
$start = max($end - ($num - 1), 1);
}
return [$start, $end];
} | php | protected static function getBounds($line, $num, $max)
{
$start = max($line - floor($num / 2), 1);
$end = $start + ($num - 1);
if ($end > $max) {
$end = $max;
$start = max($end - ($num - 1), 1);
}
return [$start, $end];
} | [
"protected",
"static",
"function",
"getBounds",
"(",
"$",
"line",
",",
"$",
"num",
",",
"$",
"max",
")",
"{",
"$",
"start",
"=",
"max",
"(",
"$",
"line",
"-",
"floor",
"(",
"$",
"num",
"/",
"2",
")",
",",
"1",
")",
";",
"$",
"end",
"=",
"$",
... | Get the start and end positions for the given line.
@param int $line the line to centre about
@param string $num the number of lines to fetch
@param int $max the maximum line number
@return int[] | [
"Get",
"the",
"start",
"and",
"end",
"positions",
"for",
"the",
"given",
"line",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Stacktrace.php#L258-L270 |
bugsnag/bugsnag-php | src/Handler.php | Handler.register | public static function register($client = null)
{
$handler = new static($client instanceof Client ? $client : Client::make($client));
$handler->registerBugsnagHandlers(false); // don't preserve previous handlers
return $handler;
} | php | public static function register($client = null)
{
$handler = new static($client instanceof Client ? $client : Client::make($client));
$handler->registerBugsnagHandlers(false); // don't preserve previous handlers
return $handler;
} | [
"public",
"static",
"function",
"register",
"(",
"$",
"client",
"=",
"null",
")",
"{",
"$",
"handler",
"=",
"new",
"static",
"(",
"$",
"client",
"instanceof",
"Client",
"?",
"$",
"client",
":",
"Client",
"::",
"make",
"(",
"$",
"client",
")",
")",
";... | Register our handlers.
@param \Bugsnag\Client|string|null $client client instance or api key
@return static | [
"Register",
"our",
"handlers",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L35-L42 |
bugsnag/bugsnag-php | src/Handler.php | Handler.registerWithPrevious | public static function registerWithPrevious($client = null)
{
$handler = new static($client instanceof Client ? $client : Client::make($client));
$handler->registerBugsnagHandlers(true); // preserve previous handlers
return $handler;
} | php | public static function registerWithPrevious($client = null)
{
$handler = new static($client instanceof Client ? $client : Client::make($client));
$handler->registerBugsnagHandlers(true); // preserve previous handlers
return $handler;
} | [
"public",
"static",
"function",
"registerWithPrevious",
"(",
"$",
"client",
"=",
"null",
")",
"{",
"$",
"handler",
"=",
"new",
"static",
"(",
"$",
"client",
"instanceof",
"Client",
"?",
"$",
"client",
":",
"Client",
"::",
"make",
"(",
"$",
"client",
")",... | Register our handlers and preserve those previously registered.
@param \Bugsnag\Client|string|null $client client instance or api key
@return static | [
"Register",
"our",
"handlers",
"and",
"preserve",
"those",
"previously",
"registered",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L51-L58 |
bugsnag/bugsnag-php | src/Handler.php | Handler.registerBugsnagHandlers | protected function registerBugsnagHandlers($callPrevious)
{
$this->registerErrorHandler($callPrevious);
$this->registerExceptionHandler($callPrevious);
$this->registerShutdownHandler();
} | php | protected function registerBugsnagHandlers($callPrevious)
{
$this->registerErrorHandler($callPrevious);
$this->registerExceptionHandler($callPrevious);
$this->registerShutdownHandler();
} | [
"protected",
"function",
"registerBugsnagHandlers",
"(",
"$",
"callPrevious",
")",
"{",
"$",
"this",
"->",
"registerErrorHandler",
"(",
"$",
"callPrevious",
")",
";",
"$",
"this",
"->",
"registerExceptionHandler",
"(",
"$",
"callPrevious",
")",
";",
"$",
"this",... | Register our handlers, optionally saving those previously registered.
@param bool $callPrevious whether or not to call the previous handlers
@return void | [
"Register",
"our",
"handlers",
"optionally",
"saving",
"those",
"previously",
"registered",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L67-L72 |
bugsnag/bugsnag-php | src/Handler.php | Handler.exceptionHandler | public function exceptionHandler($throwable)
{
$report = Report::fromPHPThrowable(
$this->client->getConfig(),
$throwable
);
$report->setSeverity('error');
$report->setUnhandled(true);
$report->setSeverityReason([
'type' => 'unhandledExcep... | php | public function exceptionHandler($throwable)
{
$report = Report::fromPHPThrowable(
$this->client->getConfig(),
$throwable
);
$report->setSeverity('error');
$report->setUnhandled(true);
$report->setSeverityReason([
'type' => 'unhandledExcep... | [
"public",
"function",
"exceptionHandler",
"(",
"$",
"throwable",
")",
"{",
"$",
"report",
"=",
"Report",
"::",
"fromPHPThrowable",
"(",
"$",
"this",
"->",
"client",
"->",
"getConfig",
"(",
")",
",",
"$",
"throwable",
")",
";",
"$",
"report",
"->",
"setSe... | Exception handler callback.
@param \Throwable $throwable the exception was was thrown
@return void | [
"Exception",
"handler",
"callback",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L137-L158 |
bugsnag/bugsnag-php | src/Handler.php | Handler.errorHandler | public function errorHandler($errno, $errstr, $errfile = '', $errline = 0)
{
if (!$this->client->getConfig()->shouldIgnoreErrorCode($errno)) {
$report = Report::fromPHPError(
$this->client->getConfig(),
$errno,
$errstr,
$errfile,
... | php | public function errorHandler($errno, $errstr, $errfile = '', $errline = 0)
{
if (!$this->client->getConfig()->shouldIgnoreErrorCode($errno)) {
$report = Report::fromPHPError(
$this->client->getConfig(),
$errno,
$errstr,
$errfile,
... | [
"public",
"function",
"errorHandler",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
"=",
"''",
",",
"$",
"errline",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"client",
"->",
"getConfig",
"(",
")",
"->",
"shouldIgnoreErrorCo... | Error handler callback.
@param int $errno the level of the error raised
@param string $errstr the error message
@param string $errfile the filename that the error was raised in
@param int $errline the line number the error was raised at
@return bool | [
"Error",
"handler",
"callback",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L170-L204 |
bugsnag/bugsnag-php | src/Handler.php | Handler.shutdownHandler | public function shutdownHandler()
{
// Get last error
$lastError = error_get_last();
// Check if a fatal error caused this shutdown
if (!is_null($lastError) && ErrorTypes::isFatal($lastError['type']) && !$this->client->getConfig()->shouldIgnoreErrorCode($lastError['type'])) {
... | php | public function shutdownHandler()
{
// Get last error
$lastError = error_get_last();
// Check if a fatal error caused this shutdown
if (!is_null($lastError) && ErrorTypes::isFatal($lastError['type']) && !$this->client->getConfig()->shouldIgnoreErrorCode($lastError['type'])) {
... | [
"public",
"function",
"shutdownHandler",
"(",
")",
"{",
"// Get last error",
"$",
"lastError",
"=",
"error_get_last",
"(",
")",
";",
"// Check if a fatal error caused this shutdown",
"if",
"(",
"!",
"is_null",
"(",
"$",
"lastError",
")",
"&&",
"ErrorTypes",
"::",
... | Shutdown handler callback.
@return void | [
"Shutdown",
"handler",
"callback",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Handler.php#L211-L236 |
bugsnag/bugsnag-php | src/Pipeline.php | Pipeline.insertBefore | public function insertBefore(callable $pipe, $beforeClass)
{
$beforePosition = null;
foreach ($this->pipes as $index => $callable) {
$class = get_class($callable);
if ($class === $beforeClass) {
$beforePosition = $index;
break;
}
... | php | public function insertBefore(callable $pipe, $beforeClass)
{
$beforePosition = null;
foreach ($this->pipes as $index => $callable) {
$class = get_class($callable);
if ($class === $beforeClass) {
$beforePosition = $index;
break;
}
... | [
"public",
"function",
"insertBefore",
"(",
"callable",
"$",
"pipe",
",",
"$",
"beforeClass",
")",
"{",
"$",
"beforePosition",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"pipes",
"as",
"$",
"index",
"=>",
"$",
"callable",
")",
"{",
"$",
"class... | Add a pipe to the pipeline before a given class.
@param callable $pipe a new pipe to pass through
@param string $beforeClass to class to insert the pipe before
@return $this | [
"Add",
"a",
"pipe",
"to",
"the",
"pipeline",
"before",
"a",
"given",
"class",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Pipeline.php#L48-L65 |
bugsnag/bugsnag-php | src/Pipeline.php | Pipeline.execute | public function execute($passable, callable $destination)
{
$first = function ($passable) use ($destination) {
return call_user_func($destination, $passable);
};
$pipes = array_reverse($this->pipes);
return call_user_func(array_reduce($pipes, $this->getSlice(), $first),... | php | public function execute($passable, callable $destination)
{
$first = function ($passable) use ($destination) {
return call_user_func($destination, $passable);
};
$pipes = array_reverse($this->pipes);
return call_user_func(array_reduce($pipes, $this->getSlice(), $first),... | [
"public",
"function",
"execute",
"(",
"$",
"passable",
",",
"callable",
"$",
"destination",
")",
"{",
"$",
"first",
"=",
"function",
"(",
"$",
"passable",
")",
"use",
"(",
"$",
"destination",
")",
"{",
"return",
"call_user_func",
"(",
"$",
"destination",
... | Run the pipeline.
@param mixed $passable the item to send through the pipeline
@param callable $destination the final distination callback
@return mixed | [
"Run",
"the",
"pipeline",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Pipeline.php#L75-L84 |
bugsnag/bugsnag-php | src/Pipeline.php | Pipeline.getSlice | protected function getSlice()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
return call_user_func($pipe, $passable, $stack);
};
};
} | php | protected function getSlice()
{
return function ($stack, $pipe) {
return function ($passable) use ($stack, $pipe) {
return call_user_func($pipe, $passable, $stack);
};
};
} | [
"protected",
"function",
"getSlice",
"(",
")",
"{",
"return",
"function",
"(",
"$",
"stack",
",",
"$",
"pipe",
")",
"{",
"return",
"function",
"(",
"$",
"passable",
")",
"use",
"(",
"$",
"stack",
",",
"$",
"pipe",
")",
"{",
"return",
"call_user_func",
... | Get the closure that represents a slice.
@return \Closure | [
"Get",
"the",
"closure",
"that",
"represents",
"a",
"slice",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Pipeline.php#L91-L98 |
bugsnag/bugsnag-php | src/Report.php | Report.fromPHPError | public static function fromPHPError(Configuration $config, $code, $message, $file, $line, $fatal = false)
{
$report = new static($config);
$report->setPHPError($code, $message, $file, $line, $fatal)
->setUnhandled(false)
->setSeverityReason(['type' => 'handledError']);... | php | public static function fromPHPError(Configuration $config, $code, $message, $file, $line, $fatal = false)
{
$report = new static($config);
$report->setPHPError($code, $message, $file, $line, $fatal)
->setUnhandled(false)
->setSeverityReason(['type' => 'handledError']);... | [
"public",
"static",
"function",
"fromPHPError",
"(",
"Configuration",
"$",
"config",
",",
"$",
"code",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
",",
"$",
"fatal",
"=",
"false",
")",
"{",
"$",
"report",
"=",
"new",
"static",
"(",
"$",
... | Create a new report from a PHP error.
@param \Bugsnag\Configuration $config the config instance
@param int $code the error code
@param string|null $message the error message
@param string $file the error file
@param int ... | [
"Create",
"a",
"new",
"report",
"from",
"a",
"PHP",
"error",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L136-L145 |
bugsnag/bugsnag-php | src/Report.php | Report.fromPHPThrowable | public static function fromPHPThrowable(Configuration $config, $throwable)
{
$report = new static($config);
$report->setPHPThrowable($throwable)
->setUnhandled(false)
->setSeverityReason(['type' => 'handledException']);
return $report;
} | php | public static function fromPHPThrowable(Configuration $config, $throwable)
{
$report = new static($config);
$report->setPHPThrowable($throwable)
->setUnhandled(false)
->setSeverityReason(['type' => 'handledException']);
return $report;
} | [
"public",
"static",
"function",
"fromPHPThrowable",
"(",
"Configuration",
"$",
"config",
",",
"$",
"throwable",
")",
"{",
"$",
"report",
"=",
"new",
"static",
"(",
"$",
"config",
")",
";",
"$",
"report",
"->",
"setPHPThrowable",
"(",
"$",
"throwable",
")",... | Create a new report from a PHP throwable.
@param \Bugsnag\Configuration $config the config instance
@param \Throwable $throwable the throwable instance
@return static | [
"Create",
"a",
"new",
"report",
"from",
"a",
"PHP",
"throwable",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L155-L164 |
bugsnag/bugsnag-php | src/Report.php | Report.fromNamedError | public static function fromNamedError(Configuration $config, $name, $message = null)
{
$report = new static($config);
$report->setName($name)
->setMessage($message)
->setStacktrace(Stacktrace::generate($config))
->setUnhandled(false)
->setSeve... | php | public static function fromNamedError(Configuration $config, $name, $message = null)
{
$report = new static($config);
$report->setName($name)
->setMessage($message)
->setStacktrace(Stacktrace::generate($config))
->setUnhandled(false)
->setSeve... | [
"public",
"static",
"function",
"fromNamedError",
"(",
"Configuration",
"$",
"config",
",",
"$",
"name",
",",
"$",
"message",
"=",
"null",
")",
"{",
"$",
"report",
"=",
"new",
"static",
"(",
"$",
"config",
")",
";",
"$",
"report",
"->",
"setName",
"(",... | Create a new report from a named error.
@param \Bugsnag\Configuration $config the config instance
@param string $name the error name
@param string|null $message the error message
@return static | [
"Create",
"a",
"new",
"report",
"from",
"a",
"named",
"error",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L175-L186 |
bugsnag/bugsnag-php | src/Report.php | Report.setPHPThrowable | public function setPHPThrowable($throwable)
{
if (!$throwable instanceof Throwable && !$throwable instanceof Exception) {
throw new InvalidArgumentException('The throwable must implement Throwable or extend Exception.');
}
$this->setName(get_class($throwable))
->set... | php | public function setPHPThrowable($throwable)
{
if (!$throwable instanceof Throwable && !$throwable instanceof Exception) {
throw new InvalidArgumentException('The throwable must implement Throwable or extend Exception.');
}
$this->setName(get_class($throwable))
->set... | [
"public",
"function",
"setPHPThrowable",
"(",
"$",
"throwable",
")",
"{",
"if",
"(",
"!",
"$",
"throwable",
"instanceof",
"Throwable",
"&&",
"!",
"$",
"throwable",
"instanceof",
"Exception",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'The throwa... | Set the PHP throwable.
@param \Throwable $throwable the throwable instance
@throws \InvalidArgumentException
@return $this | [
"Set",
"the",
"PHP",
"throwable",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L212-L227 |
bugsnag/bugsnag-php | src/Report.php | Report.setPHPError | public function setPHPError($code, $message, $file, $line, $fatal = false)
{
if ($fatal) {
// Generating stacktrace for PHP fatal errors is not possible,
// since this code executes when the PHP process shuts down,
// rather than at the time of the crash.
//
... | php | public function setPHPError($code, $message, $file, $line, $fatal = false)
{
if ($fatal) {
// Generating stacktrace for PHP fatal errors is not possible,
// since this code executes when the PHP process shuts down,
// rather than at the time of the crash.
//
... | [
"public",
"function",
"setPHPError",
"(",
"$",
"code",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
",",
"$",
"fatal",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"fatal",
")",
"{",
"// Generating stacktrace for PHP fatal errors is not possible,",
"/... | Set the PHP error.
@param int $code the error code
@param string|null $message the error message
@param string $file the error file
@param int $line the error line
@param bool $fatal if the error was fatal
@return $this | [
"Set",
"the",
"PHP",
"error",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L240-L260 |
bugsnag/bugsnag-php | src/Report.php | Report.getSeverityReason | public function getSeverityReason()
{
if (!array_key_exists('type', $this->severityReason)) {
syslog(LOG_WARNING, 'Severity reason should always have a "type" set');
$this->severityReason['type'] = 'userSpecifiedSeverity';
}
return $this->severityReason;
} | php | public function getSeverityReason()
{
if (!array_key_exists('type', $this->severityReason)) {
syslog(LOG_WARNING, 'Severity reason should always have a "type" set');
$this->severityReason['type'] = 'userSpecifiedSeverity';
}
return $this->severityReason;
} | [
"public",
"function",
"getSeverityReason",
"(",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"'type'",
",",
"$",
"this",
"->",
"severityReason",
")",
")",
"{",
"syslog",
"(",
"LOG_WARNING",
",",
"'Severity reason should always have a \"type\" set'",
")",
";"... | Gets the severity reason.
@return array | [
"Gets",
"the",
"severity",
"reason",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L281-L289 |
bugsnag/bugsnag-php | src/Report.php | Report.setPrevious | protected function setPrevious($throwable)
{
if ($throwable) {
$this->previous = static::fromPHPThrowable($this->config, $throwable);
}
return $this;
} | php | protected function setPrevious($throwable)
{
if ($throwable) {
$this->previous = static::fromPHPThrowable($this->config, $throwable);
}
return $this;
} | [
"protected",
"function",
"setPrevious",
"(",
"$",
"throwable",
")",
"{",
"if",
"(",
"$",
"throwable",
")",
"{",
"$",
"this",
"->",
"previous",
"=",
"static",
"::",
"fromPHPThrowable",
"(",
"$",
"this",
"->",
"config",
",",
"$",
"throwable",
")",
";",
"... | Set the previous throwable.
@param \Throwable $throwable the previous throwable
@return $this | [
"Set",
"the",
"previous",
"throwable",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L342-L349 |
bugsnag/bugsnag-php | src/Report.php | Report.setName | public function setName($name)
{
if (is_scalar($name) || method_exists($name, '__toString')) {
$this->name = (string) $name;
} else {
throw new InvalidArgumentException('The name must be a string.');
}
if ($this->name === '') {
$this->name = 'Erro... | php | public function setName($name)
{
if (is_scalar($name) || method_exists($name, '__toString')) {
$this->name = (string) $name;
} else {
throw new InvalidArgumentException('The name must be a string.');
}
if ($this->name === '') {
$this->name = 'Erro... | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_scalar",
"(",
"$",
"name",
")",
"||",
"method_exists",
"(",
"$",
"name",
",",
"'__toString'",
")",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"(",
"string",
")",
"$",
"name"... | Set the error name.
@param string $name the error name
@throws \InvalidArgumentException
@return $this | [
"Set",
"the",
"error",
"name",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L360-L373 |
bugsnag/bugsnag-php | src/Report.php | Report.setMessage | public function setMessage($message)
{
if ($message === null) {
$this->message = null;
} elseif (is_scalar($message) || method_exists($message, '__toString')) {
$this->message = (string) $message;
} else {
throw new InvalidArgumentException('The message mu... | php | public function setMessage($message)
{
if ($message === null) {
$this->message = null;
} elseif (is_scalar($message) || method_exists($message, '__toString')) {
$this->message = (string) $message;
} else {
throw new InvalidArgumentException('The message mu... | [
"public",
"function",
"setMessage",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"$",
"message",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"message",
"=",
"null",
";",
"}",
"elseif",
"(",
"is_scalar",
"(",
"$",
"message",
")",
"||",
"method_exists",
"... | Set the error message.
@param string|null $message the error message
@throws \InvalidArgumentException
@return $this | [
"Set",
"the",
"error",
"message",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L394-L405 |
bugsnag/bugsnag-php | src/Report.php | Report.setSeverity | public function setSeverity($severity)
{
if (in_array($severity, ['error', 'warning', 'info', null], true)) {
$this->severity = $severity;
} else {
throw new InvalidArgumentException('The severity must be either "error", "warning", or "info".');
}
return $thi... | php | public function setSeverity($severity)
{
if (in_array($severity, ['error', 'warning', 'info', null], true)) {
$this->severity = $severity;
} else {
throw new InvalidArgumentException('The severity must be either "error", "warning", or "info".');
}
return $thi... | [
"public",
"function",
"setSeverity",
"(",
"$",
"severity",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"severity",
",",
"[",
"'error'",
",",
"'warning'",
",",
"'info'",
",",
"null",
"]",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"severity",
"=",
... | Set the error severity.
@param string|null $severity the error severity
@throws \InvalidArgumentException
@return $this | [
"Set",
"the",
"error",
"severity",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L426-L435 |
bugsnag/bugsnag-php | src/Report.php | Report.setMetaData | public function setMetaData(array $metaData, $merge = true)
{
$this->metaData = $merge ? array_merge_recursive($this->metaData, $metaData) : $metaData;
return $this;
} | php | public function setMetaData(array $metaData, $merge = true)
{
$this->metaData = $merge ? array_merge_recursive($this->metaData, $metaData) : $metaData;
return $this;
} | [
"public",
"function",
"setMetaData",
"(",
"array",
"$",
"metaData",
",",
"$",
"merge",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"metaData",
"=",
"$",
"merge",
"?",
"array_merge_recursive",
"(",
"$",
"this",
"->",
"metaData",
",",
"$",
"metaData",
")",
... | Set the error meta data.
@param array[] $metaData an array of arrays of custom data
@param bool $merge should we merge the meta data
@return $this | [
"Set",
"the",
"error",
"meta",
"data",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L503-L508 |
bugsnag/bugsnag-php | src/Report.php | Report.addMetaData | public function addMetaData(array $metadata)
{
$this->metaData = array_replace_recursive($this->metaData, $metadata);
$this->metaData = $this->removeNullElements($this->metaData);
return $this;
} | php | public function addMetaData(array $metadata)
{
$this->metaData = array_replace_recursive($this->metaData, $metadata);
$this->metaData = $this->removeNullElements($this->metaData);
return $this;
} | [
"public",
"function",
"addMetaData",
"(",
"array",
"$",
"metadata",
")",
"{",
"$",
"this",
"->",
"metaData",
"=",
"array_replace_recursive",
"(",
"$",
"this",
"->",
"metaData",
",",
"$",
"metadata",
")",
";",
"$",
"this",
"->",
"metaData",
"=",
"$",
"thi... | Adds a tab to the meta data.
Conflicting keys will be merged if able, otherwise the new values will be accepted.
Null values will be deleted from the metadata.
@param array[] $metadata an array of custom data to attach to the report
@return $this | [
"Adds",
"a",
"tab",
"to",
"the",
"meta",
"data",
".",
"Conflicting",
"keys",
"will",
"be",
"merged",
"if",
"able",
"otherwise",
"the",
"new",
"values",
"will",
"be",
"accepted",
".",
"Null",
"values",
"will",
"be",
"deleted",
"from",
"the",
"metadata",
"... | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L519-L525 |
bugsnag/bugsnag-php | src/Report.php | Report.addBreadcrumb | public function addBreadcrumb(Breadcrumb $breadcrumb)
{
$data = $breadcrumb->toArray();
if ($metaData = $this->cleanupObj($breadcrumb->getMetaData(), true)) {
$data['metaData'] = $metaData;
if (strlen(json_encode($data)) > Breadcrumb::MAX_SIZE) {
unset($data... | php | public function addBreadcrumb(Breadcrumb $breadcrumb)
{
$data = $breadcrumb->toArray();
if ($metaData = $this->cleanupObj($breadcrumb->getMetaData(), true)) {
$data['metaData'] = $metaData;
if (strlen(json_encode($data)) > Breadcrumb::MAX_SIZE) {
unset($data... | [
"public",
"function",
"addBreadcrumb",
"(",
"Breadcrumb",
"$",
"breadcrumb",
")",
"{",
"$",
"data",
"=",
"$",
"breadcrumb",
"->",
"toArray",
"(",
")",
";",
"if",
"(",
"$",
"metaData",
"=",
"$",
"this",
"->",
"cleanupObj",
"(",
"$",
"breadcrumb",
"->",
... | Add a breadcrumb to the report.
@param \Bugsnag\Breadcrumbs\Breadcrumb $breadcrumb
@return void | [
"Add",
"a",
"breadcrumb",
"to",
"the",
"report",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L568-L581 |
bugsnag/bugsnag-php | src/Report.php | Report.getSummary | public function getSummary()
{
$summary = [];
$name = $this->getName();
$message = $this->getMessage();
if ($name !== $message) {
$summary['name'] = $name;
}
$summary['message'] = $message;
$summary['severity'] = $this->getSeverity();
... | php | public function getSummary()
{
$summary = [];
$name = $this->getName();
$message = $this->getMessage();
if ($name !== $message) {
$summary['name'] = $name;
}
$summary['message'] = $message;
$summary['severity'] = $this->getSeverity();
... | [
"public",
"function",
"getSummary",
"(",
")",
"{",
"$",
"summary",
"=",
"[",
"]",
";",
"$",
"name",
"=",
"$",
"this",
"->",
"getName",
"(",
")",
";",
"$",
"message",
"=",
"$",
"this",
"->",
"getMessage",
"(",
")",
";",
"if",
"(",
"$",
"name",
"... | Get the report summary.
@return string[] | [
"Get",
"the",
"report",
"summary",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L588-L604 |
bugsnag/bugsnag-php | src/Report.php | Report.toArray | public function toArray()
{
$event = [
'app' => $this->config->getAppData(),
'device' => array_merge(['time' => $this->time], $this->config->getDeviceData()),
'user' => $this->getUser(),
'context' => $this->getContext(),
'payloadVersion' => HttpCli... | php | public function toArray()
{
$event = [
'app' => $this->config->getAppData(),
'device' => array_merge(['time' => $this->time], $this->config->getDeviceData()),
'user' => $this->getUser(),
'context' => $this->getContext(),
'payloadVersion' => HttpCli... | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"event",
"=",
"[",
"'app'",
"=>",
"$",
"this",
"->",
"config",
"->",
"getAppData",
"(",
")",
",",
"'device'",
"=>",
"array_merge",
"(",
"[",
"'time'",
"=>",
"$",
"this",
"->",
"time",
"]",
",",
"... | Get the array representation.
@return array | [
"Get",
"the",
"array",
"representation",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L621-L646 |
bugsnag/bugsnag-php | src/Report.php | Report.exceptionArray | protected function exceptionArray()
{
$exceptionArray = [$this->exceptionObject()];
$previous = $this->previous;
while ($previous) {
$exceptionArray[] = $previous->exceptionObject();
$previous = $previous->previous;
}
return $this->cleanupObj($excepti... | php | protected function exceptionArray()
{
$exceptionArray = [$this->exceptionObject()];
$previous = $this->previous;
while ($previous) {
$exceptionArray[] = $previous->exceptionObject();
$previous = $previous->previous;
}
return $this->cleanupObj($excepti... | [
"protected",
"function",
"exceptionArray",
"(",
")",
"{",
"$",
"exceptionArray",
"=",
"[",
"$",
"this",
"->",
"exceptionObject",
"(",
")",
"]",
";",
"$",
"previous",
"=",
"$",
"this",
"->",
"previous",
";",
"while",
"(",
"$",
"previous",
")",
"{",
"$",... | Get the exception array.
@return array | [
"Get",
"the",
"exception",
"array",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L653-L663 |
bugsnag/bugsnag-php | src/Report.php | Report.cleanupObj | protected function cleanupObj($obj, $isMetaData)
{
if (is_null($obj)) {
return;
}
if (is_array($obj)) {
$clean = [];
foreach ($obj as $key => $value) {
$clean[$key] = $this->shouldFilter($key, $isMetaData) ? '[FILTERED]' : $this->cleanupO... | php | protected function cleanupObj($obj, $isMetaData)
{
if (is_null($obj)) {
return;
}
if (is_array($obj)) {
$clean = [];
foreach ($obj as $key => $value) {
$clean[$key] = $this->shouldFilter($key, $isMetaData) ? '[FILTERED]' : $this->cleanupO... | [
"protected",
"function",
"cleanupObj",
"(",
"$",
"obj",
",",
"$",
"isMetaData",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"obj",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"obj",
")",
")",
"{",
"$",
"clean",
"=",
"[",
"... | Cleanup the given object.
@param mixed $obj the data to cleanup
@param bool $isMetaData if it is meta data
@return array|null | [
"Cleanup",
"the",
"given",
"object",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L687-L712 |
bugsnag/bugsnag-php | src/Report.php | Report.shouldFilter | protected function shouldFilter($key, $isMetaData)
{
if ($isMetaData) {
foreach ($this->config->getFilters() as $filter) {
if (strpos($key, $filter) !== false) {
return true;
}
}
}
return false;
} | php | protected function shouldFilter($key, $isMetaData)
{
if ($isMetaData) {
foreach ($this->config->getFilters() as $filter) {
if (strpos($key, $filter) !== false) {
return true;
}
}
}
return false;
} | [
"protected",
"function",
"shouldFilter",
"(",
"$",
"key",
",",
"$",
"isMetaData",
")",
"{",
"if",
"(",
"$",
"isMetaData",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"config",
"->",
"getFilters",
"(",
")",
"as",
"$",
"filter",
")",
"{",
"if",
"(",
... | Should we filter the given element.
@param string $key the associated key
@param bool $isMetaData if it is meta data
@return bool | [
"Should",
"we",
"filter",
"the",
"given",
"element",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L722-L733 |
bugsnag/bugsnag-php | src/Report.php | Report.removeNullElements | protected function removeNullElements($array)
{
foreach ($array as $key => $val) {
if (is_array($val)) {
$array[$key] = $this->removeNullElements($val);
} elseif (is_null($val)) {
unset($array[$key]);
}
}
return $array;
... | php | protected function removeNullElements($array)
{
foreach ($array as $key => $val) {
if (is_array($val)) {
$array[$key] = $this->removeNullElements($val);
} elseif (is_null($val)) {
unset($array[$key]);
}
}
return $array;
... | [
"protected",
"function",
"removeNullElements",
"(",
"$",
"array",
")",
"{",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"val",
")",
")",
"{",
"$",
"array",
"[",
"$",
"key",
"]",
"="... | Recursively remove null elements.
@param array $array the array to remove null elements from
@return array | [
"Recursively",
"remove",
"null",
"elements",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Report.php#L742-L753 |
bugsnag/bugsnag-php | src/Breadcrumbs/Recorder.php | Recorder.record | public function record(Breadcrumb $breadcrumb)
{
// advance the head by one if we've caught up
if ($this->breadcrumbs && $this->pointer === $this->head) {
$this->head = ($this->head + 1) % static::MAX_ITEMS;
}
// record the new breadcrumb
$this->breadcrumbs[$this... | php | public function record(Breadcrumb $breadcrumb)
{
// advance the head by one if we've caught up
if ($this->breadcrumbs && $this->pointer === $this->head) {
$this->head = ($this->head + 1) % static::MAX_ITEMS;
}
// record the new breadcrumb
$this->breadcrumbs[$this... | [
"public",
"function",
"record",
"(",
"Breadcrumb",
"$",
"breadcrumb",
")",
"{",
"// advance the head by one if we've caught up",
"if",
"(",
"$",
"this",
"->",
"breadcrumbs",
"&&",
"$",
"this",
"->",
"pointer",
"===",
"$",
"this",
"->",
"head",
")",
"{",
"$",
... | Record a breadcrumb.
We're recording a maximum of 25 breadcrumbs. Once we've recorded 25, we
start wrapping back around and replacing the earlier ones. In order to
indicate the start of the list, we advance a head pointer.
@param \Bugsnag\Breadcrumbs\Breadcrumb $breadcrumb
@return void | [
"Record",
"a",
"breadcrumb",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Breadcrumbs/Recorder.php#L56-L68 |
bugsnag/bugsnag-php | src/HttpClient.php | HttpClient.deploy | public function deploy(array $data)
{
$app = $this->config->getAppData();
$data['releaseStage'] = $app['releaseStage'];
if (isset($app['version'])) {
$data['appVersion'] = $app['version'];
}
$data['apiKey'] = $this->config->getApiKey();
$this->guzzle->... | php | public function deploy(array $data)
{
$app = $this->config->getAppData();
$data['releaseStage'] = $app['releaseStage'];
if (isset($app['version'])) {
$data['appVersion'] = $app['version'];
}
$data['apiKey'] = $this->config->getApiKey();
$this->guzzle->... | [
"public",
"function",
"deploy",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"config",
"->",
"getAppData",
"(",
")",
";",
"$",
"data",
"[",
"'releaseStage'",
"]",
"=",
"$",
"app",
"[",
"'releaseStage'",
"]",
";",
"if",
"... | Notify Bugsnag of a deployment.
@deprecated This method should no longer be used in favour of sendBuildReport.
@param array $data the deployment information
@return void | [
"Notify",
"Bugsnag",
"of",
"a",
"deployment",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/HttpClient.php#L81-L94 |
bugsnag/bugsnag-php | src/HttpClient.php | HttpClient.sendBuildReport | public function sendBuildReport(array $buildInfo)
{
$app = $this->config->getAppData();
$data = [];
$sourceControl = [];
if (isset($app['version'])) {
$data['appVersion'] = $app['version'];
} else {
error_log('Bugsnag Warning: App version is not set.... | php | public function sendBuildReport(array $buildInfo)
{
$app = $this->config->getAppData();
$data = [];
$sourceControl = [];
if (isset($app['version'])) {
$data['appVersion'] = $app['version'];
} else {
error_log('Bugsnag Warning: App version is not set.... | [
"public",
"function",
"sendBuildReport",
"(",
"array",
"$",
"buildInfo",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"config",
"->",
"getAppData",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"sourceControl",
"=",
"[",
"]",
";",
"if",
"("... | Notify Bugsnag of a build.
@param array $buildInfo the build information
@return void | [
"Notify",
"Bugsnag",
"of",
"a",
"build",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/HttpClient.php#L103-L153 |
bugsnag/bugsnag-php | src/HttpClient.php | HttpClient.build | protected function build()
{
$events = [];
foreach ($this->queue as $report) {
$event = $report->toArray();
if ($event) {
$events[] = $event;
}
}
return [
'apiKey' => $this->config->getApiKey(),
'notifier'... | php | protected function build()
{
$events = [];
foreach ($this->queue as $report) {
$event = $report->toArray();
if ($event) {
$events[] = $event;
}
}
return [
'apiKey' => $this->config->getApiKey(),
'notifier'... | [
"protected",
"function",
"build",
"(",
")",
"{",
"$",
"events",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"queue",
"as",
"$",
"report",
")",
"{",
"$",
"event",
"=",
"$",
"report",
"->",
"toArray",
"(",
")",
";",
"if",
"(",
"$",
"ev... | Build the request data to send.
@return array | [
"Build",
"the",
"request",
"data",
"to",
"send",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/HttpClient.php#L176-L193 |
bugsnag/bugsnag-php | src/HttpClient.php | HttpClient.postJSON | protected function postJSON($url, $data)
{
// Try to send the whole lot, or without the meta data for the first
// event. If failed, try to send the first event, and then the rest of
// them, recursively. Decrease by a constant and concquer if you like.
// Note that the base case is ... | php | protected function postJSON($url, $data)
{
// Try to send the whole lot, or without the meta data for the first
// event. If failed, try to send the first event, and then the rest of
// them, recursively. Decrease by a constant and concquer if you like.
// Note that the base case is ... | [
"protected",
"function",
"postJSON",
"(",
"$",
"url",
",",
"$",
"data",
")",
"{",
"// Try to send the whole lot, or without the meta data for the first",
"// event. If failed, try to send the first event, and then the rest of",
"// them, recursively. Decrease by a constant and concquer if ... | Post the given data to Bugsnag in json form.
@param string $url the url to hit
@param array $data the data send
@return void | [
"Post",
"the",
"given",
"data",
"to",
"Bugsnag",
"in",
"json",
"form",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/HttpClient.php#L217-L247 |
bugsnag/bugsnag-php | src/HttpClient.php | HttpClient.normalize | protected function normalize(array $data)
{
$body = json_encode($data);
if ($this->length($body) > static::MAX_SIZE) {
unset($data['events'][0]['metaData']);
}
$body = json_encode($data);
if ($this->length($body) > static::MAX_SIZE) {
throw new Runt... | php | protected function normalize(array $data)
{
$body = json_encode($data);
if ($this->length($body) > static::MAX_SIZE) {
unset($data['events'][0]['metaData']);
}
$body = json_encode($data);
if ($this->length($body) > static::MAX_SIZE) {
throw new Runt... | [
"protected",
"function",
"normalize",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"body",
"=",
"json_encode",
"(",
"$",
"data",
")",
";",
"if",
"(",
"$",
"this",
"->",
"length",
"(",
"$",
"body",
")",
">",
"static",
"::",
"MAX_SIZE",
")",
"{",
"unset... | Normalize the given data to ensure it's the correct size.
@param array $data the data to normalize
@throws \RuntimeException
@return array | [
"Normalize",
"the",
"given",
"data",
"to",
"ensure",
"it",
"s",
"the",
"correct",
"size",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/HttpClient.php#L258-L273 |
bugsnag/bugsnag-php | src/Utils.php | Utils.functionAvailable | public static function functionAvailable($func)
{
$disabled = explode(',', ini_get('disable_functions'));
return function_exists($func) && !in_array($func, $disabled);
} | php | public static function functionAvailable($func)
{
$disabled = explode(',', ini_get('disable_functions'));
return function_exists($func) && !in_array($func, $disabled);
} | [
"public",
"static",
"function",
"functionAvailable",
"(",
"$",
"func",
")",
"{",
"$",
"disabled",
"=",
"explode",
"(",
"','",
",",
"ini_get",
"(",
"'disable_functions'",
")",
")",
";",
"return",
"function_exists",
"(",
"$",
"func",
")",
"&&",
"!",
"in_arra... | Checks whether the given function name is available.
@param string $func the function name
@return bool | [
"Checks",
"whether",
"the",
"given",
"function",
"name",
"is",
"available",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Utils.php#L14-L19 |
bugsnag/bugsnag-php | src/Utils.php | Utils.getBuilderName | public static function getBuilderName()
{
$builderName = null;
if (self::functionAvailable('exec')) {
$output = [];
$success = 0;
exec('whoami', $output, $success);
if ($success == 0) {
$builderName = $output[0];
}
}... | php | public static function getBuilderName()
{
$builderName = null;
if (self::functionAvailable('exec')) {
$output = [];
$success = 0;
exec('whoami', $output, $success);
if ($success == 0) {
$builderName = $output[0];
}
}... | [
"public",
"static",
"function",
"getBuilderName",
"(",
")",
"{",
"$",
"builderName",
"=",
"null",
";",
"if",
"(",
"self",
"::",
"functionAvailable",
"(",
"'exec'",
")",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"$",
"success",
"=",
"0",
";",
"exec... | Gets the current user's identity for build reporting.
@return string | [
"Gets",
"the",
"current",
"user",
"s",
"identity",
"for",
"build",
"reporting",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Utils.php#L26-L42 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.shouldNotify | public function shouldNotify()
{
if (!$this->notifyReleaseStages) {
return true;
}
return in_array($this->getAppData()['releaseStage'], $this->notifyReleaseStages, true);
} | php | public function shouldNotify()
{
if (!$this->notifyReleaseStages) {
return true;
}
return in_array($this->getAppData()['releaseStage'], $this->notifyReleaseStages, true);
} | [
"public",
"function",
"shouldNotify",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"notifyReleaseStages",
")",
"{",
"return",
"true",
";",
"}",
"return",
"in_array",
"(",
"$",
"this",
"->",
"getAppData",
"(",
")",
"[",
"'releaseStage'",
"]",
",",
... | Should we notify Bugsnag based on the current release stage?
@return bool | [
"Should",
"we",
"notify",
"Bugsnag",
"based",
"on",
"the",
"current",
"release",
"stage?"
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L220-L227 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.setProjectRoot | public function setProjectRoot($projectRoot)
{
$projectRootRegex = $projectRoot ? '/^'.preg_quote($projectRoot, '/').'[\\/]?/i' : null;
$this->setProjectRootRegex($projectRootRegex);
} | php | public function setProjectRoot($projectRoot)
{
$projectRootRegex = $projectRoot ? '/^'.preg_quote($projectRoot, '/').'[\\/]?/i' : null;
$this->setProjectRootRegex($projectRootRegex);
} | [
"public",
"function",
"setProjectRoot",
"(",
"$",
"projectRoot",
")",
"{",
"$",
"projectRootRegex",
"=",
"$",
"projectRoot",
"?",
"'/^'",
".",
"preg_quote",
"(",
"$",
"projectRoot",
",",
"'/'",
")",
".",
"'[\\\\/]?/i'",
":",
"null",
";",
"$",
"this",
"->",... | Set the project root.
@param string|null $projectRoot the project root path
@return void | [
"Set",
"the",
"project",
"root",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L262-L266 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.setProjectRootRegex | public function setProjectRootRegex($projectRootRegex)
{
if ($projectRootRegex && @preg_match($projectRootRegex, null) === false) {
throw new InvalidArgumentException('Invalid project root regex: '.$projectRootRegex);
}
$this->projectRootRegex = $projectRootRegex;
$this-... | php | public function setProjectRootRegex($projectRootRegex)
{
if ($projectRootRegex && @preg_match($projectRootRegex, null) === false) {
throw new InvalidArgumentException('Invalid project root regex: '.$projectRootRegex);
}
$this->projectRootRegex = $projectRootRegex;
$this-... | [
"public",
"function",
"setProjectRootRegex",
"(",
"$",
"projectRootRegex",
")",
"{",
"if",
"(",
"$",
"projectRootRegex",
"&&",
"@",
"preg_match",
"(",
"$",
"projectRootRegex",
",",
"null",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException"... | Set the project root regex.
@param string|null $projectRootRegex the project root path
@return void | [
"Set",
"the",
"project",
"root",
"regex",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L275-L283 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.setStripPath | public function setStripPath($stripPath)
{
$stripPathRegex = $stripPath ? '/^'.preg_quote($stripPath, '/').'[\\/]?/i' : null;
$this->setStripPathRegex($stripPathRegex);
} | php | public function setStripPath($stripPath)
{
$stripPathRegex = $stripPath ? '/^'.preg_quote($stripPath, '/').'[\\/]?/i' : null;
$this->setStripPathRegex($stripPathRegex);
} | [
"public",
"function",
"setStripPath",
"(",
"$",
"stripPath",
")",
"{",
"$",
"stripPathRegex",
"=",
"$",
"stripPath",
"?",
"'/^'",
".",
"preg_quote",
"(",
"$",
"stripPath",
",",
"'/'",
")",
".",
"'[\\\\/]?/i'",
":",
"null",
";",
"$",
"this",
"->",
"setStr... | Set the strip path.
@param string|null $stripPath the absolute strip path
@return void | [
"Set",
"the",
"strip",
"path",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L304-L308 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.setStripPathRegex | public function setStripPathRegex($stripPathRegex)
{
if ($stripPathRegex && @preg_match($stripPathRegex, null) === false) {
throw new InvalidArgumentException('Invalid strip path regex: '.$stripPathRegex);
}
$this->stripPathRegex = $stripPathRegex;
} | php | public function setStripPathRegex($stripPathRegex)
{
if ($stripPathRegex && @preg_match($stripPathRegex, null) === false) {
throw new InvalidArgumentException('Invalid strip path regex: '.$stripPathRegex);
}
$this->stripPathRegex = $stripPathRegex;
} | [
"public",
"function",
"setStripPathRegex",
"(",
"$",
"stripPathRegex",
")",
"{",
"if",
"(",
"$",
"stripPathRegex",
"&&",
"@",
"preg_match",
"(",
"$",
"stripPathRegex",
",",
"null",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",... | Set the regular expression used to strip paths from stacktraces.
@param string|null $stripPathRegex
@return void | [
"Set",
"the",
"regular",
"expression",
"used",
"to",
"strip",
"paths",
"from",
"stacktraces",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L317-L324 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.getHostname | protected function getHostname()
{
$disabled = explode(',', ini_get('disable_functions'));
if (function_exists('php_uname') && !in_array('php_uname', $disabled, true)) {
return ['hostname' => php_uname('n')];
}
if (function_exists('gethostname') && !in_array('gethostnam... | php | protected function getHostname()
{
$disabled = explode(',', ini_get('disable_functions'));
if (function_exists('php_uname') && !in_array('php_uname', $disabled, true)) {
return ['hostname' => php_uname('n')];
}
if (function_exists('gethostname') && !in_array('gethostnam... | [
"protected",
"function",
"getHostname",
"(",
")",
"{",
"$",
"disabled",
"=",
"explode",
"(",
"','",
",",
"ini_get",
"(",
"'disable_functions'",
")",
")",
";",
"if",
"(",
"function_exists",
"(",
"'php_uname'",
")",
"&&",
"!",
"in_array",
"(",
"'php_uname'",
... | Get the hostname if possible.
@return array | [
"Get",
"the",
"hostname",
"if",
"possible",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L491-L504 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.shouldIgnoreErrorCode | public function shouldIgnoreErrorCode($code)
{
if (isset($this->errorReportingLevel)) {
return !($this->errorReportingLevel & $code);
}
return !(error_reporting() & $code);
} | php | public function shouldIgnoreErrorCode($code)
{
if (isset($this->errorReportingLevel)) {
return !($this->errorReportingLevel & $code);
}
return !(error_reporting() & $code);
} | [
"public",
"function",
"shouldIgnoreErrorCode",
"(",
"$",
"code",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"errorReportingLevel",
")",
")",
"{",
"return",
"!",
"(",
"$",
"this",
"->",
"errorReportingLevel",
"&",
"$",
"code",
")",
";",
"}",
... | Should we ignore the given error code?
@param int $code the error code
@return bool | [
"Should",
"we",
"ignore",
"the",
"given",
"error",
"code?"
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L558-L565 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.setSessionEndpoint | public function setSessionEndpoint($endpoint)
{
$this->sessionEndpoint = $endpoint;
$this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
return $this;
} | php | public function setSessionEndpoint($endpoint)
{
$this->sessionEndpoint = $endpoint;
$this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
return $this;
} | [
"public",
"function",
"setSessionEndpoint",
"(",
"$",
"endpoint",
")",
"{",
"$",
"this",
"->",
"sessionEndpoint",
"=",
"$",
"endpoint",
";",
"$",
"this",
"->",
"sessionClient",
"=",
"Client",
"::",
"makeGuzzle",
"(",
"$",
"this",
"->",
"sessionEndpoint",
")"... | Set session delivery endpoint.
@param string $endpoint the session endpoint
@return $this | [
"Set",
"session",
"delivery",
"endpoint",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L588-L595 |
bugsnag/bugsnag-php | src/Configuration.php | Configuration.getSessionClient | public function getSessionClient()
{
if (is_null($this->sessionClient)) {
$this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
}
return $this->sessionClient;
} | php | public function getSessionClient()
{
if (is_null($this->sessionClient)) {
$this->sessionClient = Client::makeGuzzle($this->sessionEndpoint);
}
return $this->sessionClient;
} | [
"public",
"function",
"getSessionClient",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"sessionClient",
")",
")",
"{",
"$",
"this",
"->",
"sessionClient",
"=",
"Client",
"::",
"makeGuzzle",
"(",
"$",
"this",
"->",
"sessionEndpoint",
")",
... | Get the session client.
@return \Guzzle\ClientInterface | [
"Get",
"the",
"session",
"client",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Configuration.php#L602-L609 |
bugsnag/bugsnag-php | src/Request/ConsoleRequest.php | ConsoleRequest.getMetaData | public function getMetaData()
{
if (count($this->command) == 0) {
return ['console' => [
'Command' => 'Command could not be retrieved', ],
];
}
$commandString = implode(' ', $this->command);
$primaryCommand = $this->command[0];
$argumen... | php | public function getMetaData()
{
if (count($this->command) == 0) {
return ['console' => [
'Command' => 'Command could not be retrieved', ],
];
}
$commandString = implode(' ', $this->command);
$primaryCommand = $this->command[0];
$argumen... | [
"public",
"function",
"getMetaData",
"(",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"command",
")",
"==",
"0",
")",
"{",
"return",
"[",
"'console'",
"=>",
"[",
"'Command'",
"=>",
"'Command could not be retrieved'",
",",
"]",
",",
"]",
";",
... | Get the request formatted as meta data.
@return array | [
"Get",
"the",
"request",
"formatted",
"as",
"meta",
"data",
"."
] | train | https://github.com/bugsnag/bugsnag-php/blob/ffcb6d5504e762db4e1636864c8b830b60878245/src/Request/ConsoleRequest.php#L61-L87 |
aporat/store-receipt-validator | src/Amazon/PurchaseItem.php | PurchaseItem.parseJsonResponse | public function parseJsonResponse(): self
{
$jsonResponse = $this->_response;
if (!is_array($jsonResponse)) {
throw new RuntimeException('Response must be a scalar value');
}
if (array_key_exists('quantity', $jsonResponse)) {
$this->_quantity = $jsonResponse[... | php | public function parseJsonResponse(): self
{
$jsonResponse = $this->_response;
if (!is_array($jsonResponse)) {
throw new RuntimeException('Response must be a scalar value');
}
if (array_key_exists('quantity', $jsonResponse)) {
$this->_quantity = $jsonResponse[... | [
"public",
"function",
"parseJsonResponse",
"(",
")",
":",
"self",
"{",
"$",
"jsonResponse",
"=",
"$",
"this",
"->",
"_response",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"jsonResponse",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Response m... | Parse JSON Response.
@return PurchaseItem
@throws RunTimeException | [
"Parse",
"JSON",
"Response",
"."
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/Amazon/PurchaseItem.php#L136-L170 |
aporat/store-receipt-validator | src/iTunes/PurchaseItem.php | PurchaseItem.parseData | public function parseData(): self
{
if (!is_array($this->raw_data)) {
throw new RuntimeException('Response must be an array');
}
if (array_key_exists('quantity', $this->raw_data)) {
$this->quantity = (int)$this->raw_data['quantity'];
}
if (array_key_... | php | public function parseData(): self
{
if (!is_array($this->raw_data)) {
throw new RuntimeException('Response must be an array');
}
if (array_key_exists('quantity', $this->raw_data)) {
$this->quantity = (int)$this->raw_data['quantity'];
}
if (array_key_... | [
"public",
"function",
"parseData",
"(",
")",
":",
"self",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"raw_data",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Response must be an array'",
")",
";",
"}",
"if",
"(",
"array_key_exist... | Parse Data from JSON Response.
@return $this
@throws RunTimeException | [
"Parse",
"Data",
"from",
"JSON",
"Response",
"."
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/iTunes/PurchaseItem.php#L115-L179 |
aporat/store-receipt-validator | src/Amazon/Validator.php | Validator.getClient | protected function getClient(): HttpClient
{
if ($this->_client == null) {
$this->_client = new HttpClient(['base_uri' => $this->_endpoint]);
}
return $this->_client;
} | php | protected function getClient(): HttpClient
{
if ($this->_client == null) {
$this->_client = new HttpClient(['base_uri' => $this->_endpoint]);
}
return $this->_client;
} | [
"protected",
"function",
"getClient",
"(",
")",
":",
"HttpClient",
"{",
"if",
"(",
"$",
"this",
"->",
"_client",
"==",
"null",
")",
"{",
"$",
"this",
"->",
"_client",
"=",
"new",
"HttpClient",
"(",
"[",
"'base_uri'",
"=>",
"$",
"this",
"->",
"_endpoint... | returns the Guzzle client.
@return HttpClient | [
"returns",
"the",
"Guzzle",
"client",
"."
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/Amazon/Validator.php#L140-L147 |
aporat/store-receipt-validator | src/Amazon/Validator.php | Validator.validate | public function validate()
{
try {
$httpResponse = $this->getClient()->request(
'GET',
sprintf("developer/%s/user/%s/receiptId/%s", $this->_developerSecret, $this->_userId, $this->_receiptId)
);
return new Response($httpResponse->getStatus... | php | public function validate()
{
try {
$httpResponse = $this->getClient()->request(
'GET',
sprintf("developer/%s/user/%s/receiptId/%s", $this->_developerSecret, $this->_userId, $this->_receiptId)
);
return new Response($httpResponse->getStatus... | [
"public",
"function",
"validate",
"(",
")",
"{",
"try",
"{",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"getClient",
"(",
")",
"->",
"request",
"(",
"'GET'",
",",
"sprintf",
"(",
"\"developer/%s/user/%s/receiptId/%s\"",
",",
"$",
"this",
"->",
"_developerS... | validate the receipt data.
@throws RunTimeException
@throws \GuzzleHttp\Exception\GuzzleException
@return Response | [
"validate",
"the",
"receipt",
"data",
"."
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/Amazon/Validator.php#L157-L175 |
aporat/store-receipt-validator | src/iTunes/PendingRenewalInfo.php | PendingRenewalInfo.parseData | public function parseData(): self
{
if (!is_array($this->raw_data)) {
throw new RunTimeException('Response must be a scalar value');
}
$this->product_id = $this->raw_data['product_id'];
$this->original_transaction_id = $this->raw_data['original_transaction_id'];
... | php | public function parseData(): self
{
if (!is_array($this->raw_data)) {
throw new RunTimeException('Response must be a scalar value');
}
$this->product_id = $this->raw_data['product_id'];
$this->original_transaction_id = $this->raw_data['original_transaction_id'];
... | [
"public",
"function",
"parseData",
"(",
")",
":",
"self",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"raw_data",
")",
")",
"{",
"throw",
"new",
"RunTimeException",
"(",
"'Response must be a scalar value'",
")",
";",
"}",
"$",
"this",
"->",
... | Parse Data from JSON Response
@return $this
@throws RunTimeException | [
"Parse",
"Data",
"from",
"JSON",
"Response"
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/iTunes/PendingRenewalInfo.php#L117-L137 |
aporat/store-receipt-validator | src/iTunes/PendingRenewalInfo.php | PendingRenewalInfo.getStatus | public function getStatus(): ?string
{
// Active when no expiration intent
if (null === $this->expiration_intent) {
return $this::STATUS_ACTIVE;
}
// Pending when retrying
if ($this::RETRY_PERIOD_ACTIVE === $this->is_in_billing_retry_period) {
return ... | php | public function getStatus(): ?string
{
// Active when no expiration intent
if (null === $this->expiration_intent) {
return $this::STATUS_ACTIVE;
}
// Pending when retrying
if ($this::RETRY_PERIOD_ACTIVE === $this->is_in_billing_retry_period) {
return ... | [
"public",
"function",
"getStatus",
"(",
")",
":",
"?",
"string",
"{",
"// Active when no expiration intent",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"expiration_intent",
")",
"{",
"return",
"$",
"this",
"::",
"STATUS_ACTIVE",
";",
"}",
"// Pending when retr... | Status of Pending Renewal
This is a computed property that assumes a particular status based on
contextual information.
@return string|null | [
"Status",
"of",
"Pending",
"Renewal"
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/iTunes/PendingRenewalInfo.php#L205-L223 |
aporat/store-receipt-validator | src/Amazon/Response.php | Response.parseJsonResponse | public function parseJsonResponse($jsonResponse = null): self
{
if (!is_array($jsonResponse)) {
throw new RuntimeException('Response must be a scalar value');
}
$this->_receipt = $jsonResponse;
$this->_purchases = [];
$this->_purchases[] = new PurchaseItem($jsonR... | php | public function parseJsonResponse($jsonResponse = null): self
{
if (!is_array($jsonResponse)) {
throw new RuntimeException('Response must be a scalar value');
}
$this->_receipt = $jsonResponse;
$this->_purchases = [];
$this->_purchases[] = new PurchaseItem($jsonR... | [
"public",
"function",
"parseJsonResponse",
"(",
"$",
"jsonResponse",
"=",
"null",
")",
":",
"self",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"jsonResponse",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"'Response must be a scalar value'",
")",
";"... | Parse JSON Response.
@param array|null $jsonResponse
@return $this
@throws RunTimeException | [
"Parse",
"JSON",
"Response",
"."
] | train | https://github.com/aporat/store-receipt-validator/blob/5cbfb1ad00899abb0cfbf5e324a4595f82c4f51f/src/Amazon/Response.php#L118-L129 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.