idx
int64
0
60.3k
question
stringlengths
99
4.85k
target
stringlengths
5
718
6,800
public function hasDependency ( $ moduleName , $ dependency , $ recursive = true ) { if ( $ recursive ) { return $ this -> hasPath ( $ moduleName , $ dependency ) ; } return isset ( $ this -> dependencies [ $ moduleName ] [ $ dependency ] ) ; }
Returns whether a module directly depends on another module .
6,801
public function hasPath ( $ moduleName , $ dependency ) { if ( ! isset ( $ this -> dependencies [ $ moduleName ] ) ) { return false ; } if ( isset ( $ this -> dependencies [ $ moduleName ] [ $ dependency ] ) ) { return true ; } foreach ( $ this -> dependencies [ $ moduleName ] as $ predecessor => $ _ ) { if ( $ this ->...
Returns whether a path exists from a module to a dependency .
6,802
public function getPath ( $ moduleName , $ dependency ) { if ( $ this -> getPathDFS ( $ moduleName , $ dependency , $ reversePath ) ) { return array_reverse ( $ reversePath ) ; } return null ; }
Returns the path from a module name to a dependency .
6,803
private function getPathDFS ( $ moduleName , $ dependency , & $ reversePath = array ( ) ) { if ( ! isset ( $ this -> dependencies [ $ moduleName ] ) ) { return false ; } $ reversePath [ ] = $ moduleName ; if ( isset ( $ this -> dependencies [ $ moduleName ] [ $ dependency ] ) ) { $ reversePath [ ] = $ dependency ; retu...
Finds a path between modules using Depth - First Search .
6,804
private function sortModulesDFS ( $ currentName , array & $ namesToSort , array & $ output ) { unset ( $ namesToSort [ $ currentName ] ) ; foreach ( $ this -> dependencies [ $ currentName ] as $ predecessor => $ _ ) { if ( isset ( $ namesToSort [ $ predecessor ] ) ) { $ this -> sortModulesDFS ( $ predecessor , $ namesT...
Topologically sorts the given module name into the output array .
6,805
public function getAdapter ( array $ configs ) { if ( $ configs [ 'force_absolute_url' ] === true ) { $ this -> urlRelative = $ this -> urlAbsolute ; } return new LocalAdapter ( $ this -> path ) ; }
Get Adapter .
6,806
public function onsubmitCallback ( $ dc ) { $ activeRecord = $ dc -> activeRecord ; if ( ! $ activeRecord ) { return ; } if ( $ activeRecord -> type === 'rs_columns_start' || $ activeRecord -> type === 'rs_column_start' ) { $ nextElement = \ Database :: getInstance ( ) -> prepare ( ' SELECT type FROM tl_content...
tl_content DCA onsubmit callback
6,807
public function saveConfigFile ( ConfigFile $ configFile ) { $ this -> saveFile ( $ configFile , $ configFile -> getPath ( ) ) ; if ( $ this -> factoryManager ) { $ this -> factoryManager -> autoGenerateFactoryClass ( ) ; } }
Saves a configuration file .
6,808
public function saveModuleFile ( ModuleFile $ moduleFile ) { $ this -> saveFile ( $ moduleFile , $ moduleFile -> getPath ( ) , array ( 'targetVersion' => $ moduleFile -> getVersion ( ) , ) ) ; }
Saves a module file .
6,809
public function saveRootModuleFile ( RootModuleFile $ moduleFile ) { $ this -> saveFile ( $ moduleFile , $ moduleFile -> getPath ( ) , array ( 'targetVersion' => $ moduleFile -> getVersion ( ) , ) ) ; if ( $ this -> factoryManager ) { $ this -> factoryManager -> autoGenerateFactoryClass ( ) ; } }
Saves a root module file .
6,810
public function addMapping ( PathMapping $ mapping ) { if ( ! $ mapping -> isLoaded ( ) ) { throw new NotLoadedException ( 'The passed mapping must be loaded.' ) ; } $ moduleName = $ mapping -> getContainingModule ( ) -> getName ( ) ; $ previousMapping = isset ( $ this -> mappings [ $ moduleName ] ) ? $ this -> mapping...
Adds a path mapping involved in the conflict .
6,811
public function removeMapping ( PathMapping $ mapping ) { if ( ! $ mapping -> isLoaded ( ) ) { throw new NotLoadedException ( 'The passed mapping must be loaded.' ) ; } $ moduleName = $ mapping -> getContainingModule ( ) -> getName ( ) ; if ( ! isset ( $ this -> mappings [ $ moduleName ] ) || $ mapping !== $ this -> ma...
Removes a path mapping from the conflict .
6,812
public function resolve ( ) { foreach ( $ this -> mappings as $ mapping ) { $ mapping -> removeConflict ( $ this ) ; } $ this -> mappings = array ( ) ; }
Resolves the conflict .
6,813
private function buildMatchPart ( $ field , FilterState $ state ) { if ( strpos ( $ field , '>' ) !== false ) { list ( $ path , $ field ) = explode ( '>' , $ field ) ; } if ( strpos ( $ field , '^' ) !== false ) { list ( $ field , $ boost ) = explode ( '^' , $ field ) ; } $ query = new MatchQuery ( $ field , $ state ->...
Build possibly nested match part .
6,814
public function add ( Module $ module ) { $ this -> modules [ $ module -> getName ( ) ] = $ module ; if ( $ module instanceof RootModule ) { $ this -> rootModule = $ module ; } }
Adds a module to the collection .
6,815
public function remove ( $ name ) { if ( $ this -> rootModule && $ name === $ this -> rootModule -> getName ( ) ) { $ this -> rootModule = null ; } unset ( $ this -> modules [ $ name ] ) ; }
Removes a module from the collection .
6,816
public function get ( $ name ) { if ( ! isset ( $ this -> modules [ $ name ] ) ) { throw new NoSuchModuleException ( sprintf ( 'The module "%s" was not found.' , $ name ) ) ; } return $ this -> modules [ $ name ] ; }
Returns the module with the given name .
6,817
public function getInstalledModules ( ) { $ modules = $ this -> modules ; if ( $ this -> rootModule ) { unset ( $ modules [ $ this -> rootModule -> getName ( ) ] ) ; } return $ modules ; }
Returns all installed modules .
6,818
public function claim ( $ token , $ moduleName ) { if ( ! isset ( $ this -> tokens [ $ token ] ) ) { $ this -> tokens [ $ token ] = array ( ) ; } $ this -> tokens [ $ token ] [ $ moduleName ] = true ; }
Claims a token for a module .
6,819
public function detectConflicts ( array $ tokens = null ) { $ tokens = null === $ tokens ? array_keys ( $ this -> tokens ) : $ tokens ; $ conflicts = array ( ) ; foreach ( $ tokens as $ token ) { if ( ! isset ( $ this -> tokens [ $ token ] ) ) { continue ; } $ moduleNames = array_keys ( $ this -> tokens [ $ token ] ) ;...
Checks the passed tokens for conflicts .
6,820
private function scanDirectory ( $ directoryPath ) { if ( is_dir ( $ directoryPath ) ) { $ files = scandir ( $ directoryPath ) ; foreach ( $ files as $ fileName ) { $ filePath = Path :: join ( $ directoryPath , $ fileName ) ; if ( is_dir ( $ filePath ) && ! in_array ( $ fileName , [ '.' , '..' ] ) ) { $ this -> scanDir...
Recursive search for matching files .
6,821
private function installerToData ( InstallerDescriptor $ installer ) { $ data = ( object ) array ( 'class' => $ installer -> getClassName ( ) , ) ; if ( $ installer -> getDescription ( ) ) { $ data -> description = $ installer -> getDescription ( ) ; } if ( $ installer -> getParameters ( ) ) { $ data -> parameters = $ ...
Extracting an object containing the data from an installer descriptor .
6,822
private function removeRsfhrParam ( $ ref ) { $ session = \ System :: getContainer ( ) -> get ( 'session' ) ; if ( ! $ session -> isStarted ( ) ) { return ; } $ referrerSession = $ session -> get ( 'referer' ) ; if ( ! empty ( $ referrerSession [ $ ref ] [ 'current' ] ) ) { $ referrerSession [ $ ref ] [ 'current' ] = p...
Remove the rsfhr = 1 parameter from the session referer
6,823
private function handleTemplateSelection ( ) { if ( \ Input :: get ( 'key' ) !== 'new_tpl' ) { return ; } if ( \ Input :: get ( 'original' ) && ! \ Input :: post ( 'original' ) ) { \ Input :: setPost ( 'original' , \ Input :: get ( 'original' ) ) ; } if ( \ Input :: get ( 'target' ) && ! \ Input :: post ( 'target' ) ) ...
Preselects the original template in the template editor
6,824
private function storeFrontendReferrer ( ) { $ base = \ Environment :: get ( 'path' ) ; $ base .= \ System :: getContainer ( ) -> get ( 'router' ) -> generate ( 'contao_backend' ) ; $ referrer = parse_url ( \ Environment :: get ( 'httpReferer' ) ) ; $ referrer = $ referrer [ 'path' ] . ( $ referrer [ 'query' ] ? '?' . ...
Saves the referrer in the session if it is a frontend URL
6,825
public function setVersion ( $ version ) { Assert :: string ( $ version , 'The module file version must be a string. Got: %s' ) ; Assert :: regex ( $ version , '~^\d\.\d$~' , 'The module file version must have the format "<digit>.<digit>". Got: %s</digit>' ) ; $ this -> version = $ version ; }
Sets the version of the module file .
6,826
public function setDependencies ( array $ moduleNames ) { $ this -> dependencies = array ( ) ; foreach ( $ moduleNames as $ moduleName ) { $ this -> dependencies [ $ moduleName ] = true ; } }
Sets the names of the modules this module depends on .
6,827
public function getPathMapping ( $ repositoryPath ) { if ( ! isset ( $ this -> pathMappings [ $ repositoryPath ] ) ) { throw NoSuchPathMappingException :: forRepositoryPath ( $ repositoryPath ) ; } return $ this -> pathMappings [ $ repositoryPath ] ; }
Returns the path mapping for a repository path .
6,828
public function getBindingDescriptor ( Uuid $ uuid ) { $ uuidString = $ uuid -> toString ( ) ; if ( ! isset ( $ this -> bindingDescriptors [ $ uuidString ] ) ) { throw NoSuchBindingException :: forUuid ( $ uuid ) ; } return $ this -> bindingDescriptors [ $ uuidString ] ; }
Returns the binding descriptor with the given UUID .
6,829
public function getExtraKey ( $ key , $ default = null ) { return array_key_exists ( $ key , $ this -> extra ) ? $ this -> extra [ $ key ] : $ default ; }
Returns the value of an extra key .
6,830
private function getBackground ( ) { return ( new Circle ( $ this -> getX ( ) , $ this -> getY ( ) , $ this -> getRadius ( ) ) ) -> setFillColor ( $ this -> getBackgroundColor ( ) ) -> setStrokeWidth ( 0 ) ; }
Returns the background for the image .
6,831
private function getCenter ( Color $ color ) { return ( new Circle ( $ this -> getX ( ) , $ this -> getY ( ) , $ this -> getCenterRadius ( ) ) ) -> setFillColor ( $ color ) -> setStrokeWidth ( 0 ) ; }
Returns the center dot for the image .
6,832
private function getArc ( Color $ color , $ x , $ y , $ radius , $ angle , $ width , $ start = 0 ) { return ( new Path ( $ x + $ radius * cos ( deg2rad ( $ start ) ) , $ y + $ radius * sin ( deg2rad ( $ start ) ) ) ) -> setFillColor ( $ color ) -> setStrokeColor ( $ color ) -> setStrokeWidth ( 1 ) -> arcTo ( $ x + $ ra...
Returns an arc drawn according to the passed specification .
6,833
private function getRingAngle ( $ ring , $ hash ) { return 10 * pow ( 2 , 3 - $ ring ) * array_reduce ( str_split ( $ hash , pow ( 2 , 3 - $ ring ) ) , function ( $ total , $ substr ) { return $ total + ( hexdec ( $ substr ) % 2 ) ; } , 0 ) ; }
Returns the angle in degrees for the given ring based on the hash .
6,834
public function createPHPWordObject ( $ filename = null ) { return ( null === $ filename ) ? new PhpWord ( ) : call_user_func ( array ( $ this -> phpWordIO , 'load' ) , $ filename ) ; }
Creates an empty PhpWord Object if the filename is empty otherwise loads the file into the object .
6,835
public function getPhpWordObjFromTemplate ( $ templateobj ) { $ fileName = $ templateobj -> save ( ) ; $ phpWordObject = IOFactory :: load ( $ fileName ) ; unlink ( $ fileName ) ; return $ phpWordObject ; }
From the template load the
6,836
public function reconfigure ( array $ settings = [ ] ) : void { if ( $ this -> is_running ) { throw new Exceptions \ KernelAlreadyRunningException ( "You cannot reconfigure a running kernel." ) ; } $ this [ "settings" ] = $ settings ; $ this [ "config" ] = $ this -> share ( function ( $ c ) { $ config = new \ Zend \ Co...
Sets up the kernel settings .
6,837
protected function setupServices ( ) : void { $ service_factory = new Services \ ServiceFactory ( $ this ) ; foreach ( $ this -> config ( ) -> services -> toArray ( ) as $ key => $ service ) { $ this [ $ key ] = $ this -> share ( function ( $ c ) use ( $ key , $ service , $ service_factory ) { try { return $ service_fa...
Sets up kernel services .
6,838
protected function registerListeners ( Graph \ GraphInterface $ graph ) : void { $ this -> logger ( ) -> info ( "Registering listeners." ) ; $ nodes = array_values ( $ graph -> members ( ) ) ; $ node_count = count ( $ nodes ) ; $ this -> logger ( ) -> info ( "Total # of nodes for the graph \"%s\": %s" , $ graph -> id (...
Registers listeners that are default to the kernel .
6,839
protected function seedRoot ( ? Foundation \ AbstractActor $ founder = null ) : void { $ graph_id = $ this -> database ( ) -> get ( "configs:graph_id" ) ; if ( isset ( $ graph_id ) ) { $ this -> logger ( ) -> info ( "Existing network with id: %s" , $ graph_id ) ; $ this [ "graph" ] = $ this -> share ( function ( $ c ) ...
Ensures that there is a root Graph attached to the kernel . Used privately by the kernel .
6,840
public function setFormat ( $ format , $ commitDelimiter , $ fieldDelimiter ) { if ( ! is_string ( $ format ) ) { throw new InvalidArgumentException ( 'string' , 0 ) ; } if ( ! is_string ( $ commitDelimiter ) ) { throw new InvalidArgumentException ( 'string' , 1 ) ; } if ( ! is_string ( $ fieldDelimiter ) ) { throw new...
Set the format that should be used by git log command
6,841
public function writeLink ( $ target ) { $ fileName = basename ( $ target ) ; $ realTarget = realpath ( $ target ) ; $ relativePathToTarget = $ this -> makePathRelative ( dirname ( $ realTarget ) , $ this -> binaryDir ) . basename ( $ realTarget ) ; if ( pathinfo ( $ target , PATHINFO_EXTENSION ) == "cmd" ) { $ this ->...
Writes a shortcut to the target link in the vendor directory .
6,842
public function viewPath ( ) { return is_null ( $ this -> options [ 'views_path' ] ) ? public_path ( $ this -> options [ 'public_dirname' ] . '/' . $ this -> name ( ) . '/views' ) : rtrim ( $ this -> options [ 'views_path' ] , '/' ) . '/' . $ this -> name ( ) ; }
Get current theme view path .
6,843
public function publicPath ( $ path = '' ) { return public_path ( $ this -> options [ 'public_dirname' ] . '/' . $ this -> name ( ) . ( empty ( $ path ) ? '' : '/' . rtrim ( $ path ) ) ) ; }
Get the fully qualified path to the theme public directory .
6,844
public function registerConnections ( ) { $ driver = $ this -> app [ 'nomad.feature.detection' ] -> connectionResolverDriver ( ) ; $ method = 'registerVia' . studly_case ( $ driver ) ; if ( method_exists ( $ this , $ method ) ) { return $ this -> { $ method } ( ) ; } throw new LogicException ( sprintf ( 'Connection reg...
Register the database connection extensions .
6,845
public function registerViaConnectionMethod ( ) { foreach ( $ this -> classes as $ driver => $ class ) { Connection :: resolverFor ( $ driver , function ( $ connection , $ database , $ prefix , $ config ) use ( $ class ) { return new $ class ( $ connection , $ database , $ prefix , $ config ) ; } ) ; } }
Register the database connection extensions through the Connection method .
6,846
protected function typePassthru ( Fluent $ column ) { return ! empty ( $ column -> definition ) ? $ column -> definition : $ column -> realType ; }
Create the column definition for a string type .
6,847
function readComment ( ) { $ str = substr ( $ this -> source , $ this -> index ) ; $ result = preg_match ( '/^(.*?)(?:\r\n|\n|$)/' , $ str , $ matches ) ; $ this -> index += ( $ result ) ? strlen ( $ matches [ 0 ] ) : 0 ; return substr ( $ matches [ 1 ] , 1 ) ; }
a comment doesn t have to end with a semicolon
6,848
protected function checkProperties ( ) : void { foreach ( get_object_vars ( $ this ) as $ property => $ value ) { if ( $ property !== "dueDate" && strpos ( $ value , "*" ) !== false ) { throw new QrPaymentException ( "Error: properties cannot contain asterisk (*). Property $property contains it." , QrPaymentException :...
Checks all properties for asterisk and throws exception if asterisk is found
6,849
public function getQrImage ( bool $ setPngHeader = false ) : QrCode { if ( ! class_exists ( "Endroid\QrCode\QrCode" ) ) { throw new QrPaymentException ( "Error: library endroid/qr-code is not loaded." , QrPaymentException :: ERR_MISSING_LIBRARY ) ; } if ( $ setPngHeader ) { header ( "Content-type: image/png" ) ; } retu...
Return QrCode object with QrString set for more info see Endroid QrCode documentation
6,850
public function collectAndWriteCoverage ( $ args ) { if ( $ this -> valid ( $ args ) ) { extract ( $ args ) ; if ( isset ( $ hook ) && $ hook instanceof HookInterface ) { $ this -> hook = $ hook ; unset ( $ hook ) ; } $ coverage_dir = realpath ( $ coverage_dir ) ; $ coverage_file = $ coverage_dir . DIRECTORY_SEPARATOR ...
Main api for collecting code - coverage information and write it into json payload
6,851
public function collectAndSendCoverage ( $ args ) { $ this -> collectAndWriteCoverage ( $ args ) ; if ( $ this -> valid ( $ args ) ) { extract ( $ args ) ; $ coverage_dir = realpath ( $ coverage_dir ) ; $ coverage_output = $ coverage_dir . DIRECTORY_SEPARATOR . self :: COVERAGE_OUTPUT ; $ this -> printer -> out ( 'Send...
Main api for collecting code - coverage information
6,852
protected function collect ( SimpleXMLElement $ coverage , $ args = array ( ) ) { extract ( $ args ) ; $ data = new Collection ( array ( 'repo_token' => $ repo_token , 'source_files' => array ( ) , 'run_at' => gmdate ( 'Y-m-d H:i:s -0000' ) , 'git' => $ this -> collectFromGit ( ) -> all ( ) , ) ) ; if ( ! empty ( $ thi...
Main collector method
6,853
protected function collectFromFile ( SimpleXMLElement $ file , $ namespace = '' ) { if ( ! is_file ( $ file [ 'name' ] ) ) throw new \ RuntimeException ( 'Invalid ' . self :: COVERAGE_FILE . ' file' ) ; $ currentDir = $ this -> getDirectory ( ) ; $ name = '' ; $ source = '' ; $ coverage = array ( ) ; $ pathComponents =...
Collect code - coverage information from a file
6,854
public function collectFromGit ( ) { $ git = new Collection ( ) ; $ gitDirectory = $ this -> getDirectory ( ) . DIRECTORY_SEPARATOR . self :: GIT_DIRECTORY ; if ( is_dir ( $ gitDirectory ) ) { $ branch = '' ; $ head = Yaml :: parse ( $ gitDirectory . DIRECTORY_SEPARATOR . self :: GIT_HEAD ) ; if ( is_array ( $ head ) &...
Collect git information
6,855
protected static function execute ( $ command ) { $ res = array ( ) ; ob_start ( ) ; passthru ( $ command , $ success ) ; $ output = ob_get_clean ( ) ; foreach ( ( explode ( "\n" , $ output ) ) as $ line ) $ res [ ] = trim ( $ line ) ; return array_filter ( $ res ) ; }
Execute a command and parse the output as array
6,856
protected function _setPermission ( string $ pointer , string $ mode ) : void { $ this -> permissions [ $ pointer ] = $ mode ; $ pointer_with_special_graph = '/^g:([a-f0-9\-]+):$/i' ; if ( preg_match ( $ pointer_with_special_graph , $ pointer , $ matches ) ) { $ this -> permissions_with_graph [ ] = $ matches [ 1 ] ; } ...
Internal permission setter
6,857
public function get ( string $ entity_pointer ) : string { if ( isset ( $ this -> permissions [ $ entity_pointer ] ) ) { return $ this -> permissions [ $ entity_pointer ] ; } throw new Exceptions \ NonExistentAclPointer ( $ entity_pointer , ( string ) $ this -> core -> id ( ) ) ; }
Retrieves the permissions for this node with the given pointer
6,858
public function del ( string $ entity_pointer ) : void { $ valid_pointer = "/^([ug]):([a-f0-9\-]+):$/i" ; if ( ! preg_match ( $ valid_pointer , $ entity_pointer , $ matches ) ) { throw new Exceptions \ InvalidAclPointerException ( $ entity_pointer , $ valid_pointer , __FUNCTION__ ) ; } $ type = $ matches [ 1 ] ; $ uuid...
can delete specific users and graphs
6,859
public function process ( $ send = false ) { try { $ method = $ this -> getRequest ( ) -> getMethod ( ) ; switch ( $ method ) { case 'POST' : if ( ! $ this -> checkTusVersion ( ) ) { throw new Exception \ Request ( 'The requested protocol version is not supported' , \ Zend \ Http \ Response :: STATUS_CODE_405 ) ; } $ t...
Process the client request
6,860
private function checkTusVersion ( ) { $ tusVersion = $ this -> getRequest ( ) -> getHeader ( 'Tus-Resumable' ) ; if ( $ tusVersion instanceof \ Zend \ Http \ Header \ HeaderInterface ) { return $ tusVersion -> getFieldValue ( ) === self :: TUS_VERSION ; } return false ; }
Checks compatibility with requested Tus protocol
6,861
private function processPost ( ) { if ( $ this -> existsInMetaData ( $ this -> uuid , 'ID' ) === true ) { throw new \ Exception ( 'The UUID already exists' ) ; } $ headers = $ this -> extractHeaders ( array ( 'Upload-Length' , 'Upload-Metadata' ) ) ; if ( is_numeric ( $ headers [ 'Upload-Length' ] ) === false || $ head...
Process the POST request
6,862
private function processHead ( ) { if ( $ this -> existsInMetaData ( $ this -> uuid , 'ID' ) === false ) { $ this -> getResponse ( ) -> setStatusCode ( PhpResponse :: STATUS_CODE_404 ) ; return ; } if ( ! file_exists ( $ this -> directory . $ this -> getFilename ( ) ) ) { $ this -> removeFromMetaData ( $ this -> uuid )...
Process the HEAD request
6,863
private function processGet ( $ send ) { if ( ! $ this -> allowGetMethod ) { throw new Exception \ Request ( 'The requested method ' . $ method . ' is not allowed' , \ Zend \ Http \ Response :: STATUS_CODE_405 ) ; } $ file = $ this -> directory . $ this -> getFilename ( ) ; if ( ! file_exists ( $ file ) ) { throw new E...
Process the GET request
6,864
private function addCommonHeader ( $ isOption = false ) { $ headers = $ this -> getResponse ( ) -> getHeaders ( ) ; $ headers -> addHeaderLine ( 'Tus-Resumable' , self :: TUS_VERSION ) ; $ headers -> addHeaderLine ( 'Access-Control-Allow-Origin' , '*' ) ; $ headers -> addHeaderLine ( 'Access-Control-Expose-Headers' , '...
Add the commons headers to the HTTP response
6,865
private function extractHeaders ( $ headers ) { if ( is_array ( $ headers ) === false ) { throw new \ InvalidArgumentException ( 'Headers must be an array' ) ; } $ headers_values = array ( ) ; foreach ( $ headers as $ headerName ) { $ headerObj = $ this -> getRequest ( ) -> getHeader ( $ headerName ) ; if ( $ headerObj...
Extract a list of headers in the HTTP headers
6,866
private function setDirectory ( $ directory ) { if ( is_string ( $ directory ) === false ) { throw new \ InvalidArgumentException ( 'Directory must be a string' ) ; } if ( is_dir ( $ directory ) === false || is_writable ( $ directory ) === false ) { throw new Exception \ File ( $ directory . ' doesn\'t exist or isn\'t ...
Set the directory where the file will be store
6,867
private function getMetaData ( ) { if ( $ this -> metaData === null ) { $ this -> metaData = $ this -> readMetaData ( $ this -> getUserUuid ( ) ) ; } return $ this -> metaData ; }
Get the session info
6,868
private function setMetaDataValue ( $ id , $ key , $ value ) { $ data = $ this -> getMetaData ( $ id ) ; if ( isset ( $ data [ $ key ] ) ) { $ data [ $ key ] = $ value ; } else { throw new \ Exception ( $ key . ' is not defined in medatada' ) ; } }
Set a value in the session
6,869
private function getMetaDataValue ( $ id , $ key ) { $ data = $ this -> getMetaData ( $ id ) ; if ( isset ( $ data [ $ key ] ) ) { return $ data [ $ key ] ; } throw new \ Exception ( $ key . ' is not defined in medatada' ) ; }
Get a value from session
6,870
private function saveMetaData ( $ size , $ offset = 0 , $ isFinal = false , $ isPartial = false ) { $ this -> setMetaDataValue ( $ this -> getUserUuid ( ) , 'ID' , $ this -> getUserUuid ( ) ) ; $ this -> metaData [ 'ID' ] = $ this -> getUserUuid ( ) ; $ this -> metaData [ 'Offset' ] = $ offset ; $ this -> metaData [ 'I...
Saves metadata about uploaded file . Metadata are saved into a file with name mask uuid . info
6,871
private function readMetaData ( $ name ) { $ refData = [ 'ID' => '' , 'Size' => 0 , 'Offset' => 0 , 'Extension' => '' , 'FileName' => '' , 'MimeType' => '' , 'IsPartial' => true , 'IsFinal' => false , 'PartialUploads' => null , ] ; $ storageFileName = $ this -> directory . $ name . '.info' ; if ( file_exists ( $ storag...
Reads or initialize metadata about file .
6,872
private function setRealFileName ( $ value ) { $ base64FileNamePos = strpos ( $ value , 'filename ' ) ; if ( is_int ( $ base64FileNamePos ) && $ base64FileNamePos >= 0 ) { $ value = substr ( $ value , $ base64FileNamePos + 9 ) ; $ this -> realFileName = base64_decode ( $ value ) ; } else { $ this -> realFileName = $ va...
Sets real file name
6,873
public function setAllowMaxSize ( $ value ) { $ value = intval ( $ value ) ; if ( $ value > 0 ) { $ this -> allowMaxSize = $ value ; } else { throw new \ BadMethodCallException ( 'given $value must be integer, greater them 0' ) ; } return $ this ; }
Sets upload size limit
6,874
private function _mergeDependencyVersions ( array $ array1 , array $ array2 ) { foreach ( $ array2 as $ package => $ version ) { if ( ! isset ( $ array1 [ $ package ] ) ) { $ array1 [ $ package ] = $ version ; } else { if ( $ array1 [ $ package ] != $ version ) { $ array1 [ $ package ] .= " " . $ version ; } } } return...
Merges 2 version of arrays .
6,875
protected function getRequestData ( ) { if ( Yii :: $ app -> request -> method === 'POST' ) { return $ this -> getRealPOSTData ( ) ; } if ( Yii :: $ app -> request -> method === 'GET' ) { $ requestData = Yii :: $ app -> request -> get ( ) ; unset ( $ requestData [ 'action' ] ) ; return $ requestData ; } throw new BadRe...
Returns an array of all request parameters .
6,876
public function node ( string $ node_id ) : Graph \ NodeInterface { if ( isset ( $ this -> node_cache [ $ node_id ] ) ) { return $ this -> node_cache [ $ node_id ] ; } $ query = ( string ) $ node_id ; $ node = $ this -> database -> get ( $ query ) ; if ( is_null ( $ node ) ) { throw new Exceptions \ NodeDoesNotExistExc...
Retrieves a node
6,877
public function edge ( string $ edge_id ) : Graph \ EdgeInterface { if ( isset ( $ this -> edge_cache [ $ edge_id ] ) ) return $ this -> edge_cache [ $ edge_id ] ; $ query = ( string ) $ edge_id ; $ edge = $ this -> database -> get ( $ query ) ; if ( is_null ( $ edge ) ) { throw new Exceptions \ EdgeDoesNotExistExcepti...
Retrieves an edge
6,878
public function touch ( EntityInterface $ entity ) : void { $ this -> logger -> info ( "Touching %s" , $ entity -> id ( ) -> toString ( ) ) ; $ this -> database -> set ( ( string ) $ entity -> id ( ) , serialize ( $ entity ) ) ; $ this -> logger -> info ( "Indexing %s" , $ entity -> id ( ) -> toString ( ) ) ; $ arr = $...
Creates the entity in the graphsystem
6,879
public static function downloadFile ( $ filePath , $ fileName , $ mime = '' , $ size = - 1 , $ openMode = self :: OPEN_MODE_ATTACHMENT ) { if ( ! file_exists ( $ filePath ) ) { throw new Exception \ FileNotFoundException ( null , 0 , null , $ filePath ) ; } if ( ! is_readable ( $ filePath ) ) { throw new Exception \ Fi...
Handles file download to browser
6,880
public static function detectMimeType ( $ fileName , $ userFileName = '' ) { if ( ! file_exists ( $ fileName ) ) { return '' ; } $ mime = '' ; if ( class_exists ( 'finfo' , false ) ) { $ const = defined ( 'FILEINFO_MIME_TYPE' ) ? FILEINFO_MIME_TYPE : FILEINFO_MIME ; if ( empty ( $ mime ) ) { $ mime = @ finfo_open ( $ c...
Internal method to detect the mime type of a file
6,881
public function boot ( ? Foundation \ AbstractActor $ founder = null ) : void { if ( $ this -> is_running ) { throw new Exceptions \ KernelAlreadyRunningException ( ) ; } $ GLOBALS [ "kernel" ] = & $ this ; $ this -> is_running = true ; $ this -> setupServices ( ) ; $ this -> gs ( ) -> init ( ) ; $ this [ "logger" ] ->...
Initializes the kernel .
6,882
private function _matchIp ( $ currentIp ) { $ settings = $ this -> _getSettings ( ) ; foreach ( $ settings -> ipWhitelist as $ craftUsername => $ ips ) { $ filteredIps = array_filter ( $ ips , function ( $ ip ) { return filter_var ( $ ip , FILTER_VALIDATE_IP ) ; } ) ; if ( in_array ( $ currentIp , $ filteredIps ) ) { r...
Match IP against whitelist
6,883
private function _loginByUsername ( $ username , $ redirectMode = self :: REDIRECT_MODE_SITE ) { $ craftUser = Craft :: $ app -> users -> getUserByUsernameOrEmail ( $ username ) ; if ( $ craftUser ) { $ success = Craft :: $ app -> user -> loginByUserId ( $ craftUser -> id ) ; if ( $ success ) { return $ this -> _afterL...
Login by username or email
6,884
public function setGitDir ( $ dir , $ check = true ) { if ( ! is_string ( $ dir ) ) { throw new InvalidArgumentException ( 'string' , 0 ) ; } if ( $ check && ! realpath ( $ dir ) ) { throw new Exception ( "Directory $dir does not exist" ) ; } $ this -> gitDir = $ dir ; $ this -> command -> chdir ( $ dir ) ; return $ th...
Set the directory where git log should be run on
6,885
public function setBranch ( $ branch ) { if ( ! is_string ( $ branch ) ) { throw new InvalidArgumentException ( 'string' , 0 ) ; } $ oldBranch = $ this -> branch ; $ oldArg = $ this -> command -> searchArgument ( $ oldBranch ) ; if ( ! $ oldArg ) { throw new Exception ( "Couldn't change the command to new branch. Was t...
Set the branch that should be logged
6,886
public function parse ( ) { $ result = $ this -> command -> run ( ) ; $ log = $ result -> getStdOut ( ) ; $ buffer = array ( ) ; $ commits = explode ( $ this -> format -> getCommitDelimiter ( ) , $ log ) ; foreach ( $ commits as $ commit ) { $ fields = explode ( $ this -> format -> getFieldDelimiter ( ) , $ commit ) ; ...
Parse the git log
6,887
public function phonetic_sentence ( $ input , $ useStopWords = true , $ skipShortWords = 2 , $ key = null ) { $ words = array ( ) ; static $ STOP_WORDS_CACHE = array ( ) ; if ( $ skipShortWords === false ) { $ skipShortWords = null ; } if ( \ is_array ( $ input ) === true ) { foreach ( $ input as $ inputKey => $ inputS...
Phonetic for more then one word .
6,888
public static function setup ( $ obj ) : void { if ( $ obj instanceof Graph \ GraphInterface ) { Hooks \ Graph :: setup ( $ obj ) ; } if ( $ obj instanceof Graph \ EdgeInterface ) { Hooks \ Edge :: setup ( $ obj ) ; } elseif ( $ obj instanceof Graph \ NodeInterface ) { Hooks \ Node :: setup ( $ obj ) ; } elseif ( $ obj...
Detects the object type and calls the right Hooks class .
6,889
function paginate ( ) { $ all_rs = $ this -> conn -> prepare ( $ this -> sql ) ; $ all_rs -> execute ( ) ; if ( ! $ all_rs ) { if ( $ this -> debug ) echo "SQL query failed. Check your query.<br /><br />Error Returned: " . mysql_error ( ) ; return false ; } $ this -> total_rows = $ all_rs -> rowCount ( ) ; if ( $ this ...
Executes the SQL query and initializes internal variables
6,890
function renderPrev ( $ tag = '&lt;&lt;' ) { if ( $ this -> total_rows == 0 ) return FALSE ; if ( $ this -> page > 1 ) { $ pageno = $ this -> page - 1 ; return " <a href='javascript:void(0);' OnClick='getdata( $pageno )' title='Anterior'>$tag</a> " ; } else { return " $tag " ; } }
Display the previous link
6,891
function renderFullNav ( ) { return $ this -> renderFirst ( ) . '&nbsp;' . $ this -> renderPrev ( ) . '&nbsp;' . $ this -> renderNav ( ) . '&nbsp;' . $ this -> renderNext ( ) . '&nbsp;' . $ this -> renderLast ( ) ; }
Display full pagination navigation
6,892
function sanitize_key ( $ key ) { $ raw_key = $ key ; $ key = strtolower ( $ key ) ; $ key = preg_replace ( '/[^a-z0-9_\-]/' , '' , $ key ) ; return $ key ; }
Sanitizes a string key .
6,893
public static function chaikinAccumulationDistributionLine ( array $ high , array $ low , array $ close , array $ volume ) : array { return static :: ad ( $ high , $ low , $ close , $ volume ) ; }
Chaikin Accumulation Distribution Line
6,894
public static function chaikinAccumulationDistributionOscillator ( array $ high , array $ low , array $ close , array $ volume , int $ fastPeriod = null , int $ slowPeriod = null ) : array { return static :: adosc ( $ high , $ low , $ close , $ volume , $ fastPeriod , $ slowPeriod ) ; }
Chaikin Accumulation Distribution Oscillator
6,895
public static function cmo ( array $ real , int $ timePeriod = null ) : array { $ timePeriod = $ timePeriod ?? 14 ; $ return = trader_cmo ( $ real , $ timePeriod ) ; static :: checkForError ( ) ; return $ return ; }
Chande Momentum Oscillator
6,896
public static function dema ( array $ real , int $ timePeriod = null ) : array { $ timePeriod = $ timePeriod ?? 30 ; $ return = trader_dema ( $ real , $ timePeriod ) ; static :: checkForError ( ) ; return $ return ; }
Double Exponential Moving Average
6,897
public static function ema ( array $ real , int $ timePeriod = null ) : array { $ timePeriod = $ timePeriod ?? 30 ; $ return = trader_ema ( $ real , $ timePeriod ) ; static :: checkForError ( ) ; return $ return ; }
Exponential Moving Average
6,898
public static function kama ( array $ real , int $ timePeriod = null ) : array { $ timePeriod = $ timePeriod ?? 30 ; $ return = trader_kama ( $ real , $ timePeriod ) ; static :: checkForError ( ) ; return $ return ; }
Kaufman Adaptive Moving Average
6,899
public static function linearreg_slope ( array $ real , int $ timePeriod = null ) : array { $ timePeriod = $ timePeriod ?? 14 ; $ return = trader_linearreg_slope ( $ real , $ timePeriod ) ; static :: checkForError ( ) ; return $ return ; }
Linear Regression Slope