idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
55,700
public function get ( $ idOrKey , array $ fields = null ) { $ parameters = $ fields ? sprintf ( '?%s' , $ this -> createUriParameters ( [ 'fields' => implode ( ',' , $ fields ) ] ) ) : '' ; return $ this -> getRequest ( sprintf ( 'issue/%s%s' , $ idOrKey , $ parameters ) ) ; }
Returns issue by id or key .
55,701
public function delete ( $ idOrKey , $ deleteSubtasks = false ) { $ parameters = sprintf ( '?deleteSubtasks=%s' , $ deleteSubtasks ) ; return $ this -> deleteRequest ( sprintf ( 'issue/%s%s' , $ idOrKey , $ parameters ) ) ; }
Deletes an issue by id or key
55,702
public function createAttachment ( $ idOrKey , $ fileHandle ) { if ( gettype ( $ fileHandle ) != 'resource' ) { throw new \ RuntimeException ( sprintf ( 'createAttachment() expects parameter 2 to be resource, %s given' , gettype ( $ fileHandle ) ) ) ; } return $ this -> postFile ( sprintf ( 'issue/%s/attachments' , $ i...
Create issue attachment by its id or key
55,703
public function updateComment ( $ idOrKey , $ commentId , array $ data ) { return $ this -> putRequest ( sprintf ( 'issue/%s/comment/%s' , $ idOrKey , $ commentId ) , $ data ) ; }
Updates a comment by issue id or key comment id with given data
55,704
public function createWorklog ( $ idOrKey , array $ data , $ adjustEstimate = null , $ newEstimate = null , $ reduceBy = null ) { $ parameters = http_build_query ( [ 'adjustEstimate' => $ adjustEstimate , 'newEstimate' => $ newEstimate , 'reduceBy' => $ reduceBy , ] ) ; if ( $ parameters ) { $ parameters = sprintf ( '?...
Creates worklog for the issue by issue id or key
55,705
public function updateWorklog ( $ idOrKey , $ worklogId , array $ data , $ adjustEstimate = null , $ newEstimate = null ) { $ parameters = http_build_query ( [ 'adjustEstimate' => $ adjustEstimate , 'newEstimate' => $ newEstimate , ] ) ; if ( $ parameters ) { $ parameters = sprintf ( '?%s' , $ parameters ) ; } return $...
Updates worklog for the issue by issue id or key and worklog id
55,706
public function deleteWorklog ( $ idOrKey , $ worklogId , $ adjustEstimate = null , $ newEstimate = null , $ increaseBy = null ) { $ parameters = http_build_query ( [ 'adjustEstimate' => $ adjustEstimate , 'newEstimate' => $ newEstimate , 'increaseBy' => $ increaseBy , ] ) ; if ( $ parameters ) { $ parameters = sprintf...
Deletes worklog for the issue by issue id or key and worklog id
55,707
public function getListeners ( $ event ) { $ parentListeners = [ ] ; $ wildcards = [ ] ; if ( is_object ( $ event ) ) { $ eventName = get_class ( $ event ) ; $ parentListeners = $ this -> getParentListeners ( $ event ) ; } else { $ eventName = $ event ; $ wildcards = $ this -> getWildcardListeners ( $ event ) ; } if ( ...
Get all of the listeners for a given event .
55,708
protected function getParentListeners ( $ event ) { $ parentListeners = [ ] ; foreach ( $ this -> listeners as $ key => $ listeners ) { if ( $ event instanceof $ key ) { $ parentListeners = array_merge ( $ parentListeners , $ listeners ) ; } } return $ parentListeners ; }
Get the parent class or interface listeners for the event .
55,709
public function unlockMyRecords ( $ tableName ) { $ results = $ this -> lockedRecordsByUser ( $ tableName , Auth :: user ( ) -> id ) ; foreach ( $ results as $ result ) { $ this -> unpopulateLockFields ( $ result -> id ) ; } }
Unlock records belonging to the current user .
55,710
public function isLocked ( $ id ) { $ record = $ this -> model -> findOrFail ( $ id ) ; if ( $ record -> locked_by > 0 ) return true ; return false ; }
Is the record locked? Locked is defined as the locked_by field being populated ; that is > 0
55,711
public function populateLockFields ( $ id ) { $ record = $ this -> model -> findOrFail ( $ id ) ; $ record -> locked_by = Auth :: user ( ) -> id ; $ record -> locked_at = date ( 'Y-m-d H:i:s' ) ; return $ record -> save ( ) ; }
Populate the locked_at and locked_by fields . By definition this must be an UPDATE
55,712
public function unpopulateLockFields ( $ id ) { $ record = $ this -> model -> findOrFail ( $ id ) ; $ record -> locked_by = null ; $ record -> locked_at = null ; return $ record -> save ( ) ; }
Un - populate the locked_at and locked_by fields . By definition this must be an UPDATE
55,713
public static function to ( $ model , $ target , $ position ) { $ instance = new static ( $ model , $ target , $ position ) ; return $ instance -> perform ( ) ; }
Easy static accessor for performing a move operation .
55,714
public function perform ( ) { $ this -> guardAgainstImpossibleMove ( ) ; if ( $ this -> fireMoveEvent ( 'moving' ) === false ) return $ this -> model ; if ( $ this -> hasChange ( ) ) { $ self = $ this ; $ this -> model -> getConnection ( ) -> transaction ( function ( ) use ( $ self ) { $ self -> updateStructure ( ) ; }...
Perform the move operation .
55,715
protected function resolveNode ( $ model ) { if ( $ model instanceof NestedModel ) return $ model -> reload ( ) ; return $ this -> model -> newNestedSetQuery ( ) -> find ( $ model ) ; }
Resolves suplied node . Basically returns the node unchanged if supplied parameter is an instance of NestedModel . Otherwise it will try to find the node in the database .
55,716
protected function guardAgainstImpossibleMove ( ) { if ( ! $ this -> model -> exists ) throw new MoveNotPossibleException ( 'A new node cannot be moved.' ) ; if ( array_search ( $ this -> position , [ 'child' , 'left' , 'right' , 'root' ] ) === false ) throw new MoveNotPossibleException ( "Position should be one of ['c...
Check wether the current move is possible and if not rais an exception .
55,717
protected function bound1 ( ) { if ( ! is_null ( $ this -> _bound1 ) ) return $ this -> _bound1 ; switch ( $ this -> position ) { case 'child' : $ this -> _bound1 = $ this -> target -> getRight ( ) ; break ; case 'left' : $ this -> _bound1 = $ this -> target -> getLeft ( ) ; break ; case 'right' : $ this -> _bound1 = $...
Computes the boundary .
55,718
protected function boundaries ( ) { if ( ! is_null ( $ this -> _boundaries ) ) return $ this -> _boundaries ; $ this -> _boundaries = [ $ this -> model -> getLeft ( ) , $ this -> model -> getRight ( ) , $ this -> bound1 ( ) , $ this -> bound2 ( ) ] ; sort ( $ this -> _boundaries ) ; return $ this -> _boundaries ; }
Computes the boundaries array .
55,719
protected function parentId ( ) { switch ( $ this -> position ) { case 'root' : return null ; case 'child' : return $ this -> target -> getKey ( ) ; default : return $ this -> target -> getParentId ( ) ; } }
Computes the new parent id for the node being moved .
55,720
protected function hasChange ( ) { return ! ( $ this -> bound1 ( ) == $ this -> model -> getRight ( ) || $ this -> bound1 ( ) == $ this -> model -> getLeft ( ) ) ; }
Check wether there should be changes in the downward tree structure .
55,721
protected function fireMoveEvent ( $ event , $ halt = true ) { $ event = "eloquent.{$event}: " . get_class ( $ this -> model ) ; $ method = $ halt ? 'until' : 'fire' ; Hooks :: trigger ( $ event , [ 'model' => $ this -> model ] ) ; }
Fire the given move event for the model .
55,722
protected function applyLockBetween ( $ lft , $ rgt ) { $ this -> model -> newQuery ( ) -> where ( $ this -> model -> getLeftColumnName ( ) , '>=' , $ lft ) -> where ( $ this -> model -> getRightColumnName ( ) , '<=' , $ rgt ) -> select ( $ this -> model -> getKeyName ( ) ) -> lockForUpdate ( ) -> get ( ) ; }
Applies a lock to the rows between the supplied index boundaries .
55,723
public function cleanUpUnassignedTokens ( array $ tokens ) { $ this -> em -> clear ( ) ; foreach ( $ tokens as $ token ) { $ token = $ this -> em -> merge ( $ token ) ; $ this -> em -> remove ( $ token ) ; } $ this -> em -> flush ( ) ; }
Removes the not assigned tokens .
55,724
protected function setCleanUrl ( $ urlString ) { $ arrayToReplace = [ '&#038;' => '&amp;' , '&' => '&amp;' , '&amp;amp;' => '&amp;' , ' ' => '%20' , ] ; $ kys = array_keys ( $ arrayToReplace ) ; $ vls = array_values ( $ arrayToReplace ) ; return str_replace ( $ kys , $ vls , filter_var ( $ urlString , FILTER_SANITIZE_U...
Cleans a string for certain internal rules
55,725
protected function setFeedbackModern ( $ sType , $ sTitle , $ sMsg , $ skipBr = false ) { if ( $ sTitle == 'light' ) { return $ sMsg ; } $ legend = $ this -> setStringIntoTag ( $ sTitle , 'legend' , [ 'style' => $ this -> setFeedbackStyle ( $ sType ) ] ) ; return implode ( '' , [ ( $ skipBr ? '' : '<br/>' ) , $ this ->...
Builds a structured modern message
55,726
protected function setHeaderNoCache ( $ contentType = 'application/json' ) { header ( "Content-Type: " . $ contentType . "; charset=utf-8" ) ; header ( "Last-Modified: " . gmdate ( "D, d M Y H:i:s" ) . " GMT" ) ; header ( "Cache-Control: no-store, no-cache, must-revalidate" ) ; header ( "Cache-Control: post-check=0, pr...
Sets the no - cache header
55,727
protected function setStringIntoShortTag ( $ sTag , $ features = null ) { return '<' . $ sTag . $ this -> buildAttributesForTag ( $ features ) . ( isset ( $ features [ 'dont_close' ] ) ? '' : '/' ) . '>' ; }
Puts a given string into a specific short tag
55,728
protected function setStringIntoTag ( $ sString , $ sTag , $ features = null ) { return '<' . $ sTag . $ this -> buildAttributesForTag ( $ features ) . '>' . $ sString . '</' . $ sTag . '>' ; }
Puts a given string into a specific tag
55,729
public function int ( $ value , $ min = false , $ max = false , $ default = false ) { $ options = array ( "options" => array ( ) ) ; if ( isset ( $ default ) ) { $ options [ "options" ] [ "default" ] = $ default ; } if ( is_numeric ( $ min ) ) { $ options [ "options" ] [ "min_range" ] = $ min ; } if ( is_numeric ( $ ma...
Validates integer value .
55,730
public function str ( $ value , $ minLength = 0 , $ maxLength = false , $ default = false ) { $ value = trim ( $ value ) ; if ( ( ! empty ( $ minLength ) && ( mb_strlen ( $ value , $ this -> encoding ) < $ minLength ) ) || ( ! empty ( $ maxLength ) && ( mb_strlen ( $ value , $ this -> encoding ) > $ maxLength ) ) ) { r...
Validates string value .
55,731
public function plain ( $ value , $ minLength = 0 , $ maxLength = false , $ default = false ) { $ value = strip_tags ( $ value ) ; return $ this -> str ( $ value , $ minLength , $ maxLength , $ default ) ; }
Validates string and is removing tags from it .
55,732
public function email ( $ value , $ default = false , $ checkMxRecord = false ) { if ( ! $ value = filter_var ( $ value , FILTER_VALIDATE_EMAIL ) ) { return $ default ; } $ dom = explode ( "@" , $ value ) ; $ dom = array_pop ( $ dom ) ; if ( ! $ this -> url ( "http://$dom" ) ) { return $ default ; } return ( ! $ checkM...
Validates email .
55,733
public function setRequired ( bool $ required ) : BaseAttribute { parent :: setRequired ( $ required ) ; if ( $ this -> getMinLength ( ) === 0 ) { $ this -> setMinLength ( 1 ) ; } return $ this ; }
Set Required .
55,734
public function setLocalColumnNames ( array $ localColumnNames ) { $ this -> localColumnNames = array ( ) ; foreach ( $ localColumnNames as $ localColumnName ) { $ this -> addLocalColumnName ( $ localColumnName ) ; } }
Sets the local column names .
55,735
public function addLocalColumnName ( $ localColumnName ) { if ( ! is_string ( $ localColumnName ) || ( strlen ( $ localColumnName ) <= 0 ) ) { throw SchemaException :: invalidForeignKeyLocalColumnName ( $ this -> getName ( ) ) ; } $ this -> localColumnNames [ ] = $ localColumnName ; }
Adds a local column name to the foreign key .
55,736
public function setForeignTableName ( $ foreignTableName ) { if ( ! is_string ( $ foreignTableName ) || ( strlen ( $ foreignTableName ) <= 0 ) ) { throw SchemaException :: invalidForeignKeyForeignTableName ( $ this -> getName ( ) ) ; } $ this -> foreignTableName = $ foreignTableName ; }
Sets the foreign table name .
55,737
public function addForeignColumnName ( $ foreignColumnName ) { if ( ! is_string ( $ foreignColumnName ) || ( strlen ( $ foreignColumnName ) <= 0 ) ) { throw SchemaException :: invalidForeignKeyForeignColumnName ( $ this -> getName ( ) ) ; } $ this -> foreignColumnNames [ ] = $ foreignColumnName ; }
Adds a foreign column name to the foreign key .
55,738
protected function setDotNotationKey ( $ key , $ value ) { $ splitKey = explode ( '.' , $ key ) ; $ root = & $ this -> data ; while ( $ part = array_shift ( $ splitKey ) ) { if ( ! isset ( $ root [ $ part ] ) && count ( $ splitKey ) ) { $ root [ $ part ] = [ ] ; } $ root = & $ root [ $ part ] ; } $ root = $ value ; }
Handle setting a configuration value with a dot notation key .
55,739
private function compileAndSetName ( ) { $ name = \ Nuki \ Handlers \ Core \ Assist :: classNameShort ( $ this ) ; $ this -> name = strtolower ( $ name ) ; }
Private function to compile and set the driver name
55,740
private function isAlreadyInstalled ( ) : bool { $ public = new SplFileInfo ( self :: PROJECT_ROOT . '/public' ) ; $ src = new SplFileInfo ( self :: PROJECT_ROOT . '/src' ) ; return $ public -> isDir ( ) && $ src -> isDir ( ) ; }
Finds out if the framework has already been installed
55,741
private function modifyComposerFile ( ) { if ( ! is_writeable ( 'composer.json' ) ) { throw new Exception ( 'Make sure a composer.json file exists and is writable' ) ; } $ json = file_get_contents ( 'composer.json' ) ; $ composer = json_decode ( $ json ) ; if ( ! isset ( $ composer -> autoload ) || ! isset ( $ composer...
Modifies the composer file - Add the new project namespace to the autoload list
55,742
public static function getReadableSize ( $ bytes ) { $ unit = [ 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' , 'ZB' , 'YB' ] ; $ exp = floor ( log ( $ bytes , 1024 ) ) | 0 ; return round ( $ bytes / ( pow ( 1024 , $ exp ) ) , 2 ) . " $unit[$exp]" ; }
Get file size with correct extension
55,743
public function validateFor ( $ context ) { $ this -> errors = new Errors ( ) ; $ methodResolved = ActionUtils :: parseMethod ( $ context ) ; if ( ! method_exists ( $ this , $ methodResolved ) ) throw new Exception ( 'Method [' . $ methodResolved . '] does not exist on class [' . get_class ( $ this ) . ']' ) ; $ this -...
This method is called to perform validation
55,744
public function fromGeoCoordinate ( GeoCoordinate $ geoCoordinate = null ) { if ( $ geoCoordinate !== null ) { $ this -> latitude = $ geoCoordinate -> latitude ; $ this -> longitude = $ geoCoordinate -> longitude ; } return $ this ; }
= 0 ;
55,745
public static function getExtensionsByMimeType ( $ mimeType , $ magicFile = null ) { $ mimeTypes = static :: loadMimeTypes ( $ magicFile ) ; return array_keys ( $ mimeTypes , mb_strtolower ( $ mimeType , 'utf-8' ) , true ) ; }
Determines the extensions by given MIME type . This method will use a local map between extension names and MIME types .
55,746
private static function matchBasename ( $ baseName , $ pattern , $ firstWildcard , $ flags ) { if ( $ firstWildcard === false ) { if ( $ pattern === $ baseName ) { return true ; } } elseif ( $ flags & self :: PATTERN_ENDSWITH ) { $ n = StringHelper :: byteLength ( $ pattern ) ; if ( StringHelper :: byteSubstr ( $ patte...
Performs a simple comparison of file or directory names .
55,747
private static function matchPathname ( $ path , $ basePath , $ pattern , $ firstWildcard , $ flags ) { if ( isset ( $ pattern [ 0 ] ) && $ pattern [ 0 ] == '/' ) { $ pattern = StringHelper :: byteSubstr ( $ pattern , 1 , StringHelper :: byteLength ( $ pattern ) ) ; if ( $ firstWildcard !== false && $ firstWildcard !==...
Compares a path part against a pattern with optional wildcards .
55,748
public function countValues ( ) : int { $ count = 0 ; foreach ( $ this -> fields as $ field ) { $ count += $ field -> count ( ) ; } return $ count ; }
Gets the total number of values in the fields list structure .
55,749
private function lookupChannelKey ( $ channelName ) { if ( $ channelName == '#niche_monitoring' ) { $ channelKey = $ this -> slackConfig [ 'webhookURL_niche_monitoring' ] ; } elseif ( $ channelName == '#after-school-internal' ) { $ channelKey = $ this -> slackConfig [ 'webhookURL_after-school-internal' ] ; } else { $ c...
Lookup channel key value based on channel name .
55,750
public function alert ( $ channelNames , $ message , $ tos = [ '@dee' ] ) { $ to = implode ( ',' , $ tos ) ; foreach ( $ channelNames as $ channelName ) { $ channelKey = $ this -> lookupChannelKey ( $ channelName ) ; $ slack = new Client ( $ channelKey ) ; $ slack -> to ( $ to ) -> attach ( $ message ) -> send ( ) ; $ ...
Send report to Slack .
55,751
protected function createJsonResponse ( $ data = null , $ scope = null , $ status = 200 ) { if ( $ data !== null ) { $ data = is_string ( $ data ) ? $ data : $ this -> container -> get ( 'serializer' ) -> serialize ( $ data , 'json' , empty ( $ scope ) ? array ( ) : array ( 'scope' => $ scope ) ) ; } $ response = new R...
Create a JsonResponse with given data if object given it will be serialize with registered serializer .
55,752
protected function createJsonBadRequestResponse ( array $ errors = array ( ) ) { foreach ( $ errors as $ key => $ error ) { if ( ! $ error instanceof FormError ) { continue ; } $ errors [ 'errors' ] [ $ key ] = array ( 'message' => $ error -> getMessage ( ) , 'parameters' => $ error -> getMessageParameters ( ) , ) ; un...
create and returns a 400 Bad Request response .
55,753
protected function getRequestData ( Request $ request , $ inflection = 'camelize' ) { switch ( $ request -> headers -> get ( 'content-type' ) ) { case 'application/json' : if ( ! ( $ data = @ json_decode ( $ request -> getContent ( ) , true ) ) && ( $ error = json_last_error ( ) ) != JSON_ERROR_NONE ) { throw new HttpE...
Retrieve given request data depending on its content type .
55,754
protected function assertSubmitedFormIsValid ( Request $ request , FormInterface $ form ) { $ form -> submit ( $ this -> getRequestData ( $ request ) , $ request -> getMethod ( ) !== 'PATCH' ) ; if ( ! $ valid = $ form -> isValid ( ) ) { throw new ValidationException ( $ form -> getData ( ) , $ form -> getErrors ( true...
Custom method for form submission to handle http method bugs and extra fields error options .
55,755
public function bootstrap ( $ webDir , array $ config = [ ] ) { $ baseDir = dirname ( $ webDir ) ; $ this [ "gluggi.config" ] = $ this -> resolveConfig ( $ config ) ; $ this [ "gluggi.baseDir" ] = $ baseDir ; $ this -> registerProviders ( ) ; $ this -> registerCoreTwigNamespace ( ) ; $ this -> registerModelsAndTwigLayo...
Bootstraps the complete application
55,756
private function registerProviders ( ) { $ this -> register ( new TwigServiceProvider ( ) ) ; $ this -> register ( new UrlGeneratorServiceProvider ( ) ) ; $ this -> register ( new ServiceControllerServiceProvider ( ) ) ; }
Registers all used service providers
55,757
private function registerModelsAndTwigLayoutNamespaces ( $ baseDir ) { $ elementTypesModel = new ElementTypesModel ( $ baseDir ) ; $ this [ "model.element_types" ] = $ elementTypesModel ; $ this [ "model.download" ] = new DownloadModel ( $ baseDir ) ; foreach ( $ elementTypesModel -> getAllElementTypes ( ) as $ element...
Registers all models and all twig layout namespaces
55,758
private function registerTwigExtensions ( ) { $ this [ 'twig' ] = $ this -> share ( $ this -> extend ( 'twig' , function ( Twig_Environment $ twig , Application $ app ) { $ twig -> addExtension ( new TwigExtension ( $ app ) ) ; $ twig -> addGlobal ( "gluggi" , [ "config" => $ this [ "gluggi.config" ] ] ) ; return $ twi...
Registers all used twig extensions
55,759
private function defineCoreRouting ( ) { $ this -> get ( "/" , "controller.core:indexAction" ) -> bind ( "index" ) ; $ this -> get ( "/all/{elementType}" , "controller.core:elementsOverviewAction" ) -> bind ( "elements_overview" ) ; $ this -> get ( "/{elementType}/{key}" , "controller.core:showElementAction" ) -> bind ...
Defines the routes of the core app
55,760
public function setGenus ( \ Librinfo \ VarietiesBundle \ Entity \ Genus $ genus = null ) { $ this -> genus = $ genus ; return $ this ; }
Set genus .
55,761
public function addSubspecies ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ subspecies ) { $ subspecies -> setParentSpecies ( $ this ) ; $ this -> subspecieses [ ] = $ subspecies ; return $ this ; }
Add subspecies .
55,762
public function removeSubspeciese ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ subspecies ) { return $ this -> subspecieses -> removeElement ( $ subspecies ) ; }
Remove subspecies .
55,763
public function setParentSpecies ( \ Librinfo \ VarietiesBundle \ Entity \ Species $ parentSpecies = null ) { $ this -> parent_species = $ parentSpecies ; return $ this ; }
Set parentSpecies .
55,764
public function setOffset ( $ offset ) { $ this -> checkStreamAvailable ( ) ; fseek ( $ this -> fileDescriptor , $ offset < 0 ? $ this -> getSize ( ) + $ offset : $ offset ) ; }
Sets the point of operation ie the cursor offset value . The offset may also be set to a negative value when it is interpreted as an offset from the end of the stream instead of the beginning .
55,765
final public function readInt16LE ( ) { if ( $ this -> isBigEndian ( ) ) { return $ this -> fromInt16 ( strrev ( $ this -> read ( 2 ) ) ) ; } else { return $ this -> fromInt16 ( $ this -> read ( 2 ) ) ; } }
Reads 2 bytes from the stream and returns little - endian ordered binary data as signed 16 - bit integer .
55,766
final public function readInt16BE ( ) { if ( $ this -> isLittleEndian ( ) ) { return $ this -> fromInt16 ( strrev ( $ this -> read ( 2 ) ) ) ; } else { return $ this -> fromInt16 ( $ this -> read ( 2 ) ) ; } }
Reads 2 bytes from the stream and returns big - endian ordered binary data as signed 16 - bit integer .
55,767
private function fromUInt16 ( $ value , $ order = 0 ) { list ( , $ int ) = unpack ( ( $ order == self :: BIG_ENDIAN_ORDER ? 'n' : ( $ order == self :: LITTLE_ENDIAN_ORDER ? 'v' : 'S' ) ) . '*' , $ value ) ; return $ int ; }
Returns machine endian ordered binary data as unsigned 16 - bit integer .
55,768
private function fromInt24 ( $ value ) { list ( , $ int ) = unpack ( 'l*' , $ this -> isLittleEndian ( ) ? ( "\x00" . $ value ) : ( $ value . "\x00" ) ) ; return $ int ; }
Returns machine endian ordered binary data as signed 24 - bit integer .
55,769
final public function readInt24LE ( ) { if ( $ this -> isBigEndian ( ) ) { return $ this -> fromInt24 ( strrev ( $ this -> read ( 3 ) ) ) ; } else { return $ this -> fromInt24 ( $ this -> read ( 3 ) ) ; } }
Reads 3 bytes from the stream and returns little - endian ordered binary data as signed 24 - bit integer .
55,770
final public function readInt24BE ( ) { if ( $ this -> isLittleEndian ( ) ) { return $ this -> fromInt24 ( strrev ( $ this -> read ( 3 ) ) ) ; } else { return $ this -> fromInt24 ( $ this -> read ( 3 ) ) ; } }
Reads 3 bytes from the stream and returns big - endian ordered binary data as signed 24 - bit integer .
55,771
private function fromUInt24 ( $ value , $ order = 0 ) { list ( , $ int ) = unpack ( ( $ order == self :: BIG_ENDIAN_ORDER ? 'N' : ( $ order == self :: LITTLE_ENDIAN_ORDER ? 'V' : 'L' ) ) . '*' , $ this -> isLittleEndian ( ) ? ( "\x00" . $ value ) : ( $ value . "\x00" ) ) ; return $ int ; }
Returns machine endian ordered binary data as unsigned 24 - bit integer .
55,772
final public function readInt32LE ( ) { if ( $ this -> isBigEndian ( ) ) { return $ this -> fromInt32 ( strrev ( $ this -> read ( 4 ) ) ) ; } else { return $ this -> fromInt32 ( $ this -> read ( 4 ) ) ; } }
Reads 4 bytes from the stream and returns little - endian ordered binary data as signed 32 - bit integer .
55,773
final public function readInt32BE ( ) { if ( $ this -> isLittleEndian ( ) ) { return $ this -> fromInt32 ( strrev ( $ this -> read ( 4 ) ) ) ; } else { return $ this -> fromInt32 ( $ this -> read ( 4 ) ) ; } }
Reads 4 bytes from the stream and returns big - endian ordered binary data as signed 32 - bit integer .
55,774
final public function readUInt32LE ( ) { if ( PHP_INT_SIZE < 8 ) { list ( , $ lo , $ hi ) = unpack ( 'v*' , $ this -> read ( 4 ) ) ; return $ hi * ( 0xffff + 1 ) + $ lo ; } else { list ( , $ int ) = unpack ( 'V*' , $ this -> read ( 4 ) ) ; return $ int ; } }
Reads 4 bytes from the stream and returns little - endian ordered binary data as unsigned 32 - bit integer .
55,775
final public function readUInt32 ( ) { if ( PHP_INT_SIZE < 8 ) { if ( $ this -> isLittleEndian ( ) ) { list ( , $ lo , $ hi ) = unpack ( 'S*' , $ this -> read ( 4 ) ) ; } else { list ( , $ hi , $ lo ) = unpack ( 'S*' , $ this -> read ( 4 ) ) ; } return $ hi * ( 0xffff + 1 ) + $ lo ; } else { list ( , $ int ) = unpack (...
Reads 4 bytes from the stream and returns machine ordered binary data as unsigned 32 - bit integer .
55,776
final public function readInt64LE ( ) { list ( , $ lolo , $ lohi , $ hilo , $ hihi ) = unpack ( 'v*' , $ this -> read ( 8 ) ) ; return ( $ hihi * ( 0xffff + 1 ) + $ hilo ) * ( 0xffffffff + 1 ) + ( $ lohi * ( 0xffff + 1 ) + $ lolo ) ; }
Reads 8 bytes from the stream and returns little - endian ordered binary data as 64 - bit float .
55,777
final public function readFloatLE ( ) { if ( $ this -> isBigEndian ( ) ) { return $ this -> fromFloat ( strrev ( $ this -> read ( 4 ) ) ) ; } else { return $ this -> fromFloat ( $ this -> read ( 4 ) ) ; } }
Reads 4 bytes from the stream and returns little - endian ordered binary data as a 32 - bit float point number as defined by IEEE 754 .
55,778
final public function readFloatBE ( ) { if ( $ this -> isLittleEndian ( ) ) { return $ this -> fromFloat ( strrev ( $ this -> read ( 4 ) ) ) ; } else { return $ this -> fromFloat ( $ this -> read ( 4 ) ) ; } }
Reads 4 bytes from the stream and returns big - endian ordered binary data as a 32 - bit float point number as defined by IEEE 754 .
55,779
final public function readDoubleLE ( ) { if ( $ this -> isBigEndian ( ) ) { return $ this -> fromDouble ( strrev ( $ this -> read ( 8 ) ) ) ; } else { return $ this -> fromDouble ( $ this -> read ( 8 ) ) ; } }
Reads 8 bytes from the stream and returns little - endian ordered binary data as a 64 - bit floating point number as defined by IEEE 754 .
55,780
final public function readDoubleBE ( ) { if ( $ this -> isLittleEndian ( ) ) { return $ this -> fromDouble ( strrev ( $ this -> read ( 8 ) ) ) ; } else { return $ this -> fromDouble ( $ this -> read ( 8 ) ) ; } }
Reads 8 bytes from the stream and returns big - endian ordered binary data as a 64 - bit float point number as defined by IEEE 754 .
55,781
final public function readGuid ( ) { $ C = @ unpack ( 'V1V/v2v/N2N' , $ this -> read ( 16 ) ) ; list ( $ hex ) = @ unpack ( 'H*0' , pack ( 'NnnNN' , $ C [ 'V' ] , $ C [ 'v1' ] , $ C [ 'v2' ] , $ C [ 'N1' ] , $ C [ 'N2' ] ) ) ; if ( implode ( '' , unpack ( 'H*' , pack ( 'H*' , 'a' ) ) ) == 'a00' ) { $ hex = substr ( $ h...
Reads 16 bytes from the stream and returns the little - endian ordered binary data as mixed - ordered hexadecimal GUID string .
55,782
public function close ( ) { if ( $ this -> fileDescriptor !== null ) { @ fclose ( $ this -> fileDescriptor ) ; $ this -> fileDescriptor = null ; } }
Closes the stream . Once a stream has been closed further calls to read methods will throw an exception . Closing a previously - closed stream however has no effect .
55,783
private function getEndianess ( ) { if ( 0 === self :: $ endianess ) { self :: $ endianess = $ this -> fromInt32 ( "\x01\x00\x00\x00" ) == 1 ? self :: LITTLE_ENDIAN_ORDER : self :: BIG_ENDIAN_ORDER ; } return self :: $ endianess ; }
Returns the current machine endian order .
55,784
public function findPendingInvitationsQuery ( UserInterface $ user ) { $ qb = $ this -> createQueryBuilder ( 'i' ) ; return $ qb -> join ( 'i.event' , 'e' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'e.active' , ':active' ) ) -> andWhere ( $ qb -> expr ( ) -> gt ( 'e.end' , ':now' ) ) -> andWhere ( $ qb -> expr ( ) -> isN...
Build query to find pending invitations for a user .
55,785
public function findOtherInvitationsQuery ( UserInterface $ user ) { $ qb = $ this -> createQueryBuilder ( 'i' ) ; return $ qb -> join ( 'i.event' , 'e' ) -> andWhere ( $ qb -> expr ( ) -> eq ( 'e.active' , ':active' ) ) -> andWhere ( $ qb -> expr ( ) -> orX ( $ qb -> expr ( ) -> lt ( 'e.end' , ':now' ) , $ qb -> expr ...
Build query to find other invitations for a user .
55,786
public function hasReadAccess ( ) : bool { return $ this -> isOpen ( ) && ( $ this -> access == static :: ACCESS_READ || $ this -> access == static :: ACCESS_READWRITE ) ; }
Returns if reading is enabled .
55,787
public function hasWriteAccess ( ) : bool { return $ this -> isOpen ( ) && ( $ this -> access == static :: ACCESS_WRITE || $ this -> access == static :: ACCESS_READWRITE ) ; }
Returns if writing is enabled .
55,788
public function writeCsv ( array $ dataRow , string $ delimiter = ',' , bool $ fast = false ) : bool { if ( ! $ fast ) { if ( ! $ this -> isOpen ( ) ) { return false ; } if ( ! $ this -> hasWriteAccess ( ) ) { throw FileAccessError :: Write ( 'IO' , $ this -> file , \ sprintf ( 'Current mode of opened file is "%s" and ...
Write a csv format data row defined as array .
55,789
public function setPointerPosition ( int $ offset = 0 ) : bool { if ( ! \ is_resource ( $ this -> fp ) ) { return false ; } return ( bool ) \ fseek ( $ this -> fp , $ offset ) ; }
Sets a new file pointer position .
55,790
public function setPointerPositionToEndOfFile ( ) : bool { if ( ! \ is_resource ( $ this -> fp ) ) { return false ; } return ( bool ) \ fseek ( $ this -> fp , 0 , \ SEEK_END ) ; }
Sets the file pointer position to the end of the file .
55,791
public static function Create ( string $ file , $ mode = 0750 , bool $ overwrite = true , $ contents = '' ) { $ f = File :: CreateNew ( $ file , $ overwrite , true , true , $ mode ) ; $ f -> write ( $ contents ) ; $ f -> close ( ) ; }
Creates a new file with the defined content .
55,792
public static function Zip ( string $ sourceFile , string $ zipFile , string $ workingDir = null ) { if ( ! \ class_exists ( '\\ZipArchive' ) ) { throw new MissingExtensionError ( 'ZIP' , 'IO' , 'Can not ZIP the file "' . $ sourceFile . '"!' ) ; } $ owd = Path :: Unixize ( \ getcwd ( ) ) ; if ( empty ( $ workingDir ) )...
Compresses the defined source file to defined ZIP archive file .
55,793
public static function GetNameWithoutExtension ( string $ file , bool $ doubleExtension = false ) { if ( \ FALSE === ( $ ext = static :: GetExtension ( $ file , $ doubleExtension ) ) ) { return \ basename ( $ file ) ; } return \ substr ( \ basename ( $ file ) , 0 , - \ strlen ( $ ext ) ) ; }
Returns the file name without the file name extension .
55,794
public static function intcmp ( $ a , $ b ) { return ( $ a - $ b ) ? ( $ a - $ b ) / abs ( $ a - $ b ) : 0 ; }
Returns an integer less than equal to or greater than zero if the first argument is considered to be respectively less than equal to or greater than the second .
55,795
public function getFolders ( ) { $ result = [ ] ; $ files = glob ( $ this -> path . '*' , GLOB_ONLYDIR ) ; if ( $ files ) { foreach ( $ files as $ f ) { $ result [ ] = self :: getInstance ( $ f ) ; } } return $ result ; }
returns all FilesystemFolder instances in folder
55,796
public function getParentFolder ( $ force = FALSE ) { if ( ! isset ( $ this -> parentFolder ) || $ force ) { $ parentPath = realpath ( $ this -> path . '..' ) ; if ( $ parentPath === $ this -> path ) { $ this -> parentFolder = FALSE ; } else { $ this -> parentFolder = self :: getInstance ( $ parentPath ) ; } } return $...
return parent FilesystemFolder of current folder returns NULL when current folder is already the root folder
55,797
public function createFolder ( $ folderName ) { if ( ! ( $ path = realpath ( $ folderName ) ) ) { $ path = $ this -> path . $ folderName ; } else if ( strpos ( $ path , $ this -> path ) !== 0 ) { throw new FilesystemFolderException ( sprintf ( "Folder %s cannot be created within folder %s." , $ folderName , $ this -> p...
create a new subdirectory returns newly created FilesystemFolder object
55,798
public function purgeCache ( $ force = FALSE ) { if ( ( $ path = $ this -> getCachePath ( $ force ) ) ) { foreach ( glob ( $ path . '*' ) as $ f ) { if ( ! unlink ( $ f ) ) { throw new FilesystemFolderException ( sprintf ( 'Cache folder %s could not be purged!' , $ this -> path . self :: CACHE_PATH ) ) ; } } } }
empties the cache when found
55,799
public function setCharset ( $ charset ) { $ this -> _database -> exec ( 'ALTER TABLE ' . $ this -> _database -> prepareIdentifier ( $ this -> _name ) . ' CONVERT TO CHARACTER SET ' . $ this -> _database -> prepareValue ( $ charset , Column :: TYPE_VARCHAR ) ) ; }
Set character set and convert data to new character set