idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
48,500
private function getStdSeparatedName ( ) { if ( $ this -> schema && $ this -> getBuildProperty ( 'generator.schema.autoPrefix' ) ) { return $ this -> schema . NameGeneratorInterface :: STD_SEPARATOR_CHAR . $ this -> getCommonName ( ) ; } return $ this -> getCommonName ( ) ; }
Returns a qualified name of this table with scheme and common name separated by _ .
48,501
public function applyBehaviors ( ) { foreach ( $ this -> behaviors as $ behavior ) { if ( ! $ behavior -> isTableModified ( ) ) { $ behavior -> getTableModifier ( ) -> modifyTable ( ) ; $ behavior -> setTableModified ( true ) ; } } }
Executes behavior table modifiers .
48,502
private function doHeavyIndexing ( ) { $ pk = $ this -> getPrimaryKey ( ) ; $ size = count ( $ pk ) ; for ( $ i = 1 ; $ i < $ size ; $ i ++ ) { $ idx = new Index ( ) ; $ idx -> setColumns ( array_slice ( $ pk , $ i , $ size ) ) ; $ this -> addIndex ( $ idx ) ; } }
Adds extra indices for multi - part primary key columns .
48,503
protected function createIndex ( $ name , array $ columns ) { $ index = new Index ( $ name ) ; $ index -> setColumns ( $ columns ) ; $ index -> resetColumnsSize ( ) ; $ this -> addIndex ( $ index ) ; return $ index ; }
Creates a new index .
48,504
public function getBaseClass ( ) { if ( $ this -> isAlias ( ) && null === $ this -> baseClass ) { return $ this -> alias ; } if ( null === $ this -> baseClass ) { return $ this -> database -> getBaseClass ( ) ; } return $ this -> baseClass ; }
Returns the name of the base class used for superclass of all objects of this table .
48,505
public function addColumn ( $ col ) { if ( $ col instanceof Column ) { if ( isset ( $ this -> columnsByName [ $ col -> getName ( ) ] ) ) { throw new EngineException ( sprintf ( 'Column "%s" declared twice in table "%s"' , $ col -> getName ( ) , $ this -> getName ( ) ) ) ; } $ col -> setTable ( $ this ) ; if ( $ col -> ...
Adds a new column to the table .
48,506
public function removeColumn ( $ column ) { if ( is_string ( $ column ) ) { $ column = $ this -> getColumn ( $ column ) ; } $ pos = $ this -> getColumnPosition ( $ column ) ; if ( false === $ pos ) { throw new EngineException ( sprintf ( 'No column named %s found in table %s.' , $ column -> getName ( ) , $ this -> getN...
Removes a column from the table .
48,507
public function addForeignKey ( $ foreignKey ) { if ( $ foreignKey instanceof ForeignKey ) { $ fk = $ foreignKey ; $ fk -> setTable ( $ this ) ; $ name = $ fk -> getPhpName ( ) ? : $ fk -> getName ( ) ; if ( isset ( $ this -> foreignKeysByName [ $ name ] ) ) { throw new EngineException ( sprintf ( 'Foreign key "%s" dec...
Adds a new foreign key to this table .
48,508
public function getChildrenNames ( ) { if ( null === $ this -> inheritanceColumn || ! $ this -> inheritanceColumn -> isEnumeratedClasses ( ) ) { return null ; } $ names = [ ] ; foreach ( $ this -> inheritanceColumn -> getChildren ( ) as $ child ) { $ names [ ] = get_class ( $ child ) ; } return $ names ; }
Returns the subclasses that can be created from this table .
48,509
public function getCrossFks ( ) { $ crossFks = [ ] ; foreach ( $ this -> referrers as $ refFK ) { if ( $ refFK -> getTable ( ) -> isCrossRef ( ) ) { $ crossFK = new CrossForeignKeys ( $ refFK , $ this ) ; foreach ( $ refFK -> getOtherFks ( ) as $ fk ) { if ( $ fk -> isAtLeastOneLocalPrimaryKeyIsRequired ( ) && $ crossF...
Returns the list of cross foreign keys .
48,510
public function addIdMethodParameter ( $ idMethodParameter ) { if ( $ idMethodParameter instanceof IdMethodParameter ) { $ idMethodParameter -> setTable ( $ this ) ; $ this -> idMethodParameters [ ] = $ idMethodParameter ; return $ idMethodParameter ; } $ imp = new IdMethodParameter ( ) ; $ imp -> setTable ( $ this ) ;...
Adds a new parameter for the strategy that generates primary keys .
48,511
public function hasIndex ( $ name ) { foreach ( $ this -> indices as $ idx ) { if ( $ idx -> getName ( ) == $ name ) { return true ; } } return false ; }
Checks if the table has a index by name .
48,512
public function addIndex ( $ index ) { if ( $ index instanceof Index ) { if ( $ this -> hasIndex ( $ index -> getName ( ) ) ) { throw new InvalidArgumentException ( sprintf ( 'Index "%s" already exist.' , $ index -> getName ( ) ) ) ; } if ( ! $ index -> getColumns ( ) ) { throw new InvalidArgumentException ( sprintf ( ...
Adds a new index to the indices list and set the parent table of the column to the current table .
48,513
public function addUnique ( $ unique ) { if ( $ unique instanceof Unique ) { $ unique -> setTable ( $ this ) ; $ unique -> getName ( ) ; $ this -> unices [ ] = $ unique ; return $ unique ; } $ unik = new Unique ( ) ; $ unik -> loadMapping ( $ unique ) ; return $ this -> addUnique ( $ unik ) ; }
Adds a new Unique index to the list of unique indices and set the parent table of the column to the current table .
48,514
public function getAdditionalBuilders ( ) { $ additionalBuilders = [ ] ; foreach ( $ this -> behaviors as $ behavior ) { $ additionalBuilders = array_merge ( $ additionalBuilders , $ behavior -> getAdditionalBuilders ( ) ) ; } return $ additionalBuilders ; }
Returns the list of additional builders provided by the table behaviors .
48,515
private function hasSchema ( ) { return $ this -> database && ( $ this -> schema ? : $ this -> database -> getSchema ( ) ) && ( $ platform = $ this -> getPlatform ( ) ) && $ platform -> supportsSchemas ( ) ; }
Returns whether or not this table is linked to a schema .
48,516
public function getPhpName ( ) { if ( null === $ this -> phpName ) { $ this -> phpName = $ this -> buildPhpName ( $ this -> getStdSeparatedName ( ) ) ; } return $ this -> phpName ; }
Returns the name to use in PHP sources .
48,517
public function getNumLazyLoadColumns ( ) { $ count = 0 ; foreach ( $ this -> columns as $ col ) { if ( $ col -> isLazyLoad ( ) ) { $ count ++ ; } } return $ count ; }
Returns the number of lazy loaded columns in this table .
48,518
public function hasColumn ( $ column , $ caseInsensitive = false ) { if ( $ column instanceof Column ) { $ column = $ column -> getName ( ) ; } if ( $ caseInsensitive ) { return isset ( $ this -> columnsByLowercaseName [ strtolower ( $ column ) ] ) ; } return isset ( $ this -> columnsByName [ $ column ] ) ; }
Returns whether or not the table has a column .
48,519
public function getColumn ( $ name , $ caseInsensitive = false ) { if ( ! $ this -> hasColumn ( $ name , $ caseInsensitive ) ) { return null ; } if ( $ caseInsensitive ) { return $ this -> columnsByLowercaseName [ strtolower ( $ name ) ] ; } return $ this -> columnsByName [ $ name ] ; }
Returns the Column object with the specified name .
48,520
public function getColumnByPhpName ( $ phpName ) { if ( isset ( $ this -> columnsByPhpName [ $ phpName ] ) ) { return $ this -> columnsByPhpName [ $ phpName ] ; } return null ; }
Returns a specified column by its php name .
48,521
public function getForeignKeysReferencingTable ( $ tableName ) { $ matches = [ ] ; foreach ( $ this -> foreignKeys as $ fk ) { if ( $ fk -> getForeignTableName ( ) === $ tableName ) { $ matches [ ] = $ fk ; } } return $ matches ; }
Returns all foreign keys from this table that reference the table passed in argument .
48,522
public function quoteIdentifier ( $ text ) { if ( ! $ this -> getPlatform ( ) ) { throw new RuntimeException ( 'No platform specified. Can not quote without knowing which platform this table\'s database is using.' ) ; } if ( $ this -> isIdentifierQuotingEnabled ( ) ) { return $ this -> getPlatform ( ) -> doQuoting ( $ ...
Quotes a identifier depending on identifierQuotingEnabled .
48,523
public function getAutoIncrementPrimaryKey ( ) { if ( IdMethod :: NO_ID_METHOD !== $ this -> getIdMethod ( ) ) { foreach ( $ this -> getPrimaryKey ( ) as $ pk ) { if ( $ pk -> isAutoIncrement ( ) ) { return $ pk ; } } } }
Returns the auto incremented primary key .
48,524
public function isIdentifierQuotingEnabled ( ) { return ( null !== $ this -> identifierQuoting || ! $ this -> database ) ? $ this -> identifierQuoting : $ this -> database -> isIdentifierQuotingEnabled ( ) ; }
Checks if identifierQuoting is enabled . Looks up to its database - > isIdentifierQuotingEnabled if identifierQuoting is null hence undefined .
48,525
public function load ( $ file , $ type = null ) { $ content = XmlToArrayConverter :: convert ( $ this -> getPath ( $ file ) ) ; $ content = $ this -> resolveParams ( $ content ) ; return $ content ; }
Loads an Xml file .
48,526
public function toArray ( $ keyColumn = null , $ usePrefix = false , $ keyType = TableMap :: TYPE_PHPNAME , $ includeLazyLoadColumns = true , $ alreadyDumpedObjects = [ ] ) { $ ret = [ ] ; $ keyGetterMethod = 'get' . $ keyColumn ; foreach ( $ this as $ key => $ obj ) { $ key = null === $ keyColumn ? $ key : $ obj -> $ ...
Get an array representation of the collection Each object is turned into an array and the result is returned
48,527
public function setModelName ( $ modelName ) { if ( 0 === strpos ( $ modelName , '\\' ) ) { $ this -> modelName = substr ( $ modelName , 1 ) ; } else { $ this -> modelName = $ modelName ; } if ( $ this -> modelName && ! $ this -> modelTableMapName ) { $ this -> modelTableMapName = constant ( $ this -> modelName . '::TA...
Sets the model name . This also sets this - > modelTableMapName and this - > tableMap .
48,528
public function setModelAlias ( $ modelAlias , $ useAliasInSQL = false ) { if ( $ useAliasInSQL ) { $ this -> addAlias ( $ modelAlias , $ this -> tableMap -> getName ( ) ) ; $ this -> useAliasInSQL = true ; } $ this -> modelAlias = $ modelAlias ; return $ this ; }
Sets the alias for the model in this query
48,529
public function getAttribute ( $ attribute ) { switch ( $ attribute ) { case self :: PROPEL_ATTR_CACHE_PREPARES : return $ this -> isCachePreparedStatements ; break ; default : return $ this -> connection -> getAttribute ( $ attribute ) ; } }
Retrieve a database connection attribute .
48,530
public function getLogger ( ) { if ( null === $ this -> logger ) { return Propel :: getServiceContainer ( ) -> getLogger ( $ this -> getName ( ) ) ; } return $ this -> logger ; }
Gets the logger to use for this connection . If no logger was set returns the default logger from the Service Container .
48,531
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 ( $ callingMethod == "log" && $ i < $ stackSize ) ; if ( ! $ m...
Logs the method call or the executed SQL statement .
48,532
public function getContext ( ) { if ( isset ( $ this -> server [ 'REQUEST_METHOD' ] ) && isset ( $ this -> server [ 'REQUEST_URI' ] ) ) { return $ this -> server [ 'REQUEST_METHOD' ] . ' ' . strtok ( $ this -> server [ 'REQUEST_URI' ] , '?' ) ; } }
Get the request context .
48,533
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' ] ; } }
Get the request ip .
48,534
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 ) ; } return new PhpRequest ( $ ...
Resolve the current request .
48,535
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_replace ( ' ' , '-' , ucwords ( strtolower ( str_replace ( '_' ...
Get the request headers .
48,536
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 ( strtoupper ( $ server [ 'REQUEST_METHOD...
Parse the given input string .
48,537
public static function getLevelsForSeverity ( $ severity ) { $ levels = 0 ; foreach ( static :: $ ERROR_TYPES as $ level => $ info ) { if ( $ info [ 'severity' ] == $ severity ) { $ levels |= $ level ; } } return $ levels ; }
Get the the levels for the given severity .
48,538
public function registerDefaultCallbacks ( ) { $ this -> registerCallback ( new GlobalMetaData ( $ this -> config ) ) -> registerCallback ( new RequestMetaData ( $ this -> resolver ) ) -> registerCallback ( new RequestCookies ( $ this -> resolver ) ) -> registerCallback ( new RequestSession ( $ this -> resolver ) ) -> ...
Regsier all our default callbacks .
48,539
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_array ( $ type , Breadcrumb :: getTypes...
Record the given breadcrumb .
48,540
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 ( $ report ) use ( & $ resolvedRepor...
Notify Bugsnag of the given error report .
48,541
public function setMetaData ( array $ metaData , $ merge = true ) { $ this -> config -> setMetaData ( $ metaData , $ merge ) ; return $ this ; }
Set custom metadata to send to Bugsnag .
48,542
public static function generate ( Configuration $ config ) { $ backtrace = debug_backtrace ( DEBUG_BACKTRACE_IGNORE_ARGS & ~ DEBUG_BACKTRACE_PROVIDE_OBJECT ) ; return static :: fromBacktrace ( $ config , $ backtrace , '[generator]' , 0 ) ; }
Generate a new stacktrace using the given config .
48,543
public static function fromFrame ( Configuration $ config , $ file , $ line ) { $ stacktrace = new static ( $ config ) ; $ stacktrace -> addFrame ( $ file , $ line , '[unknown]' ) ; return $ stacktrace ; }
Create a new stacktrace instance from a frame .
48,544
public static function fromBacktrace ( Configuration $ config , array $ backtrace , $ topFile , $ topLine ) { $ stacktrace = new static ( $ config ) ; foreach ( $ backtrace as $ frame ) { if ( ! static :: frameInsideBugsnag ( $ frame ) ) { $ stacktrace -> addFrame ( $ topFile , $ topLine , isset ( $ frame [ 'function' ...
Create a new stacktrace instance from a backtrace .
48,545
public function addFrame ( $ file , $ line , $ method , $ class = null ) { $ matches = [ ] ; if ( preg_match ( "/^(.*?)\((\d+)\) : (?:eval\(\)'d code|runtime-created function)$/" , $ file , $ matches ) ) { $ file = $ matches [ 1 ] ; $ line = $ matches [ 2 ] ; } $ frame = [ 'lineNumber' => ( int ) $ line , 'method' => $...
Add the given frame to the stacktrace .
48,546
public function removeFrame ( $ index ) { if ( ! isset ( $ this -> frames [ $ index ] ) ) { throw new InvalidArgumentException ( 'Invalid frame index to remove.' ) ; } array_splice ( $ this -> frames , $ index , 1 ) ; }
Remove the frame at the given index from the stacktrace .
48,547
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 -> key ( ) + 1 ) ; $ code = [ ] ...
Extract the code for the given file and lines .
48,548
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 ] ; }
Get the start and end positions for the given line .
48,549
public static function register ( $ client = null ) { $ handler = new static ( $ client instanceof Client ? $ client : Client :: make ( $ client ) ) ; $ handler -> registerBugsnagHandlers ( false ) ; return $ handler ; }
Register our handlers .
48,550
public static function registerWithPrevious ( $ client = null ) { $ handler = new static ( $ client instanceof Client ? $ client : Client :: make ( $ client ) ) ; $ handler -> registerBugsnagHandlers ( true ) ; return $ handler ; }
Register our handlers and preserve those previously registered .
48,551
public function insertBefore ( callable $ pipe , $ beforeClass ) { $ beforePosition = null ; foreach ( $ this -> pipes as $ index => $ callable ) { $ class = get_class ( $ callable ) ; if ( $ class === $ beforeClass ) { $ beforePosition = $ index ; break ; } } if ( $ beforePosition === null ) { $ this -> pipes [ ] = $ ...
Add a pipe to the pipeline before a given class .
48,552
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 ) , $ pas...
Run the pipeline .
48,553
protected function getSlice ( ) { return function ( $ stack , $ pipe ) { return function ( $ passable ) use ( $ stack , $ pipe ) { return call_user_func ( $ pipe , $ passable , $ stack ) ; } ; } ; }
Get the closure that represents a slice .
48,554
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' ] ) ; retu...
Create a new report from a PHP error .
48,555
public static function fromPHPThrowable ( Configuration $ config , $ throwable ) { $ report = new static ( $ config ) ; $ report -> setPHPThrowable ( $ throwable ) -> setUnhandled ( false ) -> setSeverityReason ( [ 'type' => 'handledException' ] ) ; return $ report ; }
Create a new report from a PHP throwable .
48,556
public static function fromNamedError ( Configuration $ config , $ name , $ message = null ) { $ report = new static ( $ config ) ; $ report -> setName ( $ name ) -> setMessage ( $ message ) -> setStacktrace ( Stacktrace :: generate ( $ config ) ) -> setUnhandled ( false ) -> setSeverityReason ( [ 'type' => 'handledErr...
Create a new report from a named error .
48,557
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 ) ) -> setMessage ( $ throwable -> getM...
Set the PHP throwable .
48,558
public function setPHPError ( $ code , $ message , $ file , $ line , $ fatal = false ) { if ( $ fatal ) { $ stacktrace = Stacktrace :: fromFrame ( $ this -> config , $ file , $ line ) ; } else { $ stacktrace = Stacktrace :: generate ( $ this -> config ) ; } $ this -> setName ( ErrorTypes :: getName ( $ code ) ) -> setM...
Set the PHP error .
48,559
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 ; }
Gets the severity reason .
48,560
protected function setPrevious ( $ throwable ) { if ( $ throwable ) { $ this -> previous = static :: fromPHPThrowable ( $ this -> config , $ throwable ) ; } return $ this ; }
Set the previous throwable .
48,561
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 = 'Error' ; } return $ this ; }
Set the error name .
48,562
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 must be a string.' ) ; } return $ t...
Set the error message .
48,563
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 $ this ; }
Set the error severity .
48,564
public function setMetaData ( array $ metaData , $ merge = true ) { $ this -> metaData = $ merge ? array_merge_recursive ( $ this -> metaData , $ metaData ) : $ metaData ; return $ this ; }
Set the error meta data .
48,565
public function addMetaData ( array $ metadata ) { $ this -> metaData = array_replace_recursive ( $ this -> metaData , $ metadata ) ; $ this -> metaData = $ this -> removeNullElements ( $ this -> metaData ) ; 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 .
48,566
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 [ 'metaData' ] ...
Add a breadcrumb to the report .
48,567
public function getSummary ( ) { $ summary = [ ] ; $ name = $ this -> getName ( ) ; $ message = $ this -> getMessage ( ) ; if ( $ name !== $ message ) { $ summary [ 'name' ] = $ name ; } $ summary [ 'message' ] = $ message ; $ summary [ 'severity' ] = $ this -> getSeverity ( ) ; return array_filter ( $ summary ) ; }
Get the report summary .
48,568
public function toArray ( ) { $ event = [ 'app' => $ this -> config -> getAppData ( ) , 'device' => array_merge ( [ 'time' => $ this -> time ] , $ this -> config -> getDeviceData ( ) ) , 'user' => $ this -> getUser ( ) , 'context' => $ this -> getContext ( ) , 'payloadVersion' => HttpClient :: PAYLOAD_VERSION , 'severi...
Get the array representation .
48,569
protected function exceptionArray ( ) { $ exceptionArray = [ $ this -> exceptionObject ( ) ] ; $ previous = $ this -> previous ; while ( $ previous ) { $ exceptionArray [ ] = $ previous -> exceptionObject ( ) ; $ previous = $ previous -> previous ; } return $ this -> cleanupObj ( $ exceptionArray , false ) ; }
Get the exception array .
48,570
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 -> cleanupObj ( $ value , $ isMetaData ) ; } retu...
Cleanup the given object .
48,571
protected function shouldFilter ( $ key , $ isMetaData ) { if ( $ isMetaData ) { foreach ( $ this -> config -> getFilters ( ) as $ filter ) { if ( strpos ( $ key , $ filter ) !== false ) { return true ; } } } return false ; }
Should we filter the given element .
48,572
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 ; }
Recursively remove null elements .
48,573
public function record ( Breadcrumb $ breadcrumb ) { if ( $ this -> breadcrumbs && $ this -> pointer === $ this -> head ) { $ this -> head = ( $ this -> head + 1 ) % static :: MAX_ITEMS ; } $ this -> breadcrumbs [ $ this -> pointer ] = $ breadcrumb ; $ this -> pointer = ( $ this -> pointer + 1 ) % static :: MAX_ITEMS ;...
Record a breadcrumb .
48,574
protected function build ( ) { $ events = [ ] ; foreach ( $ this -> queue as $ report ) { $ event = $ report -> toArray ( ) ; if ( $ event ) { $ events [ ] = $ event ; } } return [ 'apiKey' => $ this -> config -> getApiKey ( ) , 'notifier' => $ this -> config -> getNotifier ( ) , 'events' => $ events , ] ; }
Build the request data to send .
48,575
protected function postJSON ( $ url , $ data ) { try { $ normalized = $ this -> normalize ( $ data ) ; } catch ( RuntimeException $ e ) { if ( count ( $ data [ 'events' ] ) > 1 ) { $ event = array_shift ( $ data [ 'events' ] ) ; $ this -> postJSON ( $ url , array_merge ( $ data , [ 'events' => [ $ event ] ] ) ) ; $ thi...
Post the given data to Bugsnag in json form .
48,576
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 RuntimeException ( 'Pay...
Normalize the given data to ensure it s the correct size .
48,577
public static function functionAvailable ( $ func ) { $ disabled = explode ( ',' , ini_get ( 'disable_functions' ) ) ; return function_exists ( $ func ) && ! in_array ( $ func , $ disabled ) ; }
Checks whether the given function name is available .
48,578
public static function getBuilderName ( ) { $ builderName = null ; if ( self :: functionAvailable ( 'exec' ) ) { $ output = [ ] ; $ success = 0 ; exec ( 'whoami' , $ output , $ success ) ; if ( $ success == 0 ) { $ builderName = $ output [ 0 ] ; } } if ( is_null ( $ builderName ) ) { $ builderName = get_current_user ( ...
Gets the current user s identity for build reporting .
48,579
public function shouldNotify ( ) { if ( ! $ this -> notifyReleaseStages ) { return true ; } return in_array ( $ this -> getAppData ( ) [ 'releaseStage' ] , $ this -> notifyReleaseStages , true ) ; }
Should we notify Bugsnag based on the current release stage?
48,580
public function setProjectRoot ( $ projectRoot ) { $ projectRootRegex = $ projectRoot ? '/^' . preg_quote ( $ projectRoot , '/' ) . '[\\/]?/i' : null ; $ this -> setProjectRootRegex ( $ projectRootRegex ) ; }
Set the project root .
48,581
public function setProjectRootRegex ( $ projectRootRegex ) { if ( $ projectRootRegex && @ preg_match ( $ projectRootRegex , null ) === false ) { throw new InvalidArgumentException ( 'Invalid project root regex: ' . $ projectRootRegex ) ; } $ this -> projectRootRegex = $ projectRootRegex ; $ this -> setStripPathRegex ( ...
Set the project root regex .
48,582
public function setStripPath ( $ stripPath ) { $ stripPathRegex = $ stripPath ? '/^' . preg_quote ( $ stripPath , '/' ) . '[\\/]?/i' : null ; $ this -> setStripPathRegex ( $ stripPathRegex ) ; }
Set the strip path .
48,583
public function setStripPathRegex ( $ stripPathRegex ) { if ( $ stripPathRegex && @ preg_match ( $ stripPathRegex , null ) === false ) { throw new InvalidArgumentException ( 'Invalid strip path regex: ' . $ stripPathRegex ) ; } $ this -> stripPathRegex = $ stripPathRegex ; }
Set the regular expression used to strip paths from stacktraces .
48,584
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 ( 'gethostname' , $ disable...
Get the hostname if possible .
48,585
public function shouldIgnoreErrorCode ( $ code ) { if ( isset ( $ this -> errorReportingLevel ) ) { return ! ( $ this -> errorReportingLevel & $ code ) ; } return ! ( error_reporting ( ) & $ code ) ; }
Should we ignore the given error code?
48,586
public function setSessionEndpoint ( $ endpoint ) { $ this -> sessionEndpoint = $ endpoint ; $ this -> sessionClient = Client :: makeGuzzle ( $ this -> sessionEndpoint ) ; return $ this ; }
Set session delivery endpoint .
48,587
public function getSessionClient ( ) { if ( is_null ( $ this -> sessionClient ) ) { $ this -> sessionClient = Client :: makeGuzzle ( $ this -> sessionEndpoint ) ; } return $ this -> sessionClient ; }
Get the session client .
48,588
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_exists ( 'transaction_id' , $ t...
Parse Data from JSON Response .
48,589
protected function getClient ( ) : HttpClient { if ( $ this -> _client == null ) { $ this -> _client = new HttpClient ( [ 'base_uri' => $ this -> _endpoint ] ) ; } return $ this -> _client ; }
returns the Guzzle client .
48,590
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 -> getStatusCode ( ) , json_decode ( $ httpResponse -> getBo...
validate the receipt data .
48,591
public function getStatus ( ) : ? string { if ( null === $ this -> expiration_intent ) { return $ this :: STATUS_ACTIVE ; } if ( $ this :: RETRY_PERIOD_ACTIVE === $ this -> is_in_billing_retry_period ) { return $ this :: STATUS_PENDING ; } if ( $ this :: RETRY_PERIOD_INACTIVE === $ this -> is_in_billing_retry_period ) ...
Status of Pending Renewal
48,592
public function isValid ( ) : bool { return $ this -> result_code === ResponseInterface :: RESULT_OK || $ this -> result_code === ResponseInterface :: RESULT_RECEIPT_VALID_BUT_SUB_EXPIRED ; }
returns if the receipt is valid or not
48,593
protected function parseIOS7StyleReceipt ( ) : void { $ this -> receipt = $ this -> raw_data [ 'receipt' ] ; $ this -> app_item_id = $ this -> raw_data [ 'receipt' ] [ 'app_item_id' ] ; $ this -> purchases = [ ] ; if ( array_key_exists ( 'original_purchase_date_ms' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> ori...
Collect data for iOS > = 7 . 0 receipt
48,594
protected function parseIOS6StyleReceipt ( ) : void { $ this -> receipt = $ this -> raw_data [ 'receipt' ] ; $ this -> purchases = [ ] ; $ this -> purchases [ ] = new PurchaseItem ( $ this -> raw_data [ 'receipt' ] ) ; if ( array_key_exists ( 'bid' , $ this -> raw_data [ 'receipt' ] ) ) { $ this -> bundle_id = $ this -...
Collect data for iOS < = 6 . 0 receipt
48,595
public function validate ( $ receipt ) { $ dom = new \ DOMDocument ; if ( @ $ dom -> loadXML ( $ receipt ) === false ) { throw new RunTimeException ( 'Invalid XML' ) ; } $ certificateId = $ dom -> documentElement -> getAttribute ( 'CertificateId' ) ; if ( empty ( $ certificateId ) ) { throw new RunTimeException ( 'Miss...
Validate the given receipt .
48,596
protected function retrieveCertificate ( $ certificateId ) { $ cacheKey = 'store-receipt-validate.windowsstore.' . $ certificateId ; $ certificate = $ this -> cache !== null ? $ this -> cache -> get ( $ cacheKey ) : null ; if ( $ certificate === null ) { $ maxCertificateSize = 10000 ; $ certificateUrl = '/fwlink/?LinkI...
Load the certificate with the given ID .
48,597
protected function validateXml ( DOMDocument $ dom , $ certificate ) { $ secDsig = new XMLSecurityDSig ; $ dsig = $ secDsig -> locateSignature ( $ dom ) ; if ( $ dsig === null ) { throw new RunTimeException ( 'Cannot locate receipt signature' ) ; } $ secDsig -> canonicalizeSignedInfo ( ) ; $ secDsig -> idKeys = [ 'wsu:...
Validate the receipt contained in the given XML element using the certificate provided .
48,598
public function setReceiptData ( $ receipt_data ) : self { if ( strpos ( $ receipt_data , '{' ) !== false ) { $ this -> receipt_data = base64_encode ( $ receipt_data ) ; } else { $ this -> receipt_data = $ receipt_data ; } return $ this ; }
Set receipt data either in base64 or in json
48,599
protected function getClient ( ) : HttpClient { if ( $ this -> client === null ) { $ this -> client = new HttpClient ( $ this -> getClientConfig ( ) ) ; } return $ this -> client ; }
Returns the Guzzle client