idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
50,000 | public function findByFilterComponents ( $ qty , array $ filterComponents ) { $ output = $ this -> copy ( ) ; if ( ! $ filterComponents ) { return $ output ; } $ filterClosure = function ( $ obj ) use ( $ filterComponents ) { $ pass = true ; foreach ( $ filterComponents as $ filter ) { $ filterResult = $ filter -> chec... | Filter a container |
50,001 | public function classSet ( $ input ) { if ( is_object ( $ input ) ) { if ( $ input instanceof self ) { $ class = $ input -> classGet ( ) ; } else { $ class = get_class ( $ input ) ; } } else { $ class = $ input ; } $ currentClass = $ this -> classGet ( ) ; if ( $ currentClass ) { if ( $ class !== $ currentClass ) { thr... | Set a containers class |
50,002 | private function classGet ( ) { return isset ( $ this -> class ) ? $ this -> class : ( ( $ firstElement = $ this -> firstElementGet ( ) ) ? ( $ this -> class = get_class ( $ firstElement ) ) : null ) ; } | Get the class of this container . |
50,003 | public function splitByClass ( ) { $ classes = array ( ) ; foreach ( $ this -> collection as $ key => $ entity ) { $ classes [ get_class ( $ entity ) ] [ ] = $ key ; } ksort ( $ classes ) ; $ output = array ( ) ; foreach ( $ classes as $ class => $ splHashes ) { $ container = $ this -> newContainer ( ) ; $ container ->... | Split by class |
50,004 | public function implode ( $ glue , $ propertyOrClosure = null ) { if ( null === $ propertyOrClosure ) { $ pieces = $ this -> map ( 'strval' ) ; } elseif ( $ propertyOrClosure instanceof \ Closure ) { $ pieces = $ this -> map ( $ propertyOrClosure ) ; } else { $ pieces = $ this -> map ( $ this -> generateGetPropertyClos... | Seems like I m more and more imploding groups of entities on something |
50,005 | public function newContainer ( ) { $ refl = new ReflectionClass ( $ this ) ; $ container = $ refl -> newInstanceArgs ( func_get_args ( ) ) ; $ container -> classSet ( $ this -> class ) ; $ container -> propertyMapper = $ this -> propertyMapper ; return $ container ; } | Generate a new empty container of the same type as what is currently instantiated |
50,006 | public function init ( ) : void { parent :: init ( ) ; if ( ! ( $ this -> contentFS instanceof Filesystem ) ) { throw new InvalidConfigException ( sprintf ( 'ContentFS must be instance of %s.' , Filesystem :: class ) ) ; } if ( ! ( $ this -> cacheFS instanceof Filesystem ) ) { throw new InvalidConfigException ( sprintf... | Check initialization parameters and parse configs |
50,007 | public function getFilePath ( IFile $ file , string $ format , array $ formatterConfig = [ ] ) : ? string { $ alias = $ this -> getAliasConfig ( $ file -> getModelAlias ( ) ) ; $ formatter = $ this -> buildFormatter ( $ file , $ format , $ formatterConfig ) ; $ targetPath = $ alias -> getAssetPath ( $ file , $ format )... | Caches file and returns url to it . |
50,008 | protected function cacheFile ( IFile $ file , FileFormatter $ formatter , string $ targetPath ) : bool { if ( $ file instanceof ICacheStateful && $ file -> getIsCached ( $ formatter -> name ) ) { return true ; } return ( new Saver ( $ file , $ this -> cacheFS , $ targetPath ) ) -> save ( $ formatter ) ; } | Caches file available in web . |
50,009 | public function process ( ServerRequestInterface $ request , RequestHandlerInterface $ handler ) : ResponseInterface { $ response = $ handler -> handle ( $ request ) ; $ code = $ response -> getStatusCode ( ) ; $ allowedCodes = array_keys ( $ this -> renderer ) + array_keys ( $ this -> defaultErrors ) ; if ( in_array (... | Execute the middleware . |
50,010 | private function getOnlineUsers ( ) { $ date = Carbon :: now ( ) -> subMinutes ( config ( 'arcanesoft.auth.track-activity.minutes' , 5 ) ) ; return $ this -> getCachedUsers ( ) -> filter ( function ( User $ user ) use ( $ date ) { return ! is_null ( $ user -> last_activity ) && $ user -> last_activity -> gte ( $ date )... | Get the online users . |
50,011 | public function model ( $ name = '' , $ namespace = null ) { if ( null === $ name ) { $ namespace = $ this -> namespace ; } $ namespace = $ this -> resolveNamespace ( $ namespace ) ; $ model = $ this -> model = $ this -> createModelInstance ( $ namespace , $ name ) ; return $ model ; } | create and return model instance |
50,012 | public function getDataForBreadcrumb ( Page $ page ) { $ parent = $ page -> getParent ( ) ; if ( $ parent ) { $ data = array ( ) ; if ( $ parent -> getParent ( ) ) { $ data = array_merge ( $ this -> getDataForBreadcrumb ( $ parent ) , $ data ) ; } $ data [ ] = $ parent ; return $ data ; } return NULL ; } | Get breadcrumb data |
50,013 | public function allowChildren ( Page $ page ) { $ models = $ this -> container -> getParameter ( 'fulgurio_light_cms.models' ) ; return $ models [ $ page -> getModel ( ) ] [ 'allow_children' ] ; } | Check if page model allow children |
50,014 | public function needTranslatedPages ( Page $ page ) { if ( ! $ page -> getParent ( ) || ! is_null ( $ page -> getSourceId ( ) ) ) { return FALSE ; } if ( $ this -> container -> hasParameter ( 'fulgurio_light_cms.languages' ) ) { $ availableLangs = $ this -> container -> getParameter ( 'fulgurio_light_cms.languages' ) ;... | Get parent page to copy page for translation |
50,015 | public function thumb ( $ media , $ size = 'small' ) { $ thumbSizes = $ this -> container -> getParameter ( 'fulgurio_light_cms.thumbs' ) ; return LightCMSUtils :: getThumbFilename ( $ media -> getFullPath ( ) , $ media -> getMediaType ( ) , $ thumbSizes [ $ size ] ) ; } | Get thumb of a picture |
50,016 | public function getPagesMenu ( $ menuName , $ lang = NULL ) { $ pages = $ this -> doctrine -> getRepository ( 'FulgurioLightCMSBundle:PageMenu' ) -> findPagesOfMenu ( $ menuName , $ lang ) ; $ availablePages = array ( ) ; foreach ( $ pages as & $ page ) { $ availablePages [ ] = $ page ; } return $ availablePages ; } | Get page menu to display |
50,017 | public function getHash ( ) { $ data = [ ] ; foreach ( $ this -> instrumentors as $ instrumentor ) { $ data [ get_class ( $ instrumentor ) ] = NULL ; if ( $ instrumentor instanceof CachingInstrumentorInterface ) { $ data [ get_class ( $ instrumentor ) ] = $ instrumentor -> getHash ( ) ; } else { $ data [ get_class ( $ ... | Get a hash computed from the the fully - qualified names of all registered instrumentors . |
50,018 | public function getLastModified ( ) { $ mtime = 0 ; foreach ( $ this -> instrumentors as $ instrumentor ) { $ mtime = max ( $ mtime , filemtime ( ( new \ ReflectionClass ( $ instrumentor ) ) -> getFileName ( ) ) ) ; if ( $ instrumentor instanceof CachingInstrumentorInterface ) { $ mtime = max ( $ mtime , $ instrumentor... | Get the most - recent modification time computed from all registered instrumentors . |
50,019 | public function isDispatchable ( Request $ request ) { $ className = $ this -> getControllerClass ( $ request ) ; if ( ( $ this -> _defaultModule != $ this -> _curModule ) || $ this -> getParam ( 'prefixDefaultModule' ) ) { $ className = $ this -> formatClassName ( $ this -> _curModule , $ className ) ; } if ( class_ex... | Returns TRUE if the Zend_Controller_Request_Abstract object can be dispatched to a controller . |
50,020 | protected function init ( ) : bool { if ( ! isset ( $ _SESSION [ $ this -> name ] ) ) { $ _SESSION [ $ this -> name ] = [ ] ; } return true ; } | Initializes the session . |
50,021 | public function set ( string $ key , $ value ) : bool { if ( is_string ( $ key ) === false || $ key === "" ) { return false ; } $ this -> _configValues [ $ key ] = $ value ; return true ; } | Set config item |
50,022 | public function get ( string $ key ) { return isset ( $ this -> _configValues [ $ key ] ) ? $ this -> _configValues [ $ key ] : null ; } | Get config item |
50,023 | public function remove ( string $ key ) : bool { if ( isset ( $ this -> _configValues [ $ key ] ) === false ) { return false ; } unset ( $ this -> _configValues [ $ key ] ) ; return true ; } | Remove config item |
50,024 | public function prependResourceName ( array $ loadedConfig , string $ resName ) : array { $ prefixedConf = [ ] ; foreach ( $ loadedConfig as $ key => $ value ) { $ prefixedConf [ "{$resName}.{$key}" ] = $ value ; } return $ prefixedConf ; } | Prepend resource name to keys |
50,025 | protected function _getAbsPath ( string $ resName ) : string { foreach ( $ this -> _resDir as $ dir ) { $ absPath = rtrim ( $ dir , DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR . $ resName ; if ( file_exists ( $ absPath ) ) { return $ absPath ; } } return "" ; } | Get resource absolute path |
50,026 | public function changeHeader ( string $ name , string $ value ) : void { $ this -> headers [ $ name ] = $ value ; } | Changes header value . |
50,027 | public function changeHeaders ( callable $ callback ) : void { foreach ( $ this -> headers as $ name => $ value ) { $ this -> headers [ $ name ] = call_user_func ( $ callback , $ name , $ value ) ; } } | Changes headers using callback function . |
50,028 | public function applyEntity ( Resource $ resource , EntityInterface $ entity ) { $ this -> validateResourceTypes ( $ resource -> getEntityType ( ) , $ entity -> getType ( ) ) ; $ document -> pushData ( $ entity ) ; return $ this ; } | Applies an entity or entity identifier to a resource . |
50,029 | public function applyRelationships ( Entity $ owner , $ data ) { $ this -> validateData ( $ data ) ; $ meta = $ this -> mf -> getMetadataForType ( $ owner -> getType ( ) ) ; foreach ( $ meta -> getRelationships ( ) as $ key => $ relationship ) { if ( ! isset ( $ data [ $ key ] ) || ! $ data [ $ key ] instanceof EntityI... | Applies an array or array - like set of relationship data to an entity . Each array member must be a EntityInterface object keyed by the relationship field key . |
50,030 | public function applyRelationship ( Entity $ owner , $ fieldKey , EntityInterface $ related ) { $ meta = $ this -> em -> getMetadataForType ( $ owner -> getType ( ) ) ; if ( false === $ meta -> hasRelationship ( $ fieldKey ) ) { throw new InvalidArgumentException ( 'The resource "%s" does not contain relationship field... | Applies a single relationship to an owning resource via a related resource object . |
50,031 | public function applyAttributes ( Resource $ entity , $ data ) { $ this -> validateData ( $ data ) ; $ meta = $ this -> em -> getMetadataFor ( $ entity -> getType ( ) ) ; foreach ( $ meta -> getAttributes ( ) as $ key => $ attribute ) { if ( ! isset ( $ data [ $ key ] ) ) { continue ; } $ this -> applyAttribute ( $ ent... | Applies an array or array - like set of attribute data to an entity . Each array member must be keyed by the attribute field key . |
50,032 | public function applyAttribute ( Entity $ entity , $ fieldKey , $ value ) { $ entity -> addAttribute ( $ this -> createAttribute ( $ fieldKey , $ value ) ) ; return $ this ; } | Applies a single attribute value to a resource . |
50,033 | public function update ( $ id , array $ data ) { $ obj = $ this -> find ( $ id ) ; Event :: fire ( 'repository.updating' , [ $ obj , $ data ] ) ; $ obj -> update ( $ data ) ; return $ obj ; } | Update a new object |
50,034 | public function delete ( $ id ) { $ obj = $ this -> find ( $ id ) ; Event :: fire ( 'repository.deleting' , [ $ obj ] ) ; return $ obj -> delete ( ) ; } | Deletes a new object |
50,035 | final public function socketCreatePair ( $ domain , $ type , $ protocol , array & $ fd ) { return socket_create_pair ( $ domain , $ type , $ protocol , $ fd ) ; } | Creates a pair of indistinguishable sockets and stores them in an array |
50,036 | final public function socketSetOption ( $ optname , $ optval , $ level = SOL_SOCKET ) { return socket_set_option ( $ this -> socket , $ level , $ optname , $ optval ) ; } | Sets socket options for the socket |
50,037 | final public function socketSend ( $ buff , $ len , $ flags = MSG_OOB ) { return socket_send ( $ this -> socket , $ buff , is_int ( $ len ) ? $ len : strlen ( $ buff ) , $ flags ) ; } | Sends data to a connected socket |
50,038 | final public function socketSendto ( $ buf , $ len , $ flags , $ addr , $ port = 0 ) { return socket_sendto ( $ this -> socket , $ buf , $ len , $ flags , $ addr , $ port ) ; } | Sends a message to a socket whether it is connected or not |
50,039 | public function listAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbCatalogBundle:Storage' ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ rep = $ this -> getDoctrine ( ) -> getRepository ( 'AnimeDbCatalogBundle:Storage' ) ; return $ t... | Storage list . |
50,040 | public function changeAction ( Storage $ storage , Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( $ storage -> getDateUpdate ( ) ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ form = $ this -> createForm ( new StorageForm ( ) , $ storage ) ; if ( $ r... | Change storage . |
50,041 | public function addAction ( Request $ request ) { $ storage = new Storage ( ) ; $ form = $ this -> createForm ( new StorageForm ( ) , $ storage ) ; if ( $ request -> getMethod ( ) == 'POST' ) { $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ ... | Add storage . |
50,042 | public function deleteAction ( Storage $ storage ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ em -> remove ( $ storage ) ; $ em -> flush ( ) ; return $ this -> redirect ( $ this -> generateUrl ( 'storage_list' ) ) ; } | Delete storage . |
50,043 | public function getPathAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbCatalogBundle:Storage' , - 1 , new JsonResponse ( ) ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ storage = $ this -> getDoctrine ( ) -> getManager ( ) -> find ( ... | Get storage path . |
50,044 | public function scanAction ( Storage $ storage ) { $ this -> get ( 'anime_db.storage.scan_executor' ) -> export ( $ storage ) ; return $ this -> render ( 'AnimeDbCatalogBundle:Storage:scan.html.twig' , [ 'storage' => $ storage , ] ) ; } | Scan storage . |
50,045 | public function scanOutputAction ( Storage $ storage , Request $ request ) { $ filename = $ this -> container -> getParameter ( 'anime_db.catalog.storage.scan_output' ) ; $ filename = sprintf ( $ filename , $ storage -> getId ( ) ) ; if ( ! file_exists ( $ filename ) ) { throw $ this -> createNotFoundException ( 'Log f... | Get storage scan output . |
50,046 | public function scanProgressAction ( Storage $ storage ) { $ filename = $ this -> container -> getParameter ( 'anime_db.catalog.storage.scan_progress' ) ; $ filename = sprintf ( $ filename , $ storage -> getId ( ) ) ; if ( ! file_exists ( $ filename ) ) { throw $ this -> createNotFoundException ( 'The progress status c... | Get storage scan progress . |
50,047 | public function actionIndex ( $ option = null ) { if ( ! ConfigHelper :: isDetected ( ) ) { Question :: confirm ( 'Config not detected! Restore?' , 1 ) ; ConfigHelper :: restoreConfig ( ) ; } $ option = Question :: displayWithQuit ( 'Set offline state' , [ 'Enable' , 'Disable' ] , $ option ) ; $ result = ConfigHelper :... | Set offline mode |
50,048 | public function buildInput ( ApiDoc $ annotation , $ data = null ) { $ annotationReflection = new \ ReflectionClass ( 'Nelmio\ApiDocBundle\Annotation\ApiDoc' ) ; $ inputReflection = $ annotationReflection -> getProperty ( 'input' ) ; $ inputReflection -> setAccessible ( true ) ; if ( ! ( isset ( $ data [ 'input' ] ) ||... | Method that adds the input property of ApiDoc getting the form type s fully qualified name . |
50,049 | public function buildOutput ( ApiDoc $ annotation , $ data = null ) { $ annotationReflection = new \ ReflectionClass ( 'Nelmio\ApiDocBundle\Annotation\ApiDoc' ) ; $ outputReflection = $ annotationReflection -> getProperty ( 'output' ) ; $ outputReflection -> setAccessible ( true ) ; if ( ! ( isset ( $ data [ 'output' ]... | Method that adds the output property of ApiDoc getting the model s fully qualified name . |
50,050 | protected function checkExists ( $ id ) { $ filter = array ( 'fields' => array ( array ( 'field' => 'id' , 'compare' => '=' , 'value' => $ id , ) , ) , ) ; $ exists = $ this -> rubric -> count ( $ filter ) ; return $ exists ? true : false ; } | Check for exists |
50,051 | final public function unhighlightString ( $ contents = '' , $ update_file = false , array $ replacements = array ( '<br />' => PHP_EOL , '<br>' => PHP_EOL , ' ' => ' ' ) ) { $ contents = str_replace ( array_keys ( $ replacements ) , array_values ( $ replacements ) , $ contents ) ; $ contents = strip_tags ( $ conte... | Inverse of highlight function . Attempts to convert HTML to regular string |
50,052 | public function write ( ) { foreach ( $ this -> parameters as $ prop => $ value ) { $ placeHolders [ ] = sprintf ( '<%s>' , $ prop ) ; $ replacements [ ] = $ value ; } $ content = str_replace ( $ placeHolders , $ replacements , self :: $ template ) ; fwrite ( $ this -> file , $ this -> addHeaders ( $ content ) ) ; } | Write staging in file . |
50,053 | public static function setObjectFilter ( $ Class , $ Filter ) { $ instance = FirePHP :: getInstance ( true ) ; $ instance -> setObjectFilter ( $ Class , $ Filter ) ; } | Specify a filter to be used when encoding an object |
50,054 | public static function send ( ) { $ instance = FirePHP :: getInstance ( true ) ; $ args = func_get_args ( ) ; return call_user_func_array ( array ( $ instance , 'fb' ) , $ args ) ; } | Log object to firebug |
50,055 | public static function group ( $ Name , $ Options = null ) { $ instance = FirePHP :: getInstance ( true ) ; return $ instance -> group ( $ Name , $ Options ) ; } | Start a group for following messages |
50,056 | public static function getInstance ( $ AutoCreate = false ) { if ( $ AutoCreate === true && ! self :: $ instance ) { self :: init ( ) ; } return self :: $ instance ; } | Gets singleton instance of FirePHP |
50,057 | public function setLogToInsightConsole ( $ console ) { if ( is_string ( $ console ) ) { if ( get_class ( $ this ) != 'FirePHP_Insight' && ! is_subclass_of ( $ this , 'FirePHP_Insight' ) ) { throw new Exception ( 'FirePHP instance not an instance or subclass of FirePHP_Insight!' ) ; } $ this -> logToInsightConsole = $ t... | Set an Insight console to direct all logging calls to |
50,058 | public function setOption ( $ Name , $ Value ) { if ( ! isset ( $ this -> options [ $ Name ] ) ) { throw $ this -> newException ( 'Unknown option: ' . $ Name ) ; } $ this -> options [ $ Name ] = $ Value ; } | Set an option for the library |
50,059 | public function getOption ( $ Name ) { if ( ! isset ( $ this -> options [ $ Name ] ) ) { throw $ this -> newException ( 'Unknown option: ' . $ Name ) ; } return $ this -> options [ $ Name ] ; } | Get an option from the library |
50,060 | public function errorHandler ( $ errno , $ errstr , $ errfile , $ errline , $ errcontext ) { if ( error_reporting ( ) == 0 ) { return ; } if ( error_reporting ( ) & $ errno ) { $ exception = new ErrorException ( $ errstr , 0 , $ errno , $ errfile , $ errline ) ; if ( $ this -> throwErrorExceptions ) { throw $ exception... | FirePHP s error handler |
50,061 | function exceptionHandler ( $ Exception ) { $ this -> inExceptionHandler = true ; header ( 'HTTP/1.1 500 Internal Server Error' ) ; try { $ this -> fb ( $ Exception ) ; } catch ( Exception $ e ) { echo 'We had an exception: ' . $ e ; } $ this -> inExceptionHandler = false ; } | FirePHP s exception handler |
50,062 | public function registerAssertionHandler ( $ convertAssertionErrorsToExceptions = true , $ throwAssertionExceptions = false ) { $ this -> convertAssertionErrorsToExceptions = $ convertAssertionErrorsToExceptions ; $ this -> throwAssertionExceptions = $ throwAssertionExceptions ; if ( $ throwAssertionExceptions && ! $ c... | Register FirePHP driver as your assert callback |
50,063 | public function assertionHandler ( $ file , $ line , $ code ) { if ( $ this -> convertAssertionErrorsToExceptions ) { $ exception = new ErrorException ( 'Assertion Failed - Code[ ' . $ code . ' ]' , 0 , null , $ file , $ line ) ; if ( $ this -> throwAssertionExceptions ) { throw $ exception ; } else { $ this -> fb ( $ ... | FirePHP s assertion handler |
50,064 | public function group ( $ Name , $ Options = null ) { if ( ! $ Name ) { throw $ this -> newException ( 'You must specify a label for the group!' ) ; } if ( $ Options ) { if ( ! is_array ( $ Options ) ) { throw $ this -> newException ( 'Options must be defined as an array!' ) ; } if ( array_key_exists ( 'Collapsed' , $ ... | Start a group for following messages . |
50,065 | public function dump ( $ Key , $ Variable , $ Options = array ( ) ) { if ( ! is_string ( $ Key ) ) { throw $ this -> newException ( 'Key passed to dump() is not a string' ) ; } if ( strlen ( $ Key ) > 100 ) { throw $ this -> newException ( 'Key passed to dump() is longer than 100 characters' ) ; } if ( ! preg_match_all... | Dumps key and variable to firebug server panel |
50,066 | public function table ( $ Label , $ Table , $ Options = array ( ) ) { return $ this -> fb ( $ Table , $ Label , FirePHP :: TABLE , $ Options ) ; } | Log a table in the firebug console |
50,067 | public static function to ( ) { $ instance = self :: getInstance ( ) ; if ( ! method_exists ( $ instance , "_to" ) ) { throw new Exception ( "FirePHP::to() implementation not loaded" ) ; } $ args = func_get_args ( ) ; return call_user_func_array ( array ( $ instance , '_to' ) , $ args ) ; } | Insight API wrapper |
50,068 | public function detectClientExtension ( ) { if ( @ preg_match_all ( '/\sFirePHP\/([\.\d]*)\s?/si' , $ this -> getUserAgent ( ) , $ m ) && version_compare ( $ m [ 1 ] [ 0 ] , '0.0.6' , '>=' ) ) { return true ; } else if ( @ preg_match_all ( '/^([\.\d]*)$/si' , $ this -> getRequestHeader ( "X-FirePHP-Version" ) , $ m ) &... | Check if FirePHP is installed on client |
50,069 | protected function _escapeTrace ( $ Trace ) { if ( ! $ Trace ) return $ Trace ; for ( $ i = 0 ; $ i < sizeof ( $ Trace ) ; $ i ++ ) { if ( isset ( $ Trace [ $ i ] [ 'file' ] ) ) { $ Trace [ $ i ] [ 'file' ] = $ this -> _escapeTraceFile ( $ Trace [ $ i ] [ 'file' ] ) ; } if ( isset ( $ Trace [ $ i ] [ 'args' ] ) ) { $ T... | Escape trace path for windows systems |
50,070 | protected function getRequestHeader ( $ Name ) { $ headers = self :: getAllRequestHeaders ( ) ; if ( isset ( $ headers [ strtolower ( $ Name ) ] ) ) { return $ headers [ strtolower ( $ Name ) ] ; } return false ; } | Get a request header |
50,071 | public function jsonEncode ( $ Object , $ skipObjectEncode = false ) { if ( ! $ skipObjectEncode ) { $ Object = $ this -> encodeObject ( $ Object ) ; } if ( function_exists ( 'json_encode' ) && $ this -> options [ 'useNativeJsonEncode' ] != false ) { return json_encode ( $ Object ) ; } else { return $ this -> json_enco... | Encode an object into a JSON string |
50,072 | public function saveRole ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tableRole ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; } | Save role . |
50,073 | public function saveResource ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tableResource ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; } | Save resource . |
50,074 | public function savePrivilege ( array $ values ) : int { $ result = $ this -> generalSave ( $ values , $ this -> tablePrivilege ) ; $ this -> cache -> clean ( [ Cache :: TAGS => [ 'DibiDriver' ] ] ) ; return $ result ; } | Save privilege . |
50,075 | public function buildInQueryBindings ( $ values , $ prefix = "in_" , & $ bound_parameters = array ( ) ) { $ sql = "()" ; if ( is_array ( $ values ) && count ( $ values ) > 0 ) { $ sql = array ( ) ; $ values = array_values ( $ values ) ; foreach ( $ values as $ index => $ value ) { $ label_name = $ prefix . "_" . $ inde... | Builds a sub - query for an IN statement with bound values . |
50,076 | public function query ( $ sql , array $ bound_parameters = array ( ) , $ fetch = true ) { $ statement = $ this -> entity_manager -> getConnection ( ) -> prepare ( $ sql ) ; foreach ( $ bound_parameters as $ parameter => $ value ) { $ statement -> bindValue ( $ parameter , $ value ) ; } $ statement -> execute ( ) ; if (... | Performs an arbitrary SQL query . |
50,077 | public function queryDQL ( $ dql , array $ bound_parameters = array ( ) ) { $ statement = $ this -> entity_manager -> createQuery ( $ dql ) ; foreach ( $ bound_parameters as $ parameter => $ value ) { $ statement -> setParameter ( $ parameter , $ value ) ; } return $ statement -> getResult ( ) ; } | Performs an arbitrary DQL query . |
50,078 | public static function useIdentity ( $ username = null , $ password = null , $ timeout = null ) { $ httpClient = \ EasyRdf_Http :: getDefaultHttpClient ( ) ; if ( ! ( $ httpClient instanceof \ Zend_Http_Client or $ httpClient instanceof HttpClient ) ) { $ httpClient = new HttpClient ( null , array ( 'maxredirects' => 5... | Just an helper to use HttPClient as default EastRdf_default_client ) |
50,079 | protected function hasHeader ( Part $ part , $ header ) { if ( count ( $ part -> getHeaders ( ) ) < 1 ) { return false ; } return $ part -> getHeaders ( ) -> has ( $ header ) ; } | The confusing zend API makes a custom function for header checking necessary . |
50,080 | protected function getContentType ( Part $ part ) { if ( ! $ this -> hasHeader ( $ part , 'Content-Type' ) ) { throw new Exception ( 'This email does not have a content type. Check for that with hasContentType()' ) ; } $ zendContentType = $ part -> getHeaders ( ) -> get ( 'Content-Type' ) ; switch ( true ) { case is_ar... | Returns the content type of the given part . Since zends API allows for four different return values we need to handle every type differently . Multiple content - type headers can t be accounted for in those cases we simply take the first one and hope for the best . If it doesn t work there s not much that could be don... |
50,081 | public function convertToDatabaseValue ( $ value , $ marshal = true ) { $ converted = $ value !== null ? $ this -> databaseValue ( $ value ) : null ; if ( ! $ marshal ) { return $ converted ; } return $ converted === null ? self :: getNull ( ) : [ static :: $ dynamoKey => $ converted ] ; } | Converts a value from its PHP representation of this type to its serialized DynamoDB representation optionally applying marshalling afterwards . |
50,082 | public function convertToPHPValue ( $ value , $ unmarshal = true ) { if ( $ unmarshal ) { $ value = $ value === self :: getNull ( ) ? null : $ value [ static :: $ dynamoKey ] ; } return $ value === null ? null : $ this -> phpValue ( $ value ) ; } | Converts a value from its serialized DynamoDB representation to its PHP representation of this type optionally unmarshalling it first . |
50,083 | public static function convertUnmappedToPHPValue ( $ value ) { $ type = key ( $ value ) ; $ value = current ( $ value ) ; switch ( $ type ) { case 'S' : case 'B' : case 'BOOL' : return $ value ; case 'NULL' : return null ; case 'N' : return $ value + 0 ; case 'M' : case 'L' : foreach ( $ value as $ k => $ v ) { $ value... | Child values of a list or map do not have an ODM type mapped it must be inferred from the value and DynamoDB data type . |
50,084 | public static function fromName ( string $ countryName ) : Country { self :: getNameMap ( ) ; if ( ! isset ( self :: $ alpha2CodeMap [ $ countryName ] ) ) { throw InvalidArgumentException :: format ( 'Invalid country short name supplied to %s: country \'%s\' is not a valid option' , __METHOD__ , $ countryName ) ; } ret... | Builds a country enum from the supplied country short name . |
50,085 | public static function getNameMap ( ) : array { if ( self :: $ nameMap === null ) { self :: $ nameMap = [ ] ; $ countries = self :: getLoader ( ) -> all ( ) ; foreach ( $ countries as $ country ) { self :: $ nameMap [ $ country [ 'alpha2' ] ] = $ country [ 'name' ] ; } self :: $ alpha2CodeMap = array_flip ( self :: $ n... | Returns an array the country short names indexed by their respective ISO 3166 - 1 alpha - 2 country code . |
50,086 | public function combine ( $ op , $ map1 ) { $ transformations = func_get_args ( ) ; array_shift ( $ transformations ) ; return function ( Expression $ expr , $ compiler ) use ( $ op , $ transformations ) { $ tree = new SpanExpression ( strtoupper ( $ op ) ) ; foreach ( $ transformations as $ transformation ) { $ tree -... | Combine many maps to a single tree one |
50,087 | public function regexps ( array $ regexpsMap ) { return function ( FieldExpression $ expr , $ compiler ) use ( $ regexpsMap ) { $ value = $ expr -> getValue ( ) ; foreach ( $ regexpsMap as $ regexp => $ transformation ) { if ( preg_match ( $ regexp , $ value ) ) return $ transformation ( $ expr , $ compiler ) ; } throw... | This map select the transformation with regexps on the exoression value |
50,088 | public function conditional ( $ condition1 , $ map1 ) { $ args = func_get_args ( ) ; return function ( Expression $ expr , $ compiler ) use ( $ args ) { $ numargs = count ( $ args ) ; for ( $ i = 0 ; $ i + 1 < $ numargs ; $ i += 2 ) { $ condition = $ args [ $ i ] ; $ map = $ args [ $ i + 1 ] ; if ( $ condition ( $ expr... | Build a map from a collection of condition and map couples . It will be used the map of the first matched condition . |
50,089 | public function attr ( $ map , array $ attributes ) { return function ( Expression $ expr , $ compiler ) use ( $ map , $ attributes ) { $ luceneExpr = $ map ( $ expr , $ compiler ) ; foreach ( $ attributes as $ name => $ value ) { $ luceneExpr [ $ name ] = $ value ; } return $ luceneExpr ; } ; } | Set attributes in the resulting expression . |
50,090 | public function middleware ( $ name = '' , $ role = '' , Closure $ next = null ) { if ( ! $ this -> accessDispatcher ) { $ this -> accessDispatcher = new AccessDispatcher ( ) ; } $ middleware = $ this -> accessDispatcher -> process ( [ 'name' => $ name , 'role' => $ role , 'next' => $ next ] ) ; if ( true !== $ middlew... | determine user authentication |
50,091 | public function path ( ) { $ args = func_get_args ( ) ; if ( count ( $ args ) ) { $ this -> path = $ this -> verify ( $ args [ 0 ] ) ; } return $ this -> path ; } | Get or set the path . |
50,092 | public function verify ( $ path ) { $ full_path = realpath ( $ path ) ; $ data = @ getimagesize ( $ full_path ) ; if ( ! $ data ) { throw new FileException ( sprintf ( 'File "%s" cannot be read.' , $ path ) , 1 ) ; } if ( $ data [ 2 ] != IMG_JPG ) { throw new FileException ( sprintf ( 'File "%s" is not a JPG.' , $ path... | Verify the file at a path . |
50,093 | public function renderContent ( ) { $ string = json_encode ( $ this -> getContent ( ) , $ this -> option , $ this -> depth ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { throw new \ RuntimeException ( 'Json encode error ! (error: ' . json_last_error_msg ( ) . ')' ) ; } return $ string ; } | Encode content into json format & display it . |
50,094 | protected function load ( SplFileInfo $ file ) { $ this -> filename = $ file -> getBasename ( ) ; $ this -> sourcePath = $ file -> getRelativePath ( ) ; $ data = $ file -> getContents ( ) ; list ( $ content , $ meta ) = $ this -> splitContentMeta ( $ data ) ; $ meta = Yaml :: parse ( $ meta ) ? : [ ] ; switch ( $ file ... | Load and parse content from file . |
50,095 | protected function splitContentMeta ( $ data ) { $ data = preg_replace ( '/\x{EF}\x{BB}\x{BF}/' , '' , $ data ) ; $ pattern = '/' . '^' . '---' . '\\s*' . '$' . '/m' ; $ data = trim ( $ data ) ; if ( ( substr ( $ data , 0 , 3 ) === '---' ) && ( preg_match ( $ pattern , $ data , $ matches , PREG_OFFSET_CAPTURE , 3 ) ) )... | Parse metadata and content |
50,096 | protected function setTarget ( SplFileInfo $ file ) { $ ext = $ file -> getExtension ( ) ; if ( ! $ this -> has ( 'template' ) || $ this -> get ( 'template' ) === 'none' ) { $ targetExt = $ ext ; } else { $ targetExt = 'html' ; } $ sourcePath = $ this -> getCleanPath ( $ file -> getRelativePathName ( ) ) ; $ this -> ta... | Determine the target path . |
50,097 | public function setMethodCalls ( array $ calls = array ( ) ) { $ this -> calls = array ( ) ; foreach ( $ calls as $ call ) { $ this -> addMethodCall ( $ call [ 0 ] , $ call [ 1 ] ) ; } return $ this ; } | Sets the methods to call after service initialization . |
50,098 | public function addAutowiringType ( $ type ) { @ trigger_error ( sprintf ( 'Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".' , $ type ) , E_USER_DEPRECATED ) ; $ this -> autowiringTypes [ $ type ] = true ; return $ this ; } | Adds a type that will default to this definition . |
50,099 | public function hasAutowiringType ( $ type ) { @ trigger_error ( sprintf ( 'Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead for "%s".' , $ type ) , E_USER_DEPRECATED ) ; return isset ( $ this -> autowiringTypes [ $ type ] ) ; } | Will this definition default for the given type? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.