idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
56,900 | public function injectMessages ( Message $ messages ) { $ this -> messages = $ messages ; $ this -> messages -> setCookie ( $ this -> cookies ) ; } | Injects messages manager instance |
56,901 | private function formatBytes ( $ bytes , $ precision = 2 ) { $ unit = array ( 'B' , 'KB' , 'MB' , 'GB' , 'TB' , 'PB' , 'EB' ) ; if ( ! $ bytes ) { return "0 B" ; } return @ round ( $ bytes / pow ( 1024 , ( $ i = floor ( log ( $ bytes , 1024 ) ) ) ) , $ precision ) . ' ' . $ unit [ $ i ] ; } | formats a bigint into a human readable size |
56,902 | public function removeAll ( ) { foreach ( $ this -> handles as $ transaction ) { $ ch = $ this -> handles [ $ transaction ] ; curl_multi_remove_handle ( $ this -> multi , $ ch ) ; curl_close ( $ ch ) ; unset ( $ this -> handles [ $ transaction ] ) ; } } | Closes all of the requests associated with the underlying multi handle . |
56,903 | public function findTransaction ( $ handle ) { foreach ( $ this -> handles as $ transaction ) { if ( $ this -> handles [ $ transaction ] === $ handle ) { return $ transaction ; } } throw new AdapterException ( 'No curl handle was found' ) ; } | Find a transaction for a given curl handle |
56,904 | public function nextPending ( ) { if ( ! $ this -> hasPending ( ) ) { return null ; } $ current = $ this -> pending -> current ( ) ; $ this -> pending -> next ( ) ; return $ current ; } | Pop the next transaction from the transaction queue |
56,905 | public function addTransaction ( TransactionInterface $ transaction , $ handle ) { if ( isset ( $ this -> handles [ $ transaction ] ) ) { throw new AdapterException ( 'Transaction already registered' ) ; } $ code = curl_multi_add_handle ( $ this -> multi , $ handle ) ; if ( $ code != CURLM_OK ) { MultiAdapter :: throwM... | Add a transaction to the multi handle |
56,906 | public function removeTransaction ( TransactionInterface $ transaction ) { if ( ! isset ( $ this -> handles [ $ transaction ] ) ) { throw new AdapterException ( 'Transaction not registered' ) ; } $ handle = $ this -> handles [ $ transaction ] ; $ this -> handles -> detach ( $ transaction ) ; $ info = curl_getinfo ( $ h... | Remove a transaction and associated handle from the context |
56,907 | public function write ( string $ level , string $ message , array $ context ) { $ levnum = Logger :: getLevelNumeric ( $ level ) ; if ( $ levnum < $ this -> min_level ) return ; $ lvl = sprintf ( "%10s" , $ level ) ; $ message = $ this -> format ( $ lvl , $ message , $ context ) ; $ this -> log [ ] = $ message ; } | Log a line to the memory log if its level is high enough |
56,908 | protected function getSelect ( $ table = null ) { $ this -> initialize ( ) ; $ select = $ this -> getSlaveSql ( ) -> select ( ) ; $ select -> from ( $ table ? : $ this -> getTableName ( ) ) ; return $ select ; } | The version allows read - write access . |
56,909 | private function runCommand ( $ cmd , $ package = null , $ args , $ noAddtlArguments = false ) { $ translator = $ this -> getServiceLocator ( ) -> get ( 'translator' ) ; $ docPath = str_replace ( [ '\\' , 'public/../' ] , '' , $ this -> getDocumentRoot ( ) ) ; $ docPath = trim ( substr ( $ docPath , 0 , strlen ( $ docP... | This calls the composer CLI to execute a command |
56,910 | public function setDocumentRoot ( $ documentRoot ) { if ( $ documentRoot ) { $ this -> documentRoot = $ documentRoot ; } else { $ this -> documentRoot = $ this -> getDefaultDocRoot ( ) ; } } | Sets the path of the platform if nothing is set then it will use the default path of this platform |
56,911 | private function availableCommands ( ) { return [ self :: INSTALL , self :: UPDATE , self :: DUMP_AUTOLOAD , self :: DOWNLOAD , self :: REMOVE , ] ; } | Sets the limitation to what commands that can be executed |
56,912 | public function preFlush ( PreFlushEventArgs $ args ) { $ objectManager = $ args -> getEntityManager ( ) ; $ unitOfWork = $ objectManager -> getUnitOfWork ( ) ; $ entityMap = $ unitOfWork -> getIdentityMap ( ) ; foreach ( $ entityMap as $ objectClass => $ objects ) { if ( in_array ( UploadObjectInterface :: class , cla... | Prepares upload file references for all objects implementing the UploadObjectInterface . |
56,913 | public function prePersist ( LifecycleEventArgs $ args ) { $ object = $ args -> getObject ( ) ; if ( $ object instanceof UploadObjectInterface ) { $ this -> prepareUploadFileReferences ( $ object ) ; } } | Prepares upload file references for a new object implementing the UploadObjectInterface . |
56,914 | public function postPersist ( LifecycleEventArgs $ args ) { $ object = $ args -> getObject ( ) ; if ( $ object instanceof UploadObjectInterface ) { $ this -> storeFileUploads ( $ object ) ; } } | Stores the file uploads . |
56,915 | private function prepareUploadFileReferences ( UploadObjectInterface $ object ) { $ object -> setFileUploadPath ( $ this -> fileUploadPath ) ; $ reflectionClass = new ReflectionClass ( $ object ) ; $ objectName = $ reflectionClass -> getShortName ( ) ; $ fileUploads = $ object -> getFileUploads ( ) ; $ fileFieldConfigu... | Sets the new file references to the uploaded files on the object and schedules the previous file reference for deletion . |
56,916 | private function storeFileUploads ( UploadObjectInterface $ object ) { $ reflectionClass = new ReflectionClass ( $ object ) ; $ objectName = $ reflectionClass -> getShortName ( ) ; $ fileUploads = $ object -> getFileUploads ( ) ; $ fileFieldConfigurations = $ this -> flexModel -> getFieldsByDatatype ( $ objectName , 'F... | Stores the uploaded files to the specified file system location . |
56,917 | protected function setOrderCompletePage ( array $ order , $ model , $ controller ) { $ this -> order = $ model ; $ this -> data_order = $ order ; $ this -> controller = $ controller ; if ( $ order [ 'payment' ] === 'twocheckout' ) { $ this -> submitPayment ( ) ; $ this -> completePayment ( ) ; } } | Set order complete page |
56,918 | protected function completePayment ( ) { if ( $ this -> controller -> isQuery ( 'paid' ) ) { $ gateway = $ this -> getGateway ( ) ; $ this -> response = $ gateway -> completePurchase ( $ this -> getPurchaseParams ( ) ) -> send ( ) ; $ this -> processResponse ( ) ; } } | Performs actions when purchase is completed |
56,919 | public function replace ( array $ data ) { $ addFields = implode ( '`,`' , array_keys ( $ data ) ) ; return $ this -> command ( ) -> insertOrReplace ( "`{$addFields}`" , Str :: repeat ( '?' , $ data ) , array_values ( $ data ) ) ; } | INSERT OR REPLACE |
56,920 | protected function SetJSFieldValue ( $ field , $ value ) { $ jsField = Str :: ToJavascript ( $ field , false ) ; $ jsValue = Str :: ToJavascript ( $ value , false ) ; echo "<script>$($jsField).val($jsValue);</script>" ; } | Sets a field value as typical action of a modal form call |
56,921 | protected function SetJSHtml ( $ element , $ html ) { $ jsElement = Str :: ToJavascript ( $ element , false ) ; $ jsHtml = Str :: ToJavascript ( $ html , false ) ; echo "<script>$($jsElement).html($jsHtml);</script>" ; } | Sets element html content as a typical action of a modal form call |
56,922 | private function add ( $ field , $ args ) { if ( $ this -> hasField ( $ field ) && null !== $ args [ 0 ] ) { $ this -> virtualFieldsCollection [ $ field ] [ ] = $ args [ 0 ] ; } else if ( null === $ args [ 0 ] ) { throw new \ InvalidArgumentException ( "The argument given is null " ) ; } else { throw new \ BadMethodCal... | Add an object to a collection |
56,923 | public function setContentType ( $ type , $ statusCode = null ) { if ( isset ( static :: $ _types [ $ type ] ) ) { $ type = static :: $ _types [ $ type ] ; } $ this -> setHeader ( 'Content-Type' , $ type ) ; if ( $ statusCode ) { $ this -> _statusCode = $ statusCode ; } } | Set the response content type header and status code . |
56,924 | public function send ( ) { if ( headers_sent ( ) ) { return false ; } foreach ( $ this -> getHeaders ( ) as $ h ) { header ( $ h [ 0 ] . ': ' . $ h [ 1 ] , false , $ this -> _statusCode ) ; } if ( function_exists ( 'http_response_code' ) ) { http_response_code ( $ this -> _statusCode ) ; } echo $ this -> _content ; ret... | Send the response using the normal PHP functions . |
56,925 | public function convertExpressionsToStrings ( ) { $ this -> setMainQuery ( ( string ) $ this -> getMainQuery ( ) ) ; $ this -> setFilterQueries ( array_map ( function ( $ expr ) { return ( string ) $ expr ; } , $ this -> getFilterQueries ( ) ) ) ; return $ this ; } | Convert all expressions to strings . |
56,926 | protected function enqueue ( $ eventName , $ resourceOrEvent ) { if ( ! $ this -> isOpened ( ) ) { throw new RuntimeException ( "The event queue is closed." ) ; } if ( ! preg_match ( '~^[a-z_]+\.[a-z_]+\.[a-z_]+$~' , $ eventName ) ) { throw new InvalidArgumentException ( "Unexpected event name '{$eventName}'." ) ; } if... | Schedules a resource event of the given type . |
56,927 | protected function getQueueSortingCallback ( ) { $ parentMap = $ this -> registry -> getParentMap ( ) ; $ priorityMap = $ this -> registry -> getEventPriorityMap ( ) ; $ isChildOf = function ( $ a , $ b ) use ( $ parentMap ) { while ( isset ( $ parentMap [ $ a ] ) ) { $ parentId = $ parentMap [ $ a ] ; if ( $ parentId ... | Returns the queue sorting callback . |
56,928 | public function read ( string $ file ) : string { $ destFile = tempnam ( sys_get_temp_dir ( ) , 'pdf_to_text_' ) ; $ command = sprintf ( 'pdftotext -layout %s %s' , escapeshellarg ( realpath ( $ file ) ) , escapeshellarg ( $ destFile ) ) ; $ return = 0 ; $ output = system ( $ command , $ return ) ; $ content = file_get... | Read a file and returns text content |
56,929 | protected function writeMessage ( $ level , $ msg , $ vars = null ) { $ mtimeParts = explode ( ' ' , microtime ( ) ) ; $ repl = array ( Logger :: PATTERN_CLASS => $ this -> classContext , Logger :: PATTERN_CLASSNAME => StringUtils :: afterLast ( $ this -> classContext , '\\' ) , Logger :: PATTERN_LEVEL => str_pad ( $ l... | Writes the message with the given pattern into the defined log - file |
56,930 | protected function renderSlot ( Response $ response , SlotContent $ slotContent ) { if ( null === $ slotContent -> getSlotName ( ) ) { throw new \ RuntimeException ( 'No slot has been defined for the event ' . get_class ( $ this ) ) ; } $ isReplacing = $ slotContent -> isReplacing ( ) ; if ( null === $ isReplacing ) { ... | Renders the current slot |
56,931 | protected function injectContent ( SlotContent $ slotContent , $ content ) { $ regex = $ this -> getPattern ( $ slotContent -> getSlotName ( ) ) ; if ( false == preg_match ( $ regex , $ content , $ match ) ) { return ; } $ newContent = $ match [ 1 ] . PHP_EOL . $ slotContent -> getContent ( ) ; return preg_replace ( $ ... | Injects the content at the end of the given content |
56,932 | public function renderCell ( CellView $ cell ) { $ name = $ cell -> vars [ 'block_prefix' ] . '_cell' ; return trim ( $ this -> template -> renderBlock ( $ name , $ cell -> vars ) ) ; } | Renders a cell . |
56,933 | public function renderPager ( TableView $ view , $ viewName = 'twitter_bootstrap3' , array $ options = [ ] ) { if ( ! $ view -> pager ) { return '' ; } $ pageParam = $ view -> ui [ 'page_name' ] ; $ options = array_merge ( [ 'pageParameter' => '[' . $ pageParam . ']' , 'proximity' => 3 , 'next_message' => '»' , '... | Renders pager . |
56,934 | public function setOptions ( array $ options = array ( ) ) { if ( array_key_exists ( 'messages' , $ options ) ) { $ this -> setMessages ( $ options [ 'messages' ] ) ; } if ( array_key_exists ( 'hostname' , $ options ) ) { if ( array_key_exists ( 'allow' , $ options ) ) { $ this -> setHostnameValidator ( $ options [ 'ho... | Set options for the email validator |
56,935 | public function setValidateMx ( $ mx ) { if ( ( bool ) $ mx && ! $ this -> validateMxSupported ( ) ) { throw new Zend_Validate_Exception ( 'MX checking not available on this system' ) ; } $ this -> _options [ 'mx' ] = ( bool ) $ mx ; return $ this ; } | Set whether we check for a valid MX record via DNS |
56,936 | private function setLimit ( $ limit = self :: NO_LIMIT ) { if ( ! is_int ( $ limit ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ limit ) ) ; } if ( $ limit !== self :: NO_LIMIT && $ limit <= 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ limit ) ; } $ this -> limit = $ limit ; } | Stores the limit . |
56,937 | private function setTotalItems ( $ totalItems ) { if ( ! is_int ( $ totalItems ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ totalItems ) ) ; } if ( $ totalItems < 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ totalItems ) ; } $ this -> totalItems = $ totalItems ; $ this -> changedTotalItems ... | Stores the total amount of items . |
56,938 | private function calculateTotalPages ( ) { if ( $ this -> getTotalItems ( ) === 0 ) { $ this -> setTotalPages ( 1 ) ; return ; } $ totalPages = ceil ( $ this -> getTotalItems ( ) / $ this -> getLimit ( ) ) ; $ this -> setTotalPages ( ( int ) $ totalPages ) ; } | Calculates the total amount of pages . |
56,939 | private function setPage ( $ page ) { if ( ! is_int ( $ page ) ) { throw new Exceptions \ InvalidIntegerType ( gettype ( $ page ) ) ; } if ( $ page <= 0 ) { throw new Exceptions \ PositiveIntegerRequired ( $ page ) ; } $ this -> page = $ page ; $ this -> changedPage ( ) ; } | Stores the current page . |
56,940 | private function calculateOffset ( ) { if ( ! $ this -> hasLimit ( ) ) { $ this -> setOffset ( 0 ) ; return ; } $ offset = ( $ this -> getPage ( ) * $ this -> getLimit ( ) ) - $ this -> getLimit ( ) ; $ this -> setOffset ( ( int ) $ offset ) ; } | Calculates the offset for the current page and limit . |
56,941 | private function calculateFirstItemOnPage ( ) { $ offsetItem = $ this -> getOffset ( ) !== 0 ? 1 : 0 ; if ( $ this -> getTotalItems ( ) !== 0 && $ offsetItem === 0 ) { $ offsetItem = 1 ; } $ firstItem = $ this -> getOffset ( ) + $ offsetItem ; $ this -> setFirstItemOnPage ( ( int ) $ firstItem ) ; } | Calculates which item number is the first on the current page . |
56,942 | private function calculateLastItemOnPage ( ) { if ( ! $ this -> hasLimit ( ) ) { $ this -> setLastItemOnPage ( $ this -> getTotalItems ( ) ) ; return ; } $ lastItem = $ this -> getOffset ( ) + $ this -> getLimit ( ) ; if ( $ this -> getTotalItems ( ) !== 0 && $ lastItem > $ this -> getTotalItems ( ) ) { $ lastItem = $ ... | Calculates which item number is the last on the current page . |
56,943 | public function alert ( $ message , $ type = 'info' ) { Argument :: i ( ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) ; return Alert :: i ( $ message , $ type ) ; } | Returns an alert |
56,944 | public function hero ( array $ images = array ( ) , $ delay = null ) { Argument :: i ( ) -> test ( 2 , 'scalar' , 'null' ) ; $ field = Hero :: i ( ) -> setImages ( $ images ) ; if ( ! is_null ( $ delay ) and is_numeric ( $ delay ) ) { $ field -> setDelay ( $ delay ) ; } return $ field ; } | Returns a hero |
56,945 | public function sort ( array $ query , $ key , $ label , $ url = null ) { Argument :: i ( ) -> test ( 2 , 'string' ) -> test ( 3 , 'string' ) -> test ( 4 , 'string' , 'null' ) ; $ block = Sort :: i ( $ query , $ key , $ label ) ; if ( $ url ) { $ block -> setUrl ( $ url ) ; } return $ block ; } | Returns table sort block |
56,946 | public function setPlatform ( PlatformInterface $ platform ) { $ this -> platform = $ platform ; $ this -> createTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> dropTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> alterTableSQLCollector -> setPlatform ( $ platform ) ; $ this -> init ( ) ; } | Sets the platform used to collect queries . |
56,947 | public function init ( ) { $ this -> createTableSQLCollector -> init ( ) ; $ this -> dropTableSQLCollector -> init ( ) ; $ this -> alterTableSQLCollector -> init ( ) ; $ this -> dropSequenceQueries = array ( ) ; $ this -> dropViewQueries = array ( ) ; $ this -> createViewQueries = array ( ) ; $ this -> createSequenceQu... | Reinitializes the SQL collector . |
56,948 | public function collect ( SchemaDiff $ schemaDiff ) { if ( $ schemaDiff -> getOldAsset ( ) -> getName ( ) !== $ schemaDiff -> getNewAsset ( ) -> getName ( ) ) { $ this -> renameSchemaQueries = array_merge ( $ this -> renameSchemaQueries , $ this -> platform -> getRenameDatabaseSQLQueries ( $ schemaDiff ) ) ; } $ this -... | Collects queries to alter a schema . |
56,949 | public function getQueries ( ) { return array_merge ( $ this -> getDropSequenceQueries ( ) , $ this -> getDropViewQueries ( ) , $ this -> getRenameTableQueries ( ) , $ this -> getDropCheckQueries ( ) , $ this -> getDropForeignKeyQueries ( ) , $ this -> getDropIndexQueries ( ) , $ this -> getDropPrimaryKeyQueries ( ) , ... | Gets the queries to alter the schema . |
56,950 | private function collectTables ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedTables ( ) as $ table ) { $ this -> createTableSQLCollector -> collect ( $ table ) ; } foreach ( $ schemaDiff -> getDroppedTables ( ) as $ table ) { $ this -> dropTableSQLCollector -> collect ( $ table ) ; } foreach ( $ sch... | Collects queries about tables to alter a schema . |
56,951 | private function collectViews ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedViews ( ) as $ view ) { $ this -> createViewQueries = array_merge ( $ this -> createViewQueries , $ this -> platform -> getCreateViewSQLQueries ( $ view ) ) ; } foreach ( $ schemaDiff -> getDroppedViews ( ) as $ view ) { $ t... | Collects queries about views to alter a schema . |
56,952 | private function collectSequences ( SchemaDiff $ schemaDiff ) { foreach ( $ schemaDiff -> getCreatedSequences ( ) as $ sequence ) { $ this -> createSequenceQueries = array_merge ( $ this -> createSequenceQueries , $ this -> platform -> getCreateSequenceSQLQueries ( $ sequence ) ) ; } foreach ( $ schemaDiff -> getDroppe... | Collects queries about sequences to a schema . |
56,953 | public static function is_wp_plugin_active ( $ plugin_file ) { $ active_plugins = ( array ) get_option ( 'active_plugins' , array ( ) ) ; if ( is_multisite ( ) ) { $ active_plugins = array_merge ( $ active_plugins , get_site_option ( 'active_sitewide_plugins' , array ( ) ) ) ; } return in_array ( $ plugin_file , $ acti... | Checks if plugin is active . Needs to be enabled in deferred way . |
56,954 | public function indexAction ( $ access ) { $ em = $ this -> getDoctrineManager ( ) ; $ sf = $ this -> container -> get ( 'sakonnin.files' ) ; $ files = $ sf -> getFilesForLoggedIn ( ) ; if ( $ this -> isRest ( $ access ) ) { return $ this -> returnRestData ( $ request , $ files , array ( 'html' => 'file:_index.html.twi... | Lists all file entities . |
56,955 | public function newAction ( Request $ request , $ access ) { $ file = new SakonninFile ( ) ; $ form = $ this -> createCreateForm ( $ file ) ; $ data = $ request -> request -> all ( ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ sf = $ this -> container -> get (... | Creates a new file entity . |
56,956 | public function showAction ( Request $ request , SakonninFile $ file , $ access ) { $ deleteForm = $ this -> createDeleteForm ( $ file ) ; return $ this -> render ( 'BisonLabSakonninBundle:SakonninFile:show.html.twig' , array ( 'file' => $ file , 'delete_form' => $ deleteForm -> createView ( ) , ) ) ; } | Finds and displays a file entity . |
56,957 | public function viewAction ( Request $ request , SakonninFile $ file , $ access ) { $ path = $ this -> getFilePath ( ) ; $ response = new BinaryFileResponse ( $ path . "/" . $ file -> getStoredAs ( ) ) ; return $ response ; } | View a file . |
56,958 | public function editAction ( Request $ request , SakonninFile $ file , $ access ) { $ deleteForm = $ this -> createDeleteForm ( $ file ) ; $ editForm = $ this -> createForm ( 'BisonLab\SakonninBundle\Form\SakonninFileType' , $ file ) ; $ editForm -> handleRequest ( $ request ) ; if ( $ editForm -> isSubmitted ( ) && $ ... | Displays a form to edit an existing file entity . |
56,959 | public function deleteAction ( Request $ request , SakonninFile $ file , $ access ) { $ form = $ this -> createDeleteForm ( $ file ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ em = $ this -> getDoctrineManager ( ) ; $ em -> remove ( $ file ) ; $ em -> flush (... | Deletes a file entity . |
56,960 | public function createDeleteForm ( SakonninFile $ file ) { return $ this -> createFormBuilder ( ) -> setAction ( $ this -> generateUrl ( 'file_delete' , array ( 'id' => $ file -> getId ( ) ) ) ) -> setMethod ( 'DELETE' ) -> getForm ( ) ; } | Creates a form to delete a file entity . |
56,961 | public function onBootstrap ( EventInterface $ e ) { $ application = $ e -> getTarget ( ) ; $ serviceManager = $ application -> getServiceManager ( ) ; $ eventManager = $ application -> getEventManager ( ) ; $ eventManager -> attachAggregate ( $ serviceManager -> get ( 'Mailer\Mvc\PasswordRecoveryListener' ) ) ; $ even... | Registra delle azioni agli eventi che necesitano di invio email |
56,962 | public static function get ( $ type ) { $ instance = null ; switch ( $ type ) { case 'IM/Send' : $ instance = new SendService ( ) ; break ; case 'IM/Status' : $ instance = new StatusService ( ) ; break ; case 'TFA/Request' : $ instance = new RequestService ( ) ; break ; case 'TFA/Validate' : $ instance = new ValidateSe... | Get instance of the specified service . |
56,963 | public function make ( $ type ) { $ type = __NAMESPACE__ . "\\" . $ type ; if ( class_exists ( $ type ) ) { $ object = new $ type ( $ this -> helper ) ; $ result = $ object -> format ( ) ; if ( is_array ( $ result ) && ! empty ( $ result ) ) { return json_encode ( array_merge ( array ( '@context' => 'http://schema.org'... | Our schema . org object factory |
56,964 | public function shouldPassThrough ( Request $ request ) : bool { if ( empty ( $ this -> http_method ) && empty ( $ this -> http_path ) ) { return true ; } $ method = $ this -> http_method ; $ matches = array_map ( function ( $ path ) use ( $ method ) { $ path = trim ( config ( 'lia.route.prefix' ) , '/' ) . $ path ; if... | If request should pass through the current permission . |
56,965 | public function build ( $ aConnection , $ isDevMode = true ) { Type :: addType ( 'file_id' , FileIdType :: class ) ; return EntityManager :: create ( $ aConnection , Setup :: createYAMLMetadataConfiguration ( [ __DIR__ . '/Mapping' ] , $ isDevMode ) ) ; } | Decorates the doctrine entity manager with library s mappings and custom types . |
56,966 | public function message ( $ ruleOrMessage , $ message = null ) { if ( 1 === func_num_args ( ) ) { $ rule = $ this -> lastRule ; $ message = $ ruleOrMessage ; } else { $ rule = $ ruleOrMessage ; } $ this -> options [ 'messages' ] [ $ this -> lastKey ] [ $ rule ] = $ message ; return $ this ; } | Set rule message for current field |
56,967 | public function check ( $ data = null ) { $ validator = $ this -> getValidator ( $ data ) ; if ( $ validator -> isValid ( ) ) { return $ this -> suc ( ) ; } else { return $ this -> err ( $ validator -> getFirstMessage ( ) ) ; } } | Validate the data and return the ret array |
56,968 | public function data ( $ data ) { if ( ! $ data ) { return $ this ; } if ( ! $ this -> lastKey ) { $ data = [ '' => $ data ] ; } $ this -> options [ 'data' ] = $ data ; return $ this ; } | Set data for validation |
56,969 | protected function getValidator ( $ data = null ) { if ( ! $ this -> validator ) { if ( $ data ) { if ( $ this -> lastKey === '' ) { $ data = [ '' => $ data ] ; } $ this -> options [ 'data' ] = $ data ; } $ this -> validator = $ this -> wei -> validate ( $ this -> options ) ; } return $ this -> validator ; } | Instance validate object |
56,970 | public function addRule ( $ name , $ args ) { $ this -> options [ 'rules' ] [ $ this -> lastKey ] [ $ name ] = $ args ; $ this -> lastRule = $ name ; return $ this ; } | Add rule for current field |
56,971 | protected function getForeignKeysQuery ( $ value ) { $ flt = [ 'TABLE_SCHEMA' => $ value [ 'REFERENCED_TABLE_SCHEMA' ] , 'TABLE_NAME' => $ value [ 'REFERENCED_TABLE_NAME' ] , 'DATA_TYPE' => [ 'char' , 'varchar' , 'text' ] , ] ; if ( array_key_exists ( 'LIMIT' , $ value ) ) { $ flt [ 'LIMIT' ] = $ value [ 'LIMIT' ] ; } ... | prepares the query to detect FKs |
56,972 | private function sManageDynamicFilters ( $ filterArray = null , $ tableToApplyFilterTo = '' ) { if ( is_null ( $ filterArray ) ) { return '' ; } $ fltr = [ ] ; unset ( $ filterArray [ 'LIMIT' ] ) ; foreach ( $ filterArray as $ key => $ value ) { $ fltr [ ] = '`' . $ tableToApplyFilterTo . '`.`' . $ key . '` ' . $ this ... | Internal function to manage the filters passed to the query |
56,973 | private function setArrayLineArrayToFilter ( $ key , $ value , $ referenceTable ) { $ filters2 = implode ( ', ' , array_diff ( $ value , [ '' ] ) ) ; if ( $ filters2 != '' ) { return '(' . $ referenceTable . '`' . $ key . '` IN ("' . str_replace ( ',' , '","' , str_replace ( [ "'" , '"' ] , '' , $ filters2 ) ) . '"))' ... | Builds an filter string from pair of key and value where value is array |
56,974 | private function setArrayLineToFilter ( $ key , $ value ) { $ fTemp = '=' ; if ( ( substr ( $ value , 0 , 1 ) == '%' ) && ( substr ( $ value , - 1 ) == '%' ) ) { $ fTemp = 'LIKE' ; } return '(`' . $ key . '` ' . $ fTemp . '"' . $ value . '")' ; } | Builds an filter string from pair of key and value none array |
56,975 | public function installedAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( 'AnimeDbAppBundle:Plugin' ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ rep = $ this -> getDoctrine ( ) -> getRepository ( 'AnimeDbAppBundle:Plugin' ) ; return $ this -... | Installed plugins . |
56,976 | public function storeAction ( Request $ request ) { $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( [ ] , self :: CACHE_LIFETIME ) ; if ( $ response -> isNotModified ( $ request ) ) { return $ response ; } $ plugins = [ ] ; $ data = $ this -> get ( 'anime_db.api.client' ) -> getPlugins ( ) ; foreach ( $ ... | Store of plugins . |
56,977 | public function getIterator ( ) { if ( $ this -> shared ) { foreach ( $ this -> bindings as $ key => $ binding ) { if ( empty ( $ this -> bound [ $ key ] ) ) { $ this -> bound [ $ key ] = $ this -> container -> getBound ( $ binding ) ; } } return new \ ArrayIterator ( $ this -> bound ) ; } $ bound = [ ] ; foreach ( $ t... | Provides an iterator on top of all registered services obtaining the iterator triggers loading of ALL registered services from the DI container . |
56,978 | public function registerService ( BindingInterface $ binding , $ name = NULL ) { $ key = ( $ name === NULL ) ? $ binding -> getTypeName ( ) : ( string ) $ name ; if ( isset ( $ this -> bindings [ $ key ] ) ) { throw new DuplicateServiceRegistrationException ( sprintf ( 'Service "%s" is already registered' , $ key ) ) ;... | Register a binding in the locator will use the name of the bound type when no name for the service is given . |
56,979 | public function getPhoto ( $ photoId , $ size = 'large' ) { $ photo = Photo :: findOrFail ( $ photoId ) ; switch ( $ size ) { case 'large' : return response ( ) -> download ( storage_path ( ) . '/app/' . $ photo -> pathLarge ) ; case 'small' : return response ( ) -> download ( storage_path ( ) . '/app/' . $ photo -> pa... | Return a photo as a response . |
56,980 | public function getLength ( ) { if ( ! $ this -> container ) { return 0 ; } $ count = count ( $ this -> container ) ; $ keys = array_keys ( $ this -> container ) ; return ( array_keys ( $ this -> container ) === range ( 0 , $ count - 1 ) ) ? $ count : max ( $ keys ) ; } | Copying JS - like . length behavior |
56,981 | public function crudShow ( Request $ request , $ id ) { try { $ entity = $ this -> throwEntityNotFoundException ( $ this -> getRepository ( ) -> find ( $ id ) ) ; $ form = $ this -> createDeleteForm ( $ id ) -> createView ( ) ; return $ this -> commonsResponseVars ( compact ( 'entity' , 'form' ) ) ; } catch ( \ Excepti... | Finds and displays an entity . |
56,982 | public function crudUpdate ( Request $ request , $ id ) { try { $ entity = $ this -> throwEntityNotFoundException ( $ this -> getRepository ( ) -> find ( $ id ) ) ; $ form = $ this -> createForm ( $ this -> getEntityType ( ) , $ entity ) ; $ form -> submit ( $ request ) ; $ page = static :: EDIT_VIEW ; if ( $ form -> i... | Edits an existing entity . |
56,983 | public static function translate ( \ Exception $ e ) : \ Exception { if ( $ e instanceof \ MongoDB \ Driver \ Exception \ ConnectionException || $ e instanceof \ MongoDB \ Driver \ Exception \ ExecutionTimeoutException ) { return new \ Caridea \ Dao \ Exception \ Unreachable ( "System unreachable or connection timed ou... | Translates a MongoDB exception . |
56,984 | public function overwrite ( $ key , $ message = null ) { if ( ! is_array ( $ key ) ) { $ this -> overwrites [ $ key ] = $ message ; return $ this ; } foreach ( $ key as $ k => $ v ) { $ this -> overwrite ( $ k , $ v ) ; } return $ this ; } | Overwrite one or more lang keys |
56,985 | protected function findModelByUUID ( $ uuid ) { if ( ( $ model = Article :: findOne ( [ 'uuid' => $ uuid ] ) ) != null ) { return $ model ; } throw new NotFoundHttpException ( Yii :: t ( 'yii' , 'The requested page does not exist' ) ) ; } | Finds the Article model based on its primary key value . If the model is not found a 404 HTTP exception will be thrown . |
56,986 | public function get ( $ hash = null ) { $ hash = $ hash ? : $ this -> app -> request -> token ( ) ; $ path = $ this -> path ( $ hash ) ; if ( ! file_exists ( $ path ) ) { return false ; } touch ( $ path ) ; $ data = json_decode ( file_get_contents ( $ path ) , true ) ; return $ data ; } | Gets the token data |
56,987 | public function create ( $ data = [ ] ) { $ hash = $ this -> hash ( ) ; $ data = array_merge ( $ data , [ 'token' => $ hash , 'timestamp' => time ( ) ] ) ; $ stored = file_put_contents ( $ this -> path ( $ hash ) , json_encode ( $ data ) ) ; return ( $ stored ) ? $ data : false ; } | Creates a token |
56,988 | public function update ( $ hash = null , $ data ) { $ hash = $ hash ? : $ this -> app -> request -> token ( ) ; $ token = $ this -> get ( $ hash ) ; $ data = array_merge_recursive ( $ token , $ data ) ; $ stored = file_put_contents ( $ this -> path ( $ hash ) , json_encode ( $ data ) ) ; return ( $ stored ) ? $ data : ... | Updates a token |
56,989 | public function destroy ( $ hash = null ) { $ hash = $ hash ? : $ this -> app -> request -> token ( ) ; $ path = $ this -> path ( $ hash ) ; if ( ! file_exists ( $ path ) ) { return true ; } $ success = unlink ( $ path ) ; if ( ! $ success ) { throw new Exception ( "The session could not be erased" , 500 ) ; } return $... | Destroys a token |
56,990 | private function prepare ( $ route ) { $ this -> route = $ route ; $ this -> setBeforeFilter ( $ route -> before ( ) ) ; $ this -> setAfterRelease ( $ route -> after ( ) ) ; } | prepares before filters and after releases from route . |
56,991 | function fallbackRule ( ) { if ( ! isset ( $ this -> fallback_rule ) ) { foreach ( $ this -> rules as $ key => $ rule ) { if ( $ rule -> isFallback ( ) ) { $ this -> fallback_rule = $ rule ; } } } return $ this -> fallback_rule ; } | Fallback rule usually has a key of other but that may not be necessary in all cases . |
56,992 | public function get ( $ handlerServiceId ) { $ handler = $ this -> container -> get ( $ handlerServiceId ) ; if ( ! $ handler instanceof CommandHandlerInterface ) { throw new \ InvalidArgumentException ( 'Handler must be instance if ' . CommandHandlerInterface :: class ) ; } return $ handler ; } | Get command handler |
56,993 | protected static function engine ( ) { $ engine = '' ; foreach ( static :: $ engines as $ name => $ function ) { if ( $ function === null || function_exists ( $ function ) ) { $ engine = $ name ; break ; } } return $ engine ; } | Get name of php Cache engine used . |
56,994 | public static function build ( $ engine = null , $ namespace = '\Eureka\Component\Cache' ) { if ( null === $ engine ) { $ engine = static :: engine ( ) ; } if ( empty ( static :: $ instances [ $ engine ] ) ) { $ class = $ namespace . '\\' . 'CacheWrapper' . $ engine ; static :: $ instances [ $ engine ] = new $ class ( ... | Instantiate Cache Wrapper object & return it . |
56,995 | public static function translate ( $ key , $ params = [ ] , $ language = null , Viewmodel $ viewmodel = null ) { $ identifier = null ; if ( null !== $ viewmodel ) { $ identifier = static :: load ( $ viewmodel ) ; } if ( null === $ key ) { $ key = '' ; } if ( false === is_string ( $ key ) ) { return trigger_error ( spri... | Translate text based on a key |
56,996 | public static function load ( $ source ) { if ( false === is_string ( $ source ) && false === $ source instanceof Viewmodel ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given' , __METHOD__ , gettype ( $ source ) ) , E_USER_ERROR ) ; ... | Loads a new translation file |
56,997 | private static function cache ( File $ cache , File $ file ) { if ( false === isset ( static :: $ translations [ $ cache -> entity ( ) -> getName ( ) ] ) ) { $ parse = true ; if ( true === $ cache -> exists ( ) ) { if ( $ cache -> entity ( ) -> getModificationTime ( ) >= $ file -> entity ( ) -> getModificationTime ( ) ... | Returns cache if exists otherwise the translation cache file is created filled with content and returned |
56,998 | private static function parse ( File $ file ) { $ lines = explode ( "\n" , $ file -> getContent ( ) ) ; $ languages = [ ] ; foreach ( $ lines as $ index => $ line ) { $ line = trim ( $ line ) ; if ( '' === $ line ) { continue ; } preg_match ( '#^\[([a-z_\-0-9]+)\]#i' , $ line , $ language ) ; if ( count ( $ language ) ... | Parses a translation file and converts it into an array |
56,999 | public function check ( array $ scripts , array $ rollbacks ) { $ this -> checkScripts ( $ scripts , $ rollbacks ) ; foreach ( $ scripts as $ k => $ script ) { $ this -> checkScript ( $ script , $ rollbacks [ $ k ] ) ; } } | Check a release scripts & rollbacks and each script separately |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.