idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
56,100 | public static function sslConnect ( $ host , $ user , $ password , $ name , $ key , $ cert , $ ca ) { if ( $ key == "" || $ cert == "" || $ ca == "" ) { throw new MysqlUtilsException ( "SSL parameters error" ) ; } $ mysqliRef = mysqli_init ( ) ; $ mysqliRef -> ssl_set ( $ key , $ cert , $ ca , null , null ) ; $ connect... | Init a mysqli connection over SSL |
56,101 | public static function connect ( $ host , $ user , $ password , $ name ) { $ mysqliRef = mysqli_init ( ) ; $ connected = @ $ mysqliRef -> real_connect ( $ host , $ user , $ password , $ name ) ; if ( ! $ connected || $ mysqliRef -> connect_error ) { throw new MysqlUtilsException ( 'Database connection error (' . $ mysq... | Init a normal mysqli connection |
56,102 | private function apply ( array $ data ) { $ data = array_intersect_key ( $ data , get_object_vars ( $ this ) ) ; $ values = array_filter ( $ data , static function ( $ value ) { return null !== $ value ; } ) ; $ types = array_intersect_key ( $ this -> types ( ) , $ values ) ; $ expects = array_intersect_key ( $ this ->... | Update the current object with new values |
56,103 | public function toArray ( ) { return array_map ( static function ( $ value ) { if ( $ value instanceof ArraySerializableInterface ) { $ value = $ value -> toArray ( ) ; } return $ value ; } , get_object_vars ( $ this ) ) ; } | Get the current object values as an array |
56,104 | protected function getModuleId ( $ filePath ) { preg_match ( '/.*(protected|public|private)\s\$id\s=\s(\'|\")(?P<id>.*)(\'|\")\;.*/' , file_get_contents ( $ filePath ) , $ matches ) ; if ( array_key_exists ( 'id' , $ matches ) && isset ( $ matches [ 'id' ] { 0 } ) ) { return $ matches [ 'id' ] ; } else { return false ;... | Get module id |
56,105 | protected function getClassParentModule ( Container $ container , $ className , array $ ignoredClasses = [ ExternalModule :: class , CompressableExternalModule :: class , \ samson \ core \ Service :: class , CompressableService :: class ] ) { if ( ! in_array ( $ className , $ ignoredClasses , true ) ) { try { $ instanc... | Find parent module by OOP class inheritance . |
56,106 | public function addConfig ( array $ config , $ environment = null ) { $ env = ( $ environment ) ? $ environment : '_top' ; $ this -> values [ $ env ] = ( array_key_exists ( $ env , $ this -> values ) ) ? array_replace_recursive ( $ this -> values [ $ env ] , $ config ) : $ config ; $ this -> buildCache = null ; return ... | Adds config into this object |
56,107 | public function email ( $ name , $ value = NULL , $ options = [ ] ) { $ this -> addErrorClass ( $ name , $ options ) ; $ tags [ 'input' ] = parent :: email ( $ name , $ value , $ options ) ; $ tags [ 'error' ] = $ this -> getErrorTag ( $ name ) ; return $ this -> buildTags ( $ tags ) ; } | Create a email input field . |
56,108 | public function password ( $ name , $ options = [ ] ) { $ this -> addErrorClass ( $ name , $ options ) ; $ tags [ 'input' ] = parent :: password ( $ name , $ options ) ; $ tags [ 'error' ] = $ this -> getErrorTag ( $ name ) ; return $ this -> buildTags ( $ tags ) ; } | Create a password input field . |
56,109 | public function textarea ( $ name , $ value = null , $ options = [ ] ) { $ this -> addErrorClass ( $ name , $ options ) ; $ tags [ 'input' ] = parent :: textarea ( $ name , $ value , $ options ) ; $ tags [ 'error' ] = $ this -> getErrorTag ( $ name ) ; return $ this -> buildTags ( $ tags ) ; } | Create a textarea input . |
56,110 | public function current ( ) { $ val = $ this -> base [ 'value' ] [ $ this -> position ] ; $ layout = $ val [ 'acf_fc_layout' ] ; $ group = new LayoutFieldGroup ( $ this -> getLayoutFields ( $ layout ) , $ val , $ this , $ this -> fieldFactory ) ; return $ group -> setLayout ( $ layout ) ; } | Get the current flexible content item . |
56,111 | public static function section ( $ name , $ args , $ child ) { $ args [ "sectionPath" ] = $ args [ "path" ] ; unset ( $ args [ "path" ] ) ; Router :: $ sections [ ] = [ $ name , $ args , $ child , Router :: $ context ] ; } | Add section to the router the class will handle object creation |
56,112 | public static function page ( $ name = "" , $ args = [ ] ) { if ( Router :: $ context == "" ) $ path = "/" . $ name ; else $ path = Router :: $ context . "/" . $ name ; $ path = str_replace ( "root/" , "" , $ path ) ; Router :: $ routes [ $ path ] = array_merge ( Router :: $ stackedOptions , $ args ) ; } | Add page to a specific section |
56,113 | public static function notFound ( $ arg1 , $ arg2 = null ) { if ( is_null ( $ arg2 ) ) { $ name = "404" ; $ args = $ arg1 ; } else { $ name = $ arg1 ; $ args = $ arg2 ; } $ args [ "pageName" ] = "404" ; Router :: page ( $ name , $ args ) ; } | Add a home page to a specifc section |
56,114 | public static function build ( ) { while ( count ( Router :: $ sections ) > 0 ) { $ section = array_shift ( Router :: $ sections ) ; $ name = $ section [ 0 ] ; $ options = $ section [ 1 ] ; $ callback = $ section [ 2 ] ; $ context = $ section [ 3 ] ; Router :: $ context = $ context . "/" . ( ( $ context == "root" ) ? "... | After this method is called you can t add more paths to the router |
56,115 | public static function find ( ) { if ( count ( Router :: $ routes ) == 0 ) return null ; echo Router :: $ queryString ; if ( Router :: $ queryString == "" ) { Router :: $ target = Router :: $ routes [ "/" ] ; } else if ( isset ( Router :: $ routes [ "/" . Router :: $ queryString ] ) ) { } Router :: $ built = true ; } | Must be called after build method |
56,116 | public function digipolisCleanDir ( $ dirs , $ opts = [ 'sort' => PartialCleanDirsTask :: SORT_NAME ] ) { $ dirsArg = array ( ) ; foreach ( array_map ( 'trim' , explode ( ',' , $ dirs ) ) as $ dir ) { $ dirParts = explode ( ':' , $ dir ) ; if ( count ( $ dirParts ) > 1 ) { $ dirsArg [ $ dirParts [ 0 ] ] = $ dirParts [ ... | Partially clean directories . |
56,117 | public function answerWith ( Type $ collectedData , array $ metadata = [ ] ) { $ collectedPayload = Payload :: fromType ( $ collectedData ) ; $ collectedDataTypeClass = $ collectedPayload -> getTypeClass ( ) ; if ( $ this -> payload -> getTypeClass ( ) !== $ collectedPayload -> getTypeClass ( ) ) { throw InvalidTypeExc... | Transforms current message to a data collected event and replaces payload data with collected data |
56,118 | public function prepareDataProcessing ( TaskListPosition $ newTaskListPosition , $ target , array $ metadata = [ ] ) { $ type = MessageNameUtils :: getTypePartOfMessageName ( $ this -> messageName ) ; $ metadata = ArrayUtils :: merge ( $ this -> metadata , $ metadata ) ; return new self ( $ this -> payload , MessageNam... | Transforms current message to a process data command |
56,119 | public function answerWithDataProcessingCompleted ( array $ metadata = [ ] ) { $ type = MessageNameUtils :: getTypePartOfMessageName ( $ this -> messageName ) ; $ metadata = ArrayUtils :: merge ( $ this -> metadata , $ metadata ) ; return new self ( $ this -> payload , MessageNameUtils :: getDataProcessedEventName ( $ ... | Transforms current message to a data processed event |
56,120 | public function getTerms ( $ topLevel = false , $ options = array ( ) ) { $ terms = array ( ) ; $ wpTerms = get_terms ( $ this -> getName ( ) , array_merge ( array ( 'hide_empty' => false , 'parent' => $ topLevel ? 0 : '' ) , $ options ) ) ; foreach ( $ wpTerms as $ termData ) { $ terms [ ] = $ this -> termFactory -> c... | Get all Terms in this taxonomy . |
56,121 | public function getTermsForPost ( AbstractPost $ post ) { $ terms = array ( ) ; if ( $ dbTerms = get_the_terms ( $ post -> getId ( ) , $ this -> getName ( ) ) ) { foreach ( $ dbTerms as $ termData ) { $ terms [ ] = $ this -> termFactory -> create ( $ termData , $ this ) ; } } return $ terms ; } | Get all terms in this taxonomy for the given post . |
56,122 | public function generateToken ( ) { $ token = md5 ( __CLASS__ . uniqid ( ) ) ; $ sesCont = new SessionContainer ( self :: SESSION_KEY ) ; $ sesCont -> $ token = time ( ) ; $ sesCont -> setExpirationSeconds ( 30 , $ token ) ; return $ token ; } | Store a unique key in session to validate rest calls |
56,123 | public function attachScripts ( ) { if ( $ this -> isScriptsAttached ( ) ) return $ this ; $ view = $ this -> getView ( ) ; $ view -> inlineScript ( ) -> appendFile ( $ view -> staticsUri ( 'Yima.Widgetator.JS.Jquery.Json' ) ) -> appendFile ( $ view -> staticsUri ( 'Yima.Widgetator.JS.Jquery.Ajaxq' ) ) -> appendFile ( ... | Attach needed scripts to load widgets |
56,124 | public static function url ( $ endpoint = null , $ suffix = '' ) { $ base = Phramework :: getSetting ( 'base' ) ; if ( $ endpoint ) { $ suffix = $ endpoint . '/' . $ suffix ; $ suffix = str_replace ( '//' , '/' , $ suffix ) ; } return $ base . $ suffix ; } | Get url of the API resource . |
56,125 | public static function curlHeaders ( $ url , & $ data ) { $ ch = curl_init ( $ url ) ; curl_setopt ( $ ch , CURLOPT_NOBODY , true ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , true ) ; curl_setopt ( $ ch , CURLOPT_HEADER , true ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , true ) ; curl_setopt ( $ ch , CURLOPT_... | Get Headers from a remote link |
56,126 | public static function curlDownload ( $ url , $ path , $ timeout = 3600 ) { $ return = false ; try { $ fp = fopen ( $ path , 'w+' ) ; $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRANSFER , false ) ; curl_setopt ( $ ch , CURLOPT_BINARYTRANSFER , true ) ; curl_se... | Download a file from a remote link |
56,127 | public static function tempfile ( $ prefix ) { global $ settings ; $ folder = '/tmp' ; if ( isset ( $ settings [ 'temporary_folder' ] ) ) { $ folder = $ settings [ 'temporary_folder' ] ; } return tempnam ( $ folder , $ prefix ) ; } | Create a temporary file path |
56,128 | public static function parseFile ( $ filename , & $ extendedFiles = null ) { $ schema = static :: annotateSchema ( Utils :: parse_json_file ( $ filename ) , false ) ; $ extends_file = isset ( $ schema [ 'extends_file' ] ) ? dirname ( $ filename ) . '/' . $ schema [ 'extends_file' ] : null ; while ( $ extends_file !== n... | Read and process file read dependencies if exist . |
56,129 | protected static function annotateSchema ( $ schema , $ annotation , $ path = '' ) { if ( isset ( $ schema [ 'type' ] ) && ! isset ( $ schema [ '_annotation' ] ) ) { $ schema [ '_annotation' ] = $ annotation ; } foreach ( [ 'properties' , 'patternProperties' ] as $ p ) { if ( isset ( $ schema [ $ p ] ) ) { foreach ( $ ... | Annotate schema with an annotation . |
56,130 | public function createFailed ( $ errors = null ) { app ( 'antares.messages' ) -> add ( 'error' , empty ( $ errors ) ? trans ( 'Unable to add language.' ) : $ errors ) ; return redirect ( ) -> back ( ) ; } | Response when storing language failed |
56,131 | public function publishFailed ( $ type , $ error = null ) { app ( 'antares.messages' ) -> add ( 'error' , is_null ( $ error ) ? trans ( 'Translations has not been published.' ) : $ error ) ; return redirect ( handles ( 'antares::translations/index/' . $ type ) ) ; } | response when publishing failed |
56,132 | public function changeFailed ( $ error = null ) { app ( 'antares.messages' ) -> add ( 'error' , is_null ( $ error ) ? trans ( 'Language has not been changed.' ) : $ error ) ; return redirect ( ) -> back ( ) ; } | response when changing language failed |
56,133 | public function deleteFailed ( $ error = null ) { app ( 'antares.messages' ) -> add ( 'error' , $ error ? $ error : trans ( 'Language has not been deleted.' ) ) ; return redirect ( ) -> back ( ) ; } | response when deletion failed |
56,134 | public function defaultFailed ( $ error = null ) { app ( 'antares.messages' ) -> add ( 'error' , $ error ? $ error : trans ( 'Language has not been set as default.' ) ) ; return redirect ( ) -> back ( ) ; } | Response when default language has not been set |
56,135 | protected function removeDir ( $ realPath , $ keep = false ) { if ( $ keep || @ rmdir ( $ realPath ) ) { return true ; } else { return $ this -> setError ( Message :: get ( Message :: STR_DELETE_FAIL , $ realPath ) , Message :: STR_DELETE_FAIL ) ; } } | Remove the directory itself |
56,136 | public function setItems ( array $ items ) { $ items = $ this -> getArrayableItems ( $ items ) ; foreach ( $ items as $ item ) { $ this -> checkType ( $ item ) ; } $ this -> items = $ items ; return $ this ; } | Sets an array as the content of the collection . |
56,137 | public function filter ( callable $ callback = null ) { if ( ! is_null ( $ callback ) ) { return new static ( $ this -> wye , array_filter ( $ this -> items , $ callback , ARRAY_FILTER_USE_BOTH ) ) ; } return new static ( $ this -> wye , array_filter ( $ this -> items ) ) ; } | Create a new collection containing the items of the original collection that pass the given callback . When no callback is provided falsey values are removed . |
56,138 | public function last ( callable $ callback = null , $ default = null ) { $ items = array_reverse ( $ this -> items ) ; if ( is_null ( $ callback ) ) { if ( empty ( $ items ) ) { return null ; } foreach ( $ items as $ value ) { return $ value ; } } foreach ( $ items as $ key => $ value ) { if ( call_user_func ( $ callba... | Retrieve the last item in the collection or the last item that matches the criteria defined in a function . When matching by a function a default value may be set if no results are found . |
56,139 | public function push ( ... $ values ) { foreach ( $ values as $ value ) { $ this -> offsetSet ( null , $ value ) ; } return $ this ; } | Appends one or more values to the end of the collection s items . |
56,140 | public function unshift ( ... $ values ) { foreach ( $ values as $ value ) { $ this -> checkType ( $ value ) ; } foreach ( array_reverse ( $ values ) as $ value ) { array_unshift ( $ this -> items , $ value ) ; } return $ this ; } | Appends one or more values to the beginning of the collection s items . |
56,141 | protected function checkType ( $ item ) { if ( $ this -> isCorrectType ( $ item ) === false ) { $ error = sprintf ( '%s may contain only values of type %s, %s given.' , get_class ( $ this ) , $ this -> type , is_object ( $ item ) ? get_class ( $ item ) : gettype ( $ item ) ) ; throw new InvalidArgumentException ( $ err... | Checks an item to ensure it of the correct type and throws an exception if the type is invalid . |
56,142 | protected function getArrayableItems ( $ items ) { if ( is_array ( $ items ) ) { return $ items ; } if ( $ items instanceof Traversable ) { return iterator_to_array ( $ items ) ; } return ( array ) $ items ; } | Convert input into an array . |
56,143 | protected function isCorrectType ( $ item ) { if ( is_null ( $ this -> type ) ) { return true ; } if ( $ this -> type !== 'object' && is_object ( $ item ) ) { return $ item instanceof $ this -> type ; } return gettype ( $ item ) === $ this -> type ; } | Checks if an item is the correct type as set for the collection . |
56,144 | public function apply ( $ testable , array $ config = array ( ) ) { $ message = 'Protected method {:name} must start with an underscore' ; $ tokens = $ testable -> tokens ( ) ; $ filtered = $ testable -> findAll ( array ( T_PROTECTED ) ) ; foreach ( $ filtered as $ tokenId ) { $ token = $ tokens [ $ tokenId ] ; $ paren... | Will iterate the tokens looking for protected methods and variables once found it will validate the name of it s parent starts with an underscore . |
56,145 | protected function _strictMode ( $ classname ) { foreach ( $ this -> _exceptions as $ regex ) { if ( preg_match ( "/{$regex}/" , $ classname ) ) { return false ; } } return true ; } | Will iterate over exceptions regex to see if the rule need to be strictly applied . |
56,146 | public static function label ( $ tokenId , array $ tokens ) { $ token = $ tokens [ $ tokenId ] ; $ hasName = in_array ( $ token [ 'id' ] , array ( T_FUNCTION , T_CLASS , T_INTERFACE , T_VARIABLE , ) ) ; if ( $ hasName ) { if ( $ token [ 'id' ] === T_VARIABLE ) { return substr ( $ token [ 'content' ] , 1 ) ; } $ total =... | Will find the label of the given token . |
56,147 | public static function parameters ( $ tokenId , array $ tokens ) { $ params = array ( ) ; if ( $ tokens [ $ tokenId ] [ 'id' ] !== T_FUNCTION ) { throw new \ Exception ( 'Cannot call params on non function' ) ; } $ foundOpen = false ; $ total = count ( $ tokens ) ; for ( $ key = $ tokenId ; $ key <= $ total ; $ key ++ ... | Will return the parameters of a given token . |
56,148 | public static function modifiers ( $ tokenId , array $ tokens ) { if ( ! in_array ( $ tokens [ $ tokenId ] [ 'id' ] , array ( T_CLASS , T_FUNCTION , T_VARIABLE ) ) ) { $ token = print_r ( $ tokens [ $ tokenId ] , true ) ; throw new \ Exception ( 'Cannot call modifiers on non class/function/variable' . $ token ) ; } $ m... | Will return a list of all the modifiers for a given token . |
56,149 | protected static function _checksum ( array $ token , $ isString ) { $ token [ 'checksum' ] = static :: $ _bracketsChecksum ; if ( $ isString ) { return $ token ; } $ char = $ token [ 'content' ] ; if ( $ char === ')' || $ char === ']' || $ char === '}' ) { $ token [ 'checksum' ] = -- static :: $ _bracketsChecksum ; } ... | Update the bracket checksum values for a token . |
56,150 | protected static function _isEndOfParent ( $ tokenId , $ parentId , array $ tokens ) { if ( ! isset ( $ tokens [ $ parentId ] ) ) { return false ; } $ diff = $ tokens [ $ tokenId ] [ 'checksum' ] - $ tokens [ $ parentId ] [ 'checksum' ] ; if ( $ diff > 0 ) { return false ; } $ token = $ tokens [ $ tokenId ] ; $ parent ... | Will determine if this is the end of the current parent . |
56,151 | protected static function _tokenize ( array $ tokens ) { $ inString = false ; $ results = array ( ) ; $ cpt = 0 ; $ previousTokenId = null ; foreach ( $ tokens as $ tokenId => $ token ) { if ( $ token [ 'content' ] === '"' ) { if ( ! $ inString ) { $ token [ 'id' ] = T_START_DOUBLE_QUOTE ; $ token [ 'name' ] = 'T_START... | Adding extra tokens for quality rules |
56,152 | protected function refresh_info ( ) { $ this -> pid = ( int ) getmypid ( ) ; $ this -> gid = ( int ) getmygid ( ) ; $ this -> inode = ( int ) getmyinode ( ) ; $ this -> uid = ( int ) getmyuid ( ) ; $ this -> user = ( string ) get_current_user ( ) ; $ this -> uname = posix_uname ( ) ; return true ; } | refresh the basic info |
56,153 | protected function cpu_info ( ) { $ this -> cpu_info = array ( ) ; if ( ! stristr ( PHP_OS , 'win' ) ) { exec ( "cat /proc/cpuinfo" , $ output ) ; foreach ( $ output as $ line ) { $ parts = explode ( ':' , $ line ) ; if ( empty ( $ parts [ 0 ] ) ) continue ; $ this -> cpu_info [ trim ( $ parts [ 0 ] ) ] = ( ! empty ( $... | Collect Cpu info |
56,154 | protected function system_memory_info ( ) { $ this -> system_memory_kb = array ( ) ; exec ( "cat /proc/meminfo" , $ output ) ; foreach ( $ output as $ line ) { $ parts = explode ( ':' , $ line ) ; if ( empty ( $ parts [ 0 ] ) ) continue ; $ this -> system_memory_kb [ trim ( $ parts [ 0 ] ) ] = ( int ) ( ! empty ( $ par... | memory info for a linux system |
56,155 | protected function process_memory_info ( ) { $ this -> current_mem_use = ( int ) memory_get_usage ( ) ; $ this -> current_mem_peak = ( int ) memory_get_peak_usage ( ) ; $ this -> current_mem_peak_mb = ( float ) $ this -> current_mem_peak / 1024 / 1024 ; $ this -> current_mem_use_mb = ( float ) $ this -> current_mem_use... | get memory infos |
56,156 | public function actionGenerate ( ) { Question :: confirm ( null , 1 ) ; $ count = \ App :: $ domain -> rbac -> const -> generateAll ( ) ; if ( $ count ) { Output :: block ( "Generated {$count} constants" ) ; } else { Output :: block ( "All rules exists!" ) ; } } | Generating enums for RBAC roles permissions and rules |
56,157 | public function apply ( $ testable , array $ config = array ( ) ) { $ tokens = $ testable -> tokens ( ) ; $ filtered = $ testable -> findAll ( array ( T_FUNCTION ) ) ; foreach ( $ filtered as $ key ) { $ token = $ tokens [ $ key ] ; $ label = Parser :: label ( $ key , $ tokens ) ; $ modifiers = Parser :: modifiers ( $ ... | Will iterate the tokens looking for functions validating they have the correct camelBack naming style . |
56,158 | public static function render ( $ options = null ) { $ pagination = new static ( $ options ) ; if ( ! $ links = $ pagination -> getLinks ( ) ) { return '' ; } if ( ! $ pagination -> view ) { return $ pagination -> autoRender ( $ links ) ; } return $ pagination -> renderView ( $ links ) ; } | Return pagination HTML |
56,159 | private function renderView ( $ links ) { $ defaults = $ this -> defaults ; return View :: make ( $ this -> view , compact ( 'links' , 'defaults' ) ) -> render ( ) ; } | Render pagination based on a view |
56,160 | private function autoRender ( $ links ) { $ list = "<div class=\"{$this->defaults['container_class']}\">\n\t" ; $ list .= "<ul class=\"{$this->defaults['ul_class']}\">\n\t" ; foreach ( $ links as $ l ) { $ active = ( $ l [ 'active' ] ) ? 'class="active"' : '' ; $ list .= "<li {$active}>{$l['link']}</li>" ; } $ list .= ... | Render de HTML |
56,161 | protected function getLinks ( $ options = array ( ) ) { global $ wp_query , $ wp_rewrite ; $ current = $ wp_query -> query_vars [ 'paged' ] > 1 ? $ wp_query -> query_vars [ 'paged' ] : 1 ; $ pagination = array ( 'base' => @ add_query_arg ( 'paged' , '%#%' ) , 'showall' => false , 'end_size' => $ this -> endSize , 'mid_... | WordPress regular functions to process pagination |
56,162 | private function parseWpLinks ( $ aLinks ) { $ links = [ ] ; foreach ( $ aLinks as $ link ) { $ links [ ] = [ 'active' => $ this -> checkActive ( $ link ) , 'link' => $ link ] ; } return $ links ; } | parse array of links and set which is active . |
56,163 | public function connectionSettingsAreValid ( ) { if ( ! $ this -> getDbAdapter ( ) ) { return false ; } $ connectionSettings = $ this -> getDbAdapter ( ) -> getConnectionSettings ( ) ; if ( ! $ connectionSettings ) { return false ; } return $ connectionSettings -> validateProperties ( ) ; } | a database connection needs certain parameters to work |
56,164 | public function splice ( $ offset , $ length = 0 , $ replacement = [ ] ) { return new static ( array_splice ( $ this -> items , $ offset , $ length , $ replacement ) ) ; } | Splice portion of the underlying collection array . |
56,165 | public function equalsProperties ( $ host , $ user , $ password , $ name , $ key = "" , $ cert = "" , $ ca = "" ) { return ( $ this -> host == $ host && $ this -> user == $ user && $ this -> password == $ password && $ this -> name == $ name && $ this -> key == $ key && $ this -> cert == $ cert && $ this -> ca == $ ca ... | Check if the passed properties are equal to instance properties |
56,166 | public function equals ( MysqlConnection $ connection ) { return ( $ this -> host == $ connection -> host && $ this -> user == $ connection -> user && $ this -> password == $ connection -> password && $ this -> name == $ connection -> name && $ this -> key == $ connection -> key && $ this -> cert == $ connection -> cer... | Check if the passed object is equal to this this check the properties not the mysqli connection |
56,167 | protected function runPhp ( \ Everon \ View \ Interfaces \ TemplateCompilerContext $ Context , \ Everon \ Interfaces \ FileSystem $ FileSystem ) { $ handleError = function ( $ errno , $ errstr , $ errfile , $ errline , array $ errcontext ) { if ( 0 === error_reporting ( ) ) { return false ; } throw new \ Everon \ Excep... | Must implement Logger |
56,168 | public function getPagedResults ( $ limit = 50 , $ page = 0 ) : Paginator { $ dql = sprintf ( self :: DQL_GET_PAGED , TargetTemplate :: class ) ; return $ this -> getPaginator ( $ dql , $ limit , $ page ) ; } | Get all templates paged . |
56,169 | public function getGroupedTemplates ( ? Application $ application = null ) : array { $ environments = $ this -> getEntityManager ( ) -> getRepository ( Environment :: class ) -> findAll ( ) ; if ( $ application ) { $ findBy = [ 'application' => $ application ] ; } else { $ findBy = [ ] ; } $ templates = $ this -> findB... | Get all templates sorted into environments . |
56,170 | protected function checkToken ( $ token ) { try { $ response = $ this -> http -> get ( $ this -> checkTokenURL ( ) , [ 'headers' => [ 'X-Requested-With' => 'XMLHttpRequest' , 'Authorization' => 'Bearer ' . $ token ] ] ) ; $ content = json_decode ( $ response -> getBody ( ) -> getContents ( ) ) ; if ( isset ( $ content ... | Check token . |
56,171 | public function lock ( ) { if ( $ this -> isRunning ( ) ) return false ; $ pidFile = $ this -> directory . $ this -> filename ; if ( ! is_writable ( $ this -> directory ) ) { throw new \ Exception ( 'Can not write to folder: ' . $ this -> directory ) ; } if ( file_exists ( $ pidFile ) && ! is_writable ( $ pidFile ) ) {... | Writes the process id to a pid file |
56,172 | public function isRunning ( ) { $ this -> checkDirExists ( ) ; $ pidFile = $ this -> directory . $ this -> filename ; if ( ! file_exists ( $ pidFile ) ) { return false ; } $ pid = file_get_contents ( $ pidFile ) ; if ( empty ( $ pid ) ) { return false ; } if ( ! is_dir ( '/proc/' ) ) { exec ( 'ps -Ac -o pid | awk \'{pr... | Checks if a process is still running |
56,173 | public function unlock ( ) { $ this -> checkDirExists ( ) ; $ pidFile = $ this -> directory . $ this -> filename ; if ( ! file_exists ( $ pidFile ) ) { return false ; } if ( ! is_writable ( $ pidFile ) ) { throw new \ Exception ( 'Can not write to file: ' . $ pidFile ) ; } return unlink ( $ pidFile ) ; } | Removes a pid file from the pid directory kind of optional as if your process has already stopped we should already be able to detect it . It s nice to clean up though . |
56,174 | public function resetPassword ( $ token , $ password ) { $ this -> cleanResetTokens = true ; $ token = $ this -> getEntityManager ( ) -> find ( PasswordResetToken :: class , $ token ) ; if ( ! $ token ) { throw new TokenNotFoundException ; } $ user = $ token -> getUser ( ) ; $ user -> setPassword ( $ password ) ; $ em ... | Set password and return updated User Entity |
56,175 | function validate ( $ options = [ ] ) { $ groups = @ $ options [ 'groups' ] ? : [ ] ; $ this -> errors = static :: validator ( ) -> validate ( $ this , $ groups ) ; return $ this -> errors -> count ( ) === 0 ; } | Validates the class . |
56,176 | protected function _getServerHttpUrlFromCommand ( $ command ) { $ base = null ; $ cmMethod = strtolower ( ( string ) $ command ) ; switch ( $ cmMethod ) { case 'getauthurl' : $ base = 'auth' ; break ; case 'token' : $ base = 'auth/token' ; break ; case 'register' : $ base = 'api/v1/members' ; break ; case 'accountinfo'... | Determine Server Http Url Using Http or Https? |
56,177 | protected function getYoutubeParameters ( ReadBlockInterface $ block ) { $ urlParams = array ( ) ; foreach ( array ( 'youtubeAutoplay' , 'youtubeShowinfo' , 'youtubeFs' , 'youtubeRel' , 'youtubeDisablekb' , 'youtubeLoop' ) as $ key ) { if ( $ block -> getAttribute ( $ key ) === true ) { $ urlParams [ strtolower ( subst... | Return view parameters for a youtube video |
56,178 | protected function getDailymotionParameters ( ReadBlockInterface $ block ) { $ urlParams = array ( ) ; foreach ( array ( 'dailymotionAutoplay' , 'dailymotionChromeless' ) as $ key ) { if ( $ block -> getAttribute ( $ key ) === true ) { $ urlParams [ strtolower ( substr ( $ key , 11 ) ) ] = 1 ; } } foreach ( array ( 'da... | Return view parameters for a dailymotion video |
56,179 | public function resolve ( ) { $ this -> zone -> setComponents ( $ this -> components -> buildRanking ( ) ) ; $ this -> assertEntityIsValid ( $ this -> zone , array ( 'Zone' , 'edition' ) ) ; $ this -> fireEvent ( ZoneEvents :: ZONE_EDITED , new ZoneEvent ( $ this -> zone , $ this ) ) ; } | Edition trigger method . |
56,180 | protected function getFiles ( ) { $ dir_iterator = new RecursiveDirectoryIterator ( $ this -> entryPath ) ; $ iterator = new RecursiveIteratorIterator ( $ dir_iterator , RecursiveIteratorIterator :: CHILD_FIRST ) ; $ files = new RegexIterator ( $ iterator , '/^.+\.scss$/i' ) ; return $ files ; } | Returns a list of all . scss files in the entry directory |
56,181 | protected function checkFiles ( $ force = false ) { $ files = $ this -> getFiles ( ) ; foreach ( $ files as $ file ) { $ this -> checkFile ( $ file , $ force ) ; } } | Checks all . scss files for modifications |
56,182 | protected function checkFile ( SplFileInfo $ file , $ force ) { $ scssPath = $ file -> getPathname ( ) ; $ scssMod = $ file -> getMTime ( ) ; $ scssName = preg_replace ( '/^.+(\/|\\\\)([^\/\\\\]+)$/' , '\\2' , $ scssPath ) ; if ( substr ( $ scssName , 0 , 1 ) === '_' ) { $ this -> sysMod = max ( $ this -> sysMod , $ sc... | Checks a given file for modifications and triggers CSS generation |
56,183 | protected function generateCss ( $ scssPath , $ cssPath ) { $ cssDirName = preg_replace ( '/^(.+)(\/|\\\\)[^\/\\\\]+$/' , '\\1' , $ cssPath ) ; if ( ! is_dir ( $ cssDirName ) ) { mkdir ( $ cssDirName , 0777 ) ; } $ response = trim ( shell_exec ( "$this->sassBinary $scssPath $cssPath --style $this->style $this->flags 2>... | Converts a . scss file to the corresponding . css version |
56,184 | public function add ( $ callable ) { $ callable = $ this -> resolveCallable ( $ callable ) ; if ( $ callable instanceof Closure ) { $ callable = $ callable -> bindTo ( $ this -> container ) ; } $ this -> middleware [ ] = $ callable ; return $ this ; } | Add middleware . |
56,185 | public function finalize ( ) { foreach ( $ this -> getGroups ( ) as $ group ) { foreach ( $ group -> getMiddleware ( ) as $ middleware ) { array_unshift ( $ this -> middleware , $ middleware ) ; } } foreach ( $ this -> getMiddleware ( ) as $ middleware ) { $ this -> addMiddleware ( $ middleware ) ; } } | Finalize the route in preparation for dispatching . |
56,186 | public function setOutputBuffering ( $ mode ) { if ( ! in_array ( $ mode , [ false , 'prepend' , 'append' ] , true ) ) { throw new InvalidArgumentException ( 'Unknown output buffering mode' ) ; } $ this -> outputBuffering = $ mode ; } | Set output buffering mode . |
56,187 | public function prepare ( ServerRequestInterface $ request , array $ arguments ) { foreach ( $ arguments as $ k => $ v ) { $ this -> setArgument ( $ k , $ v ) ; } } | Prepare the route for use . |
56,188 | public function registerZoneType ( array $ zoneTypeData ) { $ zoneType = $ this -> normalizer -> denormalize ( array ( 'id' => $ zoneTypeData [ 'id' ] , 'name' => $ zoneTypeData [ 'name' ] , 'order' => $ zoneTypeData [ 'order' ] , ) , $ this -> entityCollection -> getEntityClass ( ) ) ; foreach ( $ zoneTypeData [ 'comp... | Register a new ZoneType into loader . |
56,189 | static function of ( $ resource ) { if ( ! is_resource ( $ resource ) && get_resource_type ( $ resource ) !== 'stream-context' ) throw new \ InvalidArgumentException ( sprintf ( 'Invalid Context Resource Passed, given: "%s".' , \ Poirot \ Std \ flatten ( $ resource ) ) ) ; $ options = stream_context_get_params ( $ reso... | Factory ContextOption From context resource |
56,190 | protected static function fetchUrl ( $ url ) { $ ch = curl_init ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; curl_setopt ( $ ch , CURLOPT_HTTPHEADER , [ 'User-Agent: Mozilla/5.0 (OSX) Gecko/20030208 Netscape/7.02' ] ) ; curl_setopt ( $ ch , CURLOPT_FOLLOWLOCATION , true ) ; curl_setopt ( $ ch , CURLOPT_RETURNTRAN... | XXX put in class Http and use Guzzle |
56,191 | protected static function runCommand ( $ cmd , $ stderr_file = false , $ extra_file = false ) { $ output = [ ] ; $ exitcode = - 1 ; exec ( $ cmd , $ output , $ exitcode ) ; return [ 'code' => $ exitcode , 'stdout' => implode ( "\n" , $ output ) , 'stderr' => $ stderr_file ? file_get_contents ( stderr_file ) : null , 'e... | Runs a command and returns the exit code stdout stderr and possible any extra file . |
56,192 | public function createProjectSkel ( $ projectName ) { $ rootDir = $ this -> config -> get ( 'phpalchemy.root_dir' ) ; $ defAppIniFile = $ rootDir . '/config/defaults.application.ini' ; if ( ! self :: validateProjectName ( $ projectName ) ) { throw new \ Exception ( "Error: Invalid project name!\nProject name can be con... | Creates a project directory skeleton |
56,193 | public static function forge ( $ host = null , $ user = null , $ password = null , $ port = 21 , $ timeout = 90 ) { static :: $ _host = $ host ; static :: $ _user = $ user ; static :: $ _pwd = $ password ; static :: $ _port = ( int ) $ port ; static :: $ _timeout = ( int ) $ timeout ; if ( ! static :: $ instance ) { st... | Initialize connection params |
56,194 | public static function getEnv ( $ variable = null ) { $ cmd = preg_match ( "/WIN/Ai" , PHP_OS ) ? 'set' : 'printenv' ; $ output = self :: run ( $ cmd ) -> output ; $ env = [ ] ; foreach ( $ output as $ line ) { list ( $ key , $ value ) = explode ( "=" , $ line , 2 ) ; if ( $ variable && strtolower ( $ key ) === strtolo... | Get all environment variables or a value of specified variable . |
56,195 | public function run ( $ groupName , array $ exludedProjects = [ ] , $ historyFile = null ) { if ( $ historyFile ) { $ this -> historyShellManager -> getHistory ( ) -> loadHistory ( $ historyFile ) ; } $ this -> historyShellManager -> setPrompt ( $ this -> getPrompt ( $ groupName ) ) ; $ this -> application -> setAutoEx... | Starts a new shell process . |
56,196 | private function getHeader ( $ groupName , array $ excludedProjects = [ ] ) { if ( $ excludedProjects != [ ] ) { $ ignoredProjects = '' ; foreach ( $ excludedProjects as $ project ) { $ ignoredProjects .= '<comment>' . $ project . '</comment>, ' ; } $ ignoredProjects = ' except for the projects ' . substr ( $ ignoredPr... | Returns the shell header . |
56,197 | public function compile ( ) { extract ( $ this -> vars ) ; ob_start ( ) ; include $ this -> filename ; $ __strCompiled__ = ob_get_contents ( ) ; ob_end_clean ( ) ; return $ __strCompiled__ ; } | Compiles template . |
56,198 | public function actionDeleteUnused ( ) { $ articeThumb = [ ] ; $ rootPath = yii :: getAlias ( '@frontend/web' ) ; foreach ( Article :: find ( ) -> where ( [ '<>' , 'thumb' , '' ] ) -> each ( 100 ) as $ artice ) { $ articeThumb [ ] = str_replace ( yii :: $ app -> params [ 'site' ] [ 'url' ] , $ rootPath , $ artice -> th... | Delete unused files and empty directory . |
56,199 | protected function calculateMode ( $ class ) { foreach ( $ this -> modeArray as $ constant ) { $ this -> mode = $ this -> mode | constant ( $ class . '::' . $ constant ) ; } return $ this ; } | Calculate the mode score . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.