idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
55,000
public function lookupSingletonSessionBean ( $ className ) { if ( $ this -> getSingletonSessionBeans ( ) -> has ( $ className ) === true ) { return $ this -> getSingletonSessionBeans ( ) -> get ( $ className ) ; } }
Retrieves the requested singleton session bean .
55,001
public function destroyBeanInstance ( $ instance ) { $ objectManager = $ this -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; $ descriptor = $ objectManager -> getObjectDescriptors ( ) -> get ( get_class ( $ instance ) ) ; if ( $ descriptor instanceof SessionBeanDescriptorInterface ) { foreac...
Invokes the bean method with a pre - destroy callback .
55,002
public function attach ( DescriptorInterface $ objectDescriptor , $ instance ) { $ sessionId = Environment :: singleton ( ) -> getAttribute ( EnvironmentKeys :: SESSION_ID ) ; if ( $ objectDescriptor instanceof StatefulSessionBeanDescriptorInterface ) { if ( $ sessionId == null ) { throw new \ Exception ( 'Can\'t find ...
Attaches the passed bean depending on it s type to the container .
55,003
protected function generatePointcutPointcut ( array $ pointcutNames , Aspect $ aspect ) { $ pointcutFactory = new PointcutFactory ( ) ; $ referencedPointcuts = array ( ) ; $ pointcutExpression = array ( ) ; foreach ( $ pointcutNames as $ pointcutName ) { $ pointcutName = ( string ) $ pointcutName ; $ referenceCount = c...
Will create a PointcutPointcut instance referencing all concrete pointcuts configured for a certain advice . Needs a list of these pointcuts
55,004
public function main ( ) { $ interval = $ this -> getInterval ( ) ; $ directory = $ this -> getDirectory ( ) ; $ extensionsToWatch = sprintf ( '{%s}' , implode ( ',' , $ this -> getExtensionsToWatch ( ) ) ) ; $ this -> getSystemLogger ( ) -> info ( sprintf ( 'Start scanning directory %s for files to be rotated (interva...
Start the logrotate scanner that queries whether the configured log files has to be rotated or not .
55,005
protected function getGlobPattern ( $ fileToRotate , $ fileExtension = '' ) { $ dirname = pathinfo ( $ fileToRotate , PATHINFO_DIRNAME ) ; $ filename = pathinfo ( $ fileToRotate , PATHINFO_FILENAME ) ; $ glob = str_replace ( array ( LogrotateScanner :: FILENAME_FORMAT_PLACEHOLDER , LogrotateScanner :: SIZE_FORMAT_PLACE...
Will return a glob pattern with which log files belonging to the currently rotated file can be found .
55,006
protected function handle ( $ fileToRotate ) { $ today = new \ DateTime ( ) ; if ( $ this -> getNextRotationDate ( ) < $ today -> getTimestamp ( ) ) { $ this -> rotate ( $ fileToRotate ) ; } elseif ( file_exists ( $ fileToRotate ) && filesize ( $ fileToRotate ) >= $ this -> getMaxSize ( ) ) { $ this -> rotate ( $ fileT...
Handles the log message .
55,007
protected function rotate ( $ fileToRotate ) { clearstatcache ( ) ; if ( file_exists ( $ fileToRotate ) === false || is_writable ( $ fileToRotate ) === false ) { return ; } if ( filesize ( $ fileToRotate ) === 0 ) { return ; } $ logFiles = glob ( $ this -> getGlobPattern ( $ fileToRotate , 'gz' ) ) ; usort ( $ logFiles...
Does the rotation of the log file which includes updating the currently used filename as well as cleaning up the log directory .
55,008
protected function cleanup ( $ fileToRotate ) { $ maxFiles = $ this -> getMaxFiles ( ) ; if ( 0 === $ maxFiles ) { return ; } $ logFiles = glob ( $ this -> getGlobPattern ( $ fileToRotate , 'gz' ) ) ; if ( $ maxFiles >= count ( $ logFiles ) ) { return ; } foreach ( array_slice ( $ logFiles , $ maxFiles ) as $ fileToDel...
Will cleanup log files based on the value set for their maximal number
55,009
public function getAnalytic ( $ uri ) { foreach ( $ this -> getAnalytics ( ) as $ analyticNode ) { if ( $ analyticNode -> getUri ( ) === $ uri ) { return $ analyticNode ; } } return false ; }
Will return the analytic node with the specified definition and if nothing could be found we will return false
55,010
public function getAnalyticsAsArray ( ) { $ analytics = array ( ) ; foreach ( $ this -> getAnalytics ( ) as $ analyticNode ) { $ analytics [ ] = array ( 'uri' => $ analyticNode -> getUri ( ) , 'connectors' => $ analyticNode -> getConnectorsAsArray ( ) ) ; } return $ analytics ; }
Returns the analytics as an associative array
55,011
public static function get ( $ applicationState ) { if ( in_array ( $ applicationState , ApplicationStateKeys :: getApplicationStates ( ) ) ) { return new ApplicationStateKeys ( $ applicationState ) ; } throw new InvalidApplicationStateException ( sprintf ( 'Requested application state %s is not available (choose on of...
Factory method to create a new application state instance .
55,012
public function parse ( ) { foreach ( $ this -> getDirectories ( ) as $ directory ) { $ this -> parseDirectory ( DirectoryKeys :: realpath ( $ directory ) ) ; } }
Parses the bean context s web application base directory for beans that has to be registered in the object manager .
55,013
protected function parseDirectory ( $ directory ) { if ( is_dir ( $ directory ) === false ) { return ; } $ objectManager = $ this -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; $ service = $ this -> getApplication ( ) -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; $ p...
Parses the passed directory for classes and instances that has to be registered in the object manager .
55,014
public function createSslCertificate ( \ SplFileInfo $ certificate ) { if ( ! $ this -> isOpenSslAvailable ( ) ) { return ; } if ( $ certificate -> isFile ( ) ) { return ; } $ dn = array ( "countryName" => "DE" , "stateOrProvinceName" => "Bavaria" , "localityName" => "Kolbermoor" , "organizationName" => "appserver.io" ...
Creates the SSL file passed as parameter or nothing if the file already exists .
55,015
public function load ( $ uuid ) { $ containers = $ this -> findAll ( ) ; if ( array_key_exists ( $ uuid , $ containers ) ) { return $ containers [ $ uuid ] ; } }
Returns the container for the passed UUID .
55,016
public function collectGarbage ( ) { $ garbageCollectionProbability = $ this -> getSessionSettings ( ) -> getGarbageCollectionProbability ( ) ; $ decimals = strlen ( strrchr ( $ garbageCollectionProbability , '.' ) ) - 1 ; $ factor = ( $ decimals > - 1 ) ? $ decimals * 10 : 1 ; if ( rand ( 0 , 100 * $ factor ) <= ( $ g...
Collects the session garbage .
55,017
public function fromException ( \ Exception $ e ) { return new Error ( E_EXCEPTION , $ e -> __toString ( ) , $ e -> getFile ( ) , $ e -> getLine ( ) , $ e -> getCode ( ) ) ; }
Create s a new error instance from the passed exception .
55,018
public function mapLogLevel ( ErrorInterface $ error ) { $ logLevel = LogLevel :: ERROR ; switch ( $ error -> getType ( ) ) { case E_WARNING : case E_USER_WARNING : case E_COMPILE_WARNING : case E_RECOVERABLE_ERROR : $ logLevel = LogLevel :: WARNING ; break ; case E_NOTICE : case E_USER_NOTICE : case E_STRICT : case E_...
Return s the log level for the passed error instance .
55,019
public function mapErrorCode ( ErrorInterface $ error ) { $ wrapped = 'Unknown' ; switch ( $ error -> getType ( ) ) { case E_EXCEPTION : $ wrapped = 'Exception' ; break ; case E_PARSE : case E_ERROR : case E_CORE_ERROR : case E_COMPILE_ERROR : case E_USER_ERROR : $ wrapped = 'Fatal Error' ; break ; case E_WARNING : cas...
Return s the a human readable error representation for the passed error instance .
55,020
public function isFatal ( $ type ) { return in_array ( $ type , array ( E_EXCEPTION , E_PARSE , E_ERROR , E_CORE_ERROR , E_COMPILE_ERROR , E_USER_ERROR ) ) ; }
Query whether or not the passed error type is fatal or not .
55,021
public static function factory ( ApplicationServerInterface $ applicationServer , ExtractorNodeInterface $ configuration ) { $ reflectionClass = new \ ReflectionClass ( $ configuration -> getType ( ) ) ; $ params = array ( $ applicationServer -> getInitialContext ( ) , $ configuration ) ; return $ reflectionClass -> ne...
Factory method to create a new PHAR extractor instance .
55,022
protected function processConfigurationNode ( NodeInterface $ node ) { $ objectManager = $ this -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; foreach ( $ this -> getDescriptors ( ) as $ descriptor ) { try { $ descriptorClass = $ descriptor -> getNodeValue ( ) -> getValue ( ) ; if ( $ object...
Creates a new descriptor instance from the data of the passed configuration node and add s it to the object manager .
55,023
public function merge ( CronNode $ cronNode ) { $ this -> setJobs ( array_merge ( $ this -> getJobs ( ) , $ cronNode -> getJobs ( ) ) ) ; }
This method merges the passed CRON node with this one
55,024
public function getObjectDescriptor ( $ name ) { if ( $ this -> hasObjectDescriptor ( $ name ) ) { return $ this -> objectDescriptors -> get ( $ name ) ; } throw new UnknownObjectDescriptorException ( sprintf ( 'Object Descriptor with name "%s" has not been registered' , $ name ) ) ; }
Returns the object descriptor if we ve registered it .
55,025
protected function postInit ( ) { $ errorCodePattern = new ValueNode ( new NodeValue ( ErrorPageNodeInterface :: DEFAULT_ERROR_CODE_PATTERN ) ) ; $ errorLocation = new ValueNode ( new NodeValue ( ErrorPageNodeInterface :: DEFAULT_ERROR_LOCATION ) ) ; $ this -> errorPages [ ] = new ErrorPageNode ( $ errorCodePattern , $...
Will be invoked after the node will be initialized from the configuration values .
55,026
public static function visit ( ManagerSettingsAwareInterface $ manager ) { $ application = $ manager -> getApplication ( ) ; $ webappPath = $ application -> getWebappPath ( ) ; $ properties = null ; if ( $ baseDirectory = $ manager -> getManagerSettings ( ) -> getBaseDirectory ( ) ) { $ propertiesFile = DirectoryKeys :...
Creates a new naming context and add s it to the passed manager .
55,027
public function normalize ( ConfigurationInterface $ configuration ) { $ node = $ this -> newInstance ( '\stdClass' ) ; $ node -> { $ configuration -> getNodeName ( ) } = new \ stdClass ( ) ; if ( $ value = $ configuration -> getValue ( ) ) { $ node -> { $ configuration -> getNodeName ( ) } -> value = $ value ; } forea...
Normalizes the passed configuration node and returns a \ stdClass representation of it .
55,028
public function login ( ) { if ( parent :: login ( ) ) { $ name = new String ( $ this -> sharedState -> get ( SharedStateKeys :: LOGIN_NAME ) ) ; if ( $ name instanceof PrincipalInterface ) { $ this -> identity = name ; } else { $ name = $ name -> __toString ( ) ; try { $ this -> identity = $ this -> createIdentity ( $...
Perform the authentication of username and password .
55,029
protected function getUsername ( ) { $ name = null ; if ( $ identity = $ this -> getIdentity ( ) ) { $ name = $ identity -> getName ( ) ; } return $ name ; }
Return s the principal s username .
55,030
public function getPreviousRun ( ) { if ( $ this -> previousRun != null ) { return \ DateTime :: createFromFormat ( ScheduleExpression :: DATE_FORMAT , $ this -> previousRun ) ; } }
Returns the previous run date .
55,031
public function setNextTimeout ( $ next = null ) { if ( $ next != null ) { $ this -> nextExpiration = $ next ; } else { $ this -> nextExpiration = null ; } }
Sets the next timeout of this timer .
55,032
public function getNextTimeout ( ) { if ( $ this -> isCanceled ( ) ) { throw new NoSuchObjectLocalException ( 'Timer has been cancelled' ) ; } $ nextExpiration = $ this -> getNextExpiration ( ) ; if ( $ nextExpiration == null ) { throw new NoMoreTimeoutsException ( sprintf ( 'Timer %s has no more future timeouts' , $ t...
Get the point in time at which the next timer expiration is scheduled to occur .
55,033
public function isActive ( ) { return $ this -> timerService -> isStarted ( ) && ! $ this -> isCanceled ( ) && ! $ this -> isExpired ( ) && ( $ this -> timerService -> isScheduled ( $ this -> getId ( ) ) || $ this -> timerState == TimerState :: CREATED ) ; }
Returns TRUE if this timer is active else FALSE .
55,034
public static function create ( SessionHandlerNodeInterface $ sessionHandlerNode , SessionSettingsInterface $ sessionSettings ) { $ reflectionClass = new ReflectionClass ( $ sessionHandlerNode -> getType ( ) ) ; $ sessionHandler = $ reflectionClass -> newInstanceArgs ( $ sessionHandlerNode -> getParamsAsArray ( ) ) ; $...
Create and return a new instance of the session handler with the passed configuration .
55,035
public static function fromHttpRequest ( PartInterface $ httpPart ) { $ httpPart -> write ( $ tmpFilename = tempnam ( ini_get ( 'upload_tmp_dir' ) , 'tmp_' ) ) ; $ servletPart = new Part ( ) ; $ servletPart -> setName ( $ httpPart -> getName ( ) ) ; $ servletPart -> setFilename ( $ httpPart -> getFilename ( ) ) ; $ ser...
Creates a new servlet part instance with the data from the HTTP part .
55,036
public function init ( $ streamWrapper = self :: STREAM_WRAPPER_TEMP , $ maxMemory = 5242880 ) { if ( $ tmpFilename = $ this -> getTmpFilename ( ) ) { if ( ! $ this -> inputStream = fopen ( $ tmpFilename , 'r+' ) ) { throw new \ Exception ( sprintf ( 'Can\'t open input temporary filename %s' , $ tmpFilename ) ) ; } } e...
Initiates a http form part object
55,037
public function putContent ( $ content ) { $ this -> size = fwrite ( $ this -> inputStream , $ content ) ; rewind ( $ this -> inputStream ) ; }
Puts content to input stream .
55,038
public function getHeaders ( $ name = null ) { if ( is_null ( $ name ) ) { return $ this -> headers ; } else { return $ this -> getHeader ( $ name ) ; } }
Gets the values of the Part header with the given name .
55,039
public function accept ( ) { $ splFileInfo = $ this -> getInnerIterator ( ) -> current ( ) ; $ aTime = time ( ) - $ this -> maximumAge ; if ( $ splFileInfo -> getATime ( ) < $ aTime ) { return false ; } return true ; }
This method compares the session files age against the configured maximum age of session files we want to load .
55,040
public function format ( LogMessageInterface $ logMessage ) { $ params = array ( date ( $ this -> dateFormat ) , gethostname ( ) , $ logMessage -> getLevel ( ) , $ this -> convertToString ( $ logMessage ) , json_encode ( $ logMessage -> getContext ( ) ) ) ; return trim ( vsprintf ( $ this -> messageFormat , $ params ) ...
Formats and returns a string representation of the passed log message .
55,041
protected function convertToString ( LogMessageInterface $ logMessage ) { $ output = '' ; $ this -> dumper -> dump ( $ this -> cloner -> cloneVar ( $ logMessage -> getMessage ( ) ) , function ( $ line , $ depth ) use ( & $ output ) { if ( $ depth >= 0 ) { $ output .= str_repeat ( ' ' , $ depth ) . $ line . PHP_EOL ; }...
Convert s the passed message into an string .
55,042
public function getConnector ( $ name ) { foreach ( $ this -> getConnectors ( ) as $ connectorNode ) { if ( $ connectorNode -> getName ( ) === $ name ) { return $ connectorNode ; } } return false ; }
Will return the connector node with the specified definition and if nothing could be found we will return false
55,043
public function getConnectorsAsArray ( ) { $ connectors = array ( ) ; foreach ( $ this -> getConnectors ( ) as $ connectorNode ) { $ connectors [ ] = array ( 'name' => $ connectorNode -> getName ( ) , 'type' => $ connectorNode -> getType ( ) , 'params' => $ connectorNode -> getParamsAsArray ( ) ) ; } return $ connector...
Returns the connectors as an associative array
55,044
public static function factory ( ServerContextInterface $ serverContext , ModuleConfigurationInterface $ moduleConfiguration ) { $ systemConfiguration = $ serverContext -> getContainer ( ) -> getInitialContext ( ) -> getSystemConfiguration ( ) ; $ storageProvider = new SystemConfigurationStorageProvider ( $ systemConfi...
Factory method to create a new DNS resolver instance .
55,045
public function getDeploymentService ( ) { if ( $ this -> deploymentService == null ) { $ this -> deploymentService = $ this -> newService ( 'AppserverIo\Appserver\Core\Api\DeploymentService' ) ; } return $ this -> deploymentService ; }
Returns the deployment service instance .
55,046
public function getConfigurationService ( ) { if ( $ this -> configurationService == null ) { $ this -> configurationService = $ this -> newService ( 'AppserverIo\Appserver\Core\Api\ConfigurationService' ) ; } return $ this -> configurationService ; }
Returns the configuration service instance .
55,047
public function getDatasourceService ( ) { if ( $ this -> datasourceService == null ) { $ this -> datasourceService = $ this -> newService ( 'AppserverIo\Appserver\Core\Api\DatasourceService' ) ; } return $ this -> datasourceService ; }
Returns the datasource service instance .
55,048
public function merge ( ServerNodeInterface $ serverNode ) { foreach ( $ serverNode -> getCertificates ( ) as $ certificate ) { $ this -> certificates [ ] = $ certificate ; } foreach ( $ serverNode -> getVirtualHosts ( ) as $ virtualHost ) { $ this -> virtualHosts [ ] = $ virtualHost ; } foreach ( $ serverNode -> getLo...
This method merges the passed server node into this one .
55,049
public function invoke ( HttpServletRequestInterface $ servletRequest , HttpServletResponseInterface $ servletResponse ) { $ application = $ servletRequest -> getContext ( ) ; $ message = MessageQueueProtocol :: unpack ( $ servletRequest -> getBodyContent ( ) ) ; $ queueName = $ message -> getDestination ( ) -> getName...
Processes the request by invoking the request handler that attaches the message to the requested queue in a protected context .
55,050
public function equals ( PrincipalInterface $ another ) { if ( $ another instanceof PrincipalInterface ) { $ anotherName = $ another -> getName ( ) ; $ equals = false ; if ( $ this -> name == null ) { $ equals = $ anotherName == null ; } else { $ equals = $ this -> name -> equals ( $ anotherName ) ; } return $ equals ;...
Compare this SimplePrincipal s name against another Principal .
55,051
public static function getServerDirectoryKeysToBeCreated ( ) { return array ( DirectoryKeys :: TMP , DirectoryKeys :: DEPLOY , DirectoryKeys :: WEBAPPS , DirectoryKeys :: VAR_TMP , DirectoryKeys :: VAR_LOG , DirectoryKeys :: VAR_RUN , DirectoryKeys :: ETC , DirectoryKeys :: ETC_APPSERVER , DirectoryKeys :: ETC_APPSERVE...
Returns the application servers directory keys for the directories that has to be created on startup .
55,052
public static function getServerDirectoryKeys ( ) { return array ( DirectoryKeys :: BASE , DirectoryKeys :: TMP , DirectoryKeys :: DEPLOY , DirectoryKeys :: WEBAPPS , DirectoryKeys :: VAR_TMP , DirectoryKeys :: VAR_LOG , DirectoryKeys :: VAR_RUN , DirectoryKeys :: ETC , DirectoryKeys :: ETC_APPSERVER , DirectoryKeys ::...
Returns the all application servers directory keys .
55,053
public static function singleton ( NamingDirectoryInterface $ namingDirectory , GenericStackable $ runlevels ) { if ( ApplicationServer :: $ instance == null ) { ApplicationServer :: $ instance = new ApplicationServer ( $ namingDirectory , $ runlevels ) ; ApplicationServer :: $ instance -> start ( ) ; } return Applicat...
Creates a new singleton application server instance .
55,054
public function runlevelToString ( $ runlevel ) { $ runlevels = array_flip ( Runlevels :: singleton ( ) -> getRunlevels ( ) ) ; if ( isset ( $ runlevels [ $ runlevel ] ) ) { return $ runlevels [ $ runlevel ] ; } throw new \ Exception ( sprintf ( 'Request invalid runlevel to string conversion for %s' , $ runlevel ) ) ; ...
Translates and returns a string representation of the passed runlevel .
55,055
public function runlevelFromString ( $ runlevel ) { if ( Runlevels :: singleton ( ) -> isRunlevel ( $ runlevel ) ) { return Runlevels :: singleton ( ) -> getRunlevel ( $ runlevel ) ; } throw new \ Exception ( sprintf ( 'Request invalid runlevel to string conversion for %s' , $ runlevel ) ) ; }
Translates and returns the runlevel of the passed a string representation .
55,056
public function init ( ConnectionInterface $ conn = null , $ runlevel = ApplicationServerInterface :: FULL ) { $ this -> synchronized ( function ( $ self , $ newRunlevel ) { while ( $ self -> locked === true ) { sleep ( 1 ) ; } $ self -> command = InitCommand :: COMMAND ; $ self -> locked = true ; $ self -> params = $ ...
The runlevel to switch to .
55,057
public function mode ( ConnectionInterface $ conn , $ mode ) { $ this -> synchronized ( function ( $ self , $ newMode ) { while ( $ self -> locked === true ) { sleep ( 1 ) ; } $ self -> command = ModeCommand :: COMMAND ; $ self -> locked = true ; $ self -> params = $ newMode ; $ self -> notify ( ) ; } , $ this , $ mode...
Switch to the passed mode which can either be dev prod or install .
55,058
public function unbindService ( $ runlevel , $ name ) { $ this -> runlevels [ $ runlevel ] [ $ name ] -> stop ( ) ; $ this -> getNamingDirectory ( ) -> unbind ( sprintf ( 'php:services/%s/%s' , $ this -> runlevelToString ( $ runlevel ) , $ name ) ) ; unset ( $ this -> runlevels [ $ runlevel ] [ $ name ] ) ; $ this -> g...
Unbind the service with the passed name and runlevel .
55,059
public function bindService ( $ runlevel , $ service ) { $ this -> runlevels [ $ runlevel ] [ $ service -> getName ( ) ] = $ service ; $ this -> getNamingDirectory ( ) -> bindCallback ( sprintf ( 'php:services/%s/%s' , $ this -> runlevelToString ( $ runlevel ) , $ service -> getName ( ) ) , array ( & $ this , 'getServi...
Binds the passed service to the runlevel .
55,060
protected function doStopServices ( $ runlevel ) { foreach ( array_flip ( $ this -> runlevels [ $ runlevel ] ) as $ name ) { $ this -> unbindService ( $ runlevel , $ name ) ; } }
Stops all services of the passed runlevel .
55,061
protected function doSwitchSetupMode ( $ newMode , $ configurationFilename ) { $ currentUser = $ this -> getNamingDirectory ( ) -> search ( 'php:env/currentUser' ) ; $ service = $ this -> newService ( 'AppserverIo\Appserver\Core\Api\ContainerService' ) ; $ service -> switchSetupMode ( $ newMode , $ configurationFilenam...
Switches the running setup mode to the passed value .
55,062
public function start ( ) { if ( $ this -> isStarted ( ) ) { return ; } $ cookie = new HttpCookie ( $ this -> getName ( ) , $ this -> getId ( ) , $ this -> getLifetime ( ) , $ this -> getMaximumAge ( ) , $ this -> getDomain ( ) , $ this -> getPath ( ) , $ this -> isSecure ( ) , $ this -> isHttpOnly ( ) ) ; $ this -> ge...
Creates and returns the session cookie to be added to the response .
55,063
public function destroy ( $ reason ) { if ( $ this -> getId ( ) != null ) { $ cookie = new HttpCookie ( $ this -> getName ( ) , $ this -> getId ( ) , $ this -> getLifetime ( ) , $ this -> getMaximumAge ( ) , $ this -> getDomain ( ) , $ this -> getPath ( ) , $ this -> isSecure ( ) , $ this -> isHttpOnly ( ) ) ; $ cookie...
Explicitly destroys all session data and adds a cookie to the response that invalidates the session in the browser .
55,064
public function marshall ( ServletSessionInterface $ servletSession ) { $ sessionData = array ( ) ; $ sessionData [ StandardSessionMarshaller :: ID ] = $ servletSession -> getId ( ) ; $ sessionData [ StandardSessionMarshaller :: NAME ] = $ servletSession -> getName ( ) ; $ sessionData [ StandardSessionMarshaller :: LIF...
Transforms the passed session instance into a JSON encoded string . If the data contains objects each of them will be serialized before store them to the persistence layer .
55,065
public function unmarshall ( ServletSessionInterface $ servletSession , $ marshalled ) { $ decodedSession = json_decode ( $ marshalled , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new SessionDataNotReadableException ( json_last_error_msg ( ) ) ; } $ id = $ decodedSession [ StandardSessionMarshaller...
Initializes the session instance from the passed JSON string . If the encoded data contains objects they will be un - serialized before reattached to the session instance .
55,066
protected function findSchemaFile ( $ fileName ) { $ this -> schemaFile = realpath ( __DIR__ . '/../../../../../' ) . DIRECTORY_SEPARATOR . self :: DEFAULT_XML_SCHEMA ; $ fileName = pathinfo ( $ fileName , PATHINFO_FILENAME ) ; if ( isset ( $ this -> schemaFiles [ $ fileName ] ) ) { $ this -> schemaFile = $ this -> sch...
Will try to find the appropriate schema file for the file to validate
55,067
public function init ( ) { $ this -> errors = array ( ) ; $ this -> schemaFile = realpath ( __DIR__ . '/../../../../../' ) . DIRECTORY_SEPARATOR . self :: DEFAULT_XML_SCHEMA ; $ this -> schemaFiles = array ( ) ; }
Initializes the configuration tester . Will reset traces of any former usage
55,068
public function loadConfigurationByFilename ( $ filename ) { $ configurationFile = new \ DOMDocument ( ) ; $ configurationFile -> load ( $ filename ) ; $ configurationFile -> xinclude ( LIBXML_SCHEMA_CREATE ) ; $ paramElement = $ configurationFile -> createElement ( 'param' , APPSERVER_BP ) ; $ paramElement -> setAttri...
Loads the configuration from the passed filename .
55,069
public function validateFile ( $ fileName , $ schemaFile = null , $ failOnErrors = false ) { if ( is_null ( $ schemaFile ) ) { $ this -> findSchemaFile ( $ fileName ) ; $ schemaFile = $ this -> schemaFile ; } ConfigurationUtils :: singleton ( ) -> validateFile ( $ fileName , $ schemaFile , $ failOnErrors ) ; }
Will validate a given file against a schema . This method supports several validation mechanisms for different file types . Will return true if validation passes false otherwise . A specific schema file to use might be passed as well if none is given the tester tries to choose the right one
55,070
public function validateXml ( \ DOMDocument $ domDocument , $ schemaFile = null , $ failOnErrors = false ) { $ schemaFileName = $ this -> schemaFile ; if ( ! is_null ( $ schemaFile ) ) { $ schemaFileName = $ schemaFile ; } ConfigurationUtils :: singleton ( ) -> validateXml ( $ domDocument , $ schemaFileName , $ failOnE...
Will validate a DOM document against a schema file . Will return true if validation passes false otherwise . A specific schema file to use might be passed as well if none is given the tester tries to choose the right one
55,071
public function run ( ) { try { register_shutdown_function ( array ( & $ this , "shutdown" ) ) ; $ actualDir = getcwd ( ) ; $ executeNode = $ this -> jobNode -> getExecute ( ) ; if ( $ script = $ executeNode -> getScript ( ) ) { if ( $ execDir = $ executeNode -> getDirectory ( ) ) { chdir ( $ execDir ) ; } if ( is_file...
Main method that executes the CRON job in a separate thread .
55,072
public static function sudo ( callable $ callable , array $ arguments = array ( ) ) { if ( FileSystem :: getOsIdentifier ( ) === FileSystem :: OS_IDENTIFIER_WIN ) { return call_user_func_array ( $ callable , $ arguments ) ; } $ currentUserId = ( integer ) posix_geteuid ( ) ; $ superUserId = ( integer ) posix_getuid ( )...
Helper method which allows to execute a callable as the super user the server got started by .
55,073
public function locate ( QueueContextInterface $ queueManager , QueueInterface $ queue ) { $ queues = $ queueManager -> getQueues ( ) ; if ( array_key_exists ( $ queueName = $ queue -> getName ( ) , $ queues ) ) { return $ queues [ $ queueName ] ; } }
Tries to locate the queue that handles the request and returns the instance if one can be found .
55,074
public function main ( ) { $ interval = $ this -> getInterval ( ) ; $ directory = $ this -> getDirectory ( ) ; $ this -> getSystemLogger ( ) -> debug ( sprintf ( 'Start watching directory %s' , $ directory ) ) ; $ deploymentFlag = $ this -> getDeploymentFlag ( ) ; while ( $ this -> getLastSuccessfullyDeployment ( $ dep...
Start s the deployment scanner that restarts the server when a PHAR should be deployed or undeployed .
55,075
public function frameCheck ( FrameInterface $ frame ) { if ( false !== $ frame -> getRsv1 ( ) || false !== $ frame -> getRsv2 ( ) || false !== $ frame -> getRsv3 ( ) ) { return $ this -> newCloseFrame ( Frame :: CLOSE_PROTOCOL , 'Ratchet detected an invalid reserve code' ) ; } if ( $ this -> checkForMask && ! $ frame -...
Check a frame to be added to the current message buffer
55,076
public function checkMessage ( MessageInterface $ message ) { if ( ! $ message -> isBinary ( ) ) { if ( ! $ this -> checkUtf8 ( $ message -> getPayload ( ) ) ) { return Frame :: CLOSE_BAD_PAYLOAD ; } } return true ; }
Determine if a message is valid
55,077
public function generateMaskingKey ( ) { $ mask = '' ; for ( $ i = 1 ; $ i <= static :: MASK_LENGTH ; $ i ++ ) { $ mask .= chr ( rand ( 32 , 126 ) ) ; } return $ mask ; }
Create a 4 byte masking key
55,078
public function maskPayload ( $ maskingKey = null ) { if ( null === $ maskingKey ) { $ maskingKey = $ this -> generateMaskingKey ( ) ; } if ( static :: MASK_LENGTH !== strlen ( $ maskingKey ) ) { throw new \ InvalidArgumentException ( "Masking key must be " . static :: MASK_LENGTH . " characters" ) ; } if ( extension_l...
Apply a mask to the payload
55,079
public function unMaskPayload ( ) { if ( ! $ this -> isCoalesced ( ) ) { throw call_user_func ( $ this -> ufeg , 'Frame must be coalesced before applying mask' ) ; } if ( ! $ this -> isMasked ( ) ) { return $ this ; } $ maskingKey = $ this -> getMaskingKey ( ) ; $ this -> secondByte = $ this -> secondByte & ~ 128 ; $ t...
Remove a mask from the payload
55,080
public function applyMask ( $ maskingKey , $ payload = null ) { if ( null === $ payload ) { if ( ! $ this -> isCoalesced ( ) ) { throw call_user_func ( $ this -> ufeg , 'Frame must be coalesced to apply a mask' ) ; } $ payload = substr ( $ this -> data , $ this -> getPayloadStartingByte ( ) , $ this -> getPayloadLength...
Apply a mask to a string or the payload of the instance
55,081
public function extractOverflow ( ) { if ( $ this -> isCoalesced ( ) ) { $ endPoint = $ this -> getPayloadLength ( ) ; $ endPoint += $ this -> getPayloadStartingByte ( ) ; if ( $ this -> bytesRecvd > $ endPoint ) { $ overflow = substr ( $ this -> data , $ endPoint ) ; $ this -> data = substr ( $ this -> data , 0 , $ en...
Sometimes clients will concatenate more than one frame over the wire This method will take the extra bytes off the end and return them
55,082
public function verifyAll ( RequestInterface $ request ) { $ passes = 0 ; $ passes += ( int ) $ this -> verifyMethod ( $ request -> getMethod ( ) ) ; $ passes += ( int ) $ this -> verifyHTTPVersion ( $ request -> getProtocolVersion ( ) ) ; $ passes += ( int ) $ this -> verifyRequestURI ( $ request -> getUri ( ) -> getP...
Given an array of the headers this method will run through all verification methods
55,083
public function verifyConnection ( array $ connectionHeader ) { foreach ( $ connectionHeader as $ l ) { $ upgrades = array_filter ( array_map ( 'trim' , array_map ( 'strtolower' , explode ( ',' , $ l ) ) ) , function ( $ x ) { return 'upgrade' === $ x ; } ) ; if ( count ( $ upgrades ) > 0 ) { return true ; } } return f...
Verify the Connection header
55,084
private function _setStorageAdapter ( string $ adapterName ) : void { $ adapterClassName = self :: STORAGE_MAP [ $ adapterName ] ?? $ adapterName ; if ( ! InterfaceHelper :: implementsInterface ( $ adapterClassName , StorageInterface :: class ) ) { throw new UnknownStorageAdapterException ( $ adapterClassName , \ array...
Sets internal storage adapter for this rule set .
55,085
private function _setCacheStrategy ( string $ cacheStrategy ) : void { $ cacheStrategyClassName = self :: CACHE_STRATEGIES [ $ cacheStrategy ] ?? $ cacheStrategy ; if ( ! InterfaceHelper :: implementsInterface ( $ cacheStrategyClassName , CacheStrategy :: class ) ) { throw new UnknownCacheStrategyException ( $ cacheStr...
Sets the caching strategy for this rule set .
55,086
private function _save ( ) : void { $ this -> _storage -> save ( $ this -> _host , $ this -> _storageKey , $ this -> _requestCount , $ this -> _timekeeper -> getExpiration ( ) , $ this -> getRemainingSeconds ( ) ) ; }
Save timer in storage
55,087
public static function nd ( $ numerator , $ denominator ) : BigRational { $ numerator = BigInteger :: of ( $ numerator ) ; $ denominator = BigInteger :: of ( $ denominator ) ; return new BigRational ( $ numerator , $ denominator , true ) ; }
Creates a BigRational out of a numerator and a denominator .
55,088
public static function zero ( ) : BigRational { static $ zero ; if ( $ zero === null ) { $ zero = new BigRational ( BigInteger :: zero ( ) , BigInteger :: one ( ) , false ) ; } return $ zero ; }
Returns a BigRational representing zero .
55,089
public static function one ( ) : BigRational { static $ one ; if ( $ one === null ) { $ one = new BigRational ( BigInteger :: one ( ) , BigInteger :: one ( ) , false ) ; } return $ one ; }
Returns a BigRational representing one .
55,090
public static function ten ( ) : BigRational { static $ ten ; if ( $ ten === null ) { $ ten = new BigRational ( BigInteger :: ten ( ) , BigInteger :: one ( ) , false ) ; } return $ ten ; }
Returns a BigRational representing ten .
55,091
public function simplified ( ) : BigRational { $ gcd = $ this -> numerator -> gcd ( $ this -> denominator ) ; $ numerator = $ this -> numerator -> quotient ( $ gcd ) ; $ denominator = $ this -> denominator -> quotient ( $ gcd ) ; return new BigRational ( $ numerator , $ denominator , false ) ; }
Returns the simplified value of this BigRational .
55,092
public static function of ( $ value ) : BigNumber { if ( $ value instanceof BigNumber ) { return $ value ; } if ( \ is_int ( $ value ) ) { return new BigInteger ( ( string ) $ value ) ; } if ( is_float ( $ value ) ) { $ value = self :: floatToString ( $ value ) ; } else { $ value = ( string ) $ value ; } if ( \ preg_ma...
Creates a BigNumber of the given value .
55,093
private static function floatToString ( float $ float ) : string { $ currentLocale = \ setlocale ( LC_NUMERIC , '0' ) ; \ setlocale ( LC_NUMERIC , 'C' ) ; $ result = ( string ) $ float ; \ setlocale ( LC_NUMERIC , $ currentLocale ) ; return $ result ; }
Safely converts float to string avoiding locale - dependent issues .
55,094
public static function min ( ... $ values ) : BigNumber { $ min = null ; foreach ( $ values as $ value ) { $ value = static :: of ( $ value ) ; if ( $ min === null || $ value -> isLessThan ( $ min ) ) { $ min = $ value ; } } if ( $ min === null ) { throw new \ InvalidArgumentException ( __METHOD__ . '() expects at leas...
Returns the minimum of the given values .
55,095
public static function max ( ... $ values ) : BigNumber { $ max = null ; foreach ( $ values as $ value ) { $ value = static :: of ( $ value ) ; if ( $ max === null || $ value -> isGreaterThan ( $ max ) ) { $ max = $ value ; } } if ( $ max === null ) { throw new \ InvalidArgumentException ( __METHOD__ . '() expects at l...
Returns the maximum of the given values .
55,096
public static function sum ( ... $ values ) : BigNumber { $ sum = null ; foreach ( $ values as $ value ) { $ value = static :: of ( $ value ) ; if ( $ sum === null ) { $ sum = $ value ; } else { $ sum = self :: add ( $ sum , $ value ) ; } } if ( $ sum === null ) { throw new \ InvalidArgumentException ( __METHOD__ . '()...
Returns the sum of the given values .
55,097
private static function add ( BigNumber $ a , BigNumber $ b ) : BigNumber { if ( $ a instanceof BigRational ) { return $ a -> plus ( $ b ) ; } if ( $ b instanceof BigRational ) { return $ b -> plus ( $ a ) ; } if ( $ a instanceof BigDecimal ) { return $ a -> plus ( $ b ) ; } if ( $ b instanceof BigDecimal ) { return $ ...
Adds two BigNumber instances in the correct order to avoid a RoundingNecessaryException .
55,098
private static function cleanUp ( string $ number ) : string { $ firstChar = $ number [ 0 ] ; if ( $ firstChar === '+' || $ firstChar === '-' ) { $ number = \ substr ( $ number , 1 ) ; } $ number = \ ltrim ( $ number , '0' ) ; if ( $ number === '' ) { return '0' ; } if ( $ firstChar === '-' ) { return '-' . $ number ; ...
Removes optional leading zeros and + sign from the given number .
55,099
private function doAdd ( string $ a , string $ b ) : string { $ length = $ this -> pad ( $ a , $ b ) ; $ carry = 0 ; $ result = '' ; for ( $ i = $ length - $ this -> maxDigits ; ; $ i -= $ this -> maxDigits ) { $ blockLength = $ this -> maxDigits ; if ( $ i < 0 ) { $ blockLength += $ i ; $ i = 0 ; } $ blockA = \ substr...
Performs the addition of two non - signed large integers .