idx int64 0 60.3k | question stringlengths 99 4.85k | target stringlengths 5 718 |
|---|---|---|
45,000 | public function create ( $ deal_id , array $ associatedContact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ associatedContact , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdAssociatedContact ) = $ this -> httpClient -> post ( "/deals/{$deal_id}/associated_contacts" , $... | Create an associated contact |
45,001 | public function destroy ( $ deal_id , $ contact_id , array $ options = array ( ) ) { list ( $ code , $ payload ) = $ this -> httpClient -> delete ( "/deals/{$deal_id}/associated_contacts/{$contact_id}" , null , $ options ) ; return $ code == 204 ; } | Remove an associated contact |
45,002 | public function update ( $ id , array $ tag , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ tag , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedTag ) = $ this -> httpClient -> put ( "/tags/{$id}" , $ attributes , $ options ) ; return $ updatedTag ; } | Update a tag |
45,003 | public function create ( array $ dealUnqualifiedReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ dealUnqualifiedReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdDealUnqualifiedReason ) = $ this -> httpClient -> post ( "/deal_unqualified_reasons" , $ attributes ... | Create a deal unqualified reason |
45,004 | public function update ( $ id , array $ dealUnqualifiedReason , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ dealUnqualifiedReason , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedDealUnqualifiedReason ) = $ this -> httpClient -> put ( "/deal_unqualified_reasons/{$id}" , $... | Update a deal unqualified reason |
45,005 | private function cleanup ( $ value ) { $ value = str_replace ( array ( "\r\n" , "\r" ) , "\n" , $ value ) ; $ count = 0 ; $ value = preg_replace ( '#^\%YAML[: ][\d\.]+.*\n#u' , '' , $ value , - 1 , $ count ) ; $ this -> offset += $ count ; $ trimmedValue = preg_replace ( '#^(\#.*?\n)+#s' , '' , $ value , - 1 , $ count ... | Cleanups a YAML string to be parsed . |
45,006 | public function save ( $ data = null ) { parent :: save ( $ data ) ; if ( \ function_exists ( 'opcache_invalidate' ) ) { @ opcache_invalidate ( $ this -> filename , true ) ; } elseif ( \ function_exists ( 'apc_invalidate' ) ) { @ apc_invalidate ( $ this -> filename ) ; } } | Saves PHP file and invalidates opcache . |
45,007 | public static function instance ( $ filename ) { if ( ! \ is_string ( $ filename ) && $ filename ) { throw new \ InvalidArgumentException ( 'Filename should be non-empty string' ) ; } if ( ! isset ( static :: $ instances [ $ filename ] ) ) { static :: $ instances [ $ filename ] = new static ; static :: $ instances [ $ ... | Get file instance . |
45,008 | public function free ( ) { if ( $ this -> locked ) { $ this -> unlock ( ) ; } $ this -> content = null ; $ this -> raw = null ; unset ( static :: $ instances [ $ this -> filename ] ) ; } | Free the file instance . |
45,009 | public function writable ( ) { return file_exists ( $ this -> filename ) ? is_writable ( $ this -> filename ) && is_file ( $ this -> filename ) : $ this -> writableDir ( \ dirname ( $ this -> filename ) ) ; } | Check if file can be written . |
45,010 | public function rename ( $ filename ) { if ( $ this -> exists ( ) && ! @ rename ( $ this -> filename , $ filename ) ) { return false ; } unset ( static :: $ instances [ $ this -> filename ] ) ; static :: $ instances [ $ filename ] = $ this ; $ this -> filename = $ filename ; return true ; } | Rename file in the filesystem if it exists . |
45,011 | public function self ( array $ options = array ( ) ) { list ( $ code , $ resource ) = $ this -> httpClient -> get ( "/users/self" , null , $ options ) ; return $ resource ; } | Retrieve an authenticating user |
45,012 | public function add ( $ message , $ scope = 'default' ) { $ key = md5 ( $ scope . '~' . $ message ) ; $ item = [ 'message' => $ message , 'scope' => $ scope ] ; if ( ! array_key_exists ( $ key , $ this -> messages ) ) { $ this -> messages [ $ key ] = $ item ; } return $ this ; } | Add message to the queue . |
45,013 | public function clear ( $ scope = null ) { if ( $ scope === null ) { $ this -> messages = array ( ) ; } else { foreach ( $ this -> messages as $ key => $ message ) { if ( $ message [ 'scope' ] === $ scope ) { unset ( $ this -> messages [ $ key ] ) ; } } } return $ this ; } | Clear message queue . |
45,014 | public function all ( $ scope = null ) { if ( $ scope === null ) { return array_values ( $ this -> messages ) ; } $ messages = array ( ) ; foreach ( $ this -> messages as $ message ) { if ( $ message [ 'scope' ] === $ scope ) { $ messages [ ] = $ message ; } } return $ messages ; } | Fetch all messages . |
45,015 | public function fetch ( $ scope = null ) { $ messages = $ this -> all ( $ scope ) ; $ this -> clear ( $ scope ) ; return $ messages ; } | Fetch and clear message queue . |
45,016 | public function all ( $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ deals ) = $ this -> httpClient -> get ( "/deals" , $ params , $ options ) ; if ( isset ( $ options [ 'raw' ] ) && $ options [ 'raw' ] ) { return $ deals ; } $ dealsData = array_map ( array ( $ this , 'coerceNestedDealData' ) , $ de... | Retrieve all deals |
45,017 | public function create ( array $ deal , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ deal , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; if ( isset ( $ att... | Create a deal |
45,018 | public function get ( $ id , array $ options = array ( ) ) { list ( $ code , $ deal ) = $ this -> httpClient -> get ( "/deals/{$id}" , null , $ options ) ; if ( isset ( $ options [ 'raw' ] ) && $ options [ 'raw' ] ) { return $ deal ; } $ deal = $ this -> coerceDealData ( $ deal ) ; return $ deal ; } | Retrieve a single deal |
45,019 | public function update ( $ id , array $ deal , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ deal , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; if ( isset ... | Update a deal |
45,020 | public function update ( $ id , array $ product , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ product , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedProduct ) = $ this -> httpClient -> put ( "/products/{$id}" , $ attributes , $ options ) ; return $ updatedProduct ; } | Update a product |
45,021 | public function destroy ( $ id , array $ options = array ( ) ) { list ( $ code , $ payload ) = $ this -> httpClient -> delete ( "/products/{$id}" , null , $ options ) ; return $ code == 204 ; } | Delete a product |
45,022 | public function load ( $ extends = null ) { if ( empty ( $ this -> items ) && $ this -> filename ) { $ files = $ this -> getFiles ( $ this -> filename ) ; $ data = $ this -> doLoad ( $ files , $ extends ) ; $ this -> items = ( array ) array_shift ( $ data ) ; foreach ( $ data as $ content ) { $ this -> extend ( $ conte... | Load blueprint . |
45,023 | public function fields ( ) { $ fields = $ this -> get ( 'form/fields' ) ; if ( $ fields === null ) { $ field = $ this -> get ( 'form/field' ) ; $ fields = $ field !== null ? [ '' => ( array ) $ field ] : $ fields ; } return ( array ) $ fields ; } | Get form fields . |
45,024 | public function extend ( $ extends , $ append = false ) { if ( $ extends instanceof self ) { $ extends = $ extends -> toArray ( ) ; } if ( $ append ) { $ a = $ this -> items ; $ b = $ extends ; } else { $ a = $ extends ; $ b = $ this -> items ; } $ this -> items = $ this -> deepMerge ( $ a , $ b ) ; return $ this ; } | Extend blueprint with another blueprint . |
45,025 | protected function deepMerge ( array $ a , array $ b ) { $ bref_stack = [ & $ a ] ; $ head_stack = [ $ b ] ; do { end ( $ bref_stack ) ; $ bref = & $ bref_stack [ key ( $ bref_stack ) ] ; $ head = array_pop ( $ head_stack ) ; unset ( $ bref_stack [ key ( $ bref_stack ) ] ) ; foreach ( $ head as $ key => $ value ) { if ... | Deep merge two arrays together . |
45,026 | protected function doLoad ( array $ files , $ extends = null ) { $ filename = array_shift ( $ files ) ; $ content = $ this -> loadFile ( $ filename ) ; $ key = '' ; if ( isset ( $ content [ 'extends@' ] ) ) { $ key = 'extends@' ; } elseif ( isset ( $ content [ '@extends' ] ) ) { $ key = '@extends' ; } elseif ( isset ( ... | Internal function that handles loading extended blueprints . |
45,027 | protected function doExtend ( $ filename , array $ parents , array $ extends , $ override = false ) { if ( \ is_string ( key ( $ extends ) ) ) { $ extends = [ $ extends ] ; } $ data = [ [ ] ] ; foreach ( $ extends as $ value ) { $ type = ! \ is_string ( $ value ) ? ( ! isset ( $ value [ 'type' ] ) ? null : $ value [ 't... | Internal function to recursively load extended blueprints . |
45,028 | protected function doReorder ( array $ items , array $ keys ) { $ reordered = array_keys ( $ items ) ; foreach ( $ keys as $ item => $ ordering ) { if ( ( string ) ( int ) $ ordering === ( string ) $ ordering ) { $ location = array_search ( $ item , $ reordered , true ) ; $ rel = array_splice ( $ reordered , $ location... | Internal function to reorder items . |
45,029 | protected function generateSearchRecord ( ) { $ searchPage = CwpSearchPage :: create ( ) ; $ searchPage -> URLSegment = 'search' ; $ searchPage -> Title = _t ( 'SilverStripe\\CMS\\Search\\SearchForm.SearchResults' , 'Search Results' ) ; $ searchPage -> ID = - 1 ; return $ searchPage ; } | Create the dummy search record for this page |
45,030 | public function init ( ) { parent :: init ( ) ; $ routes = $ this -> findAvailableRoutes ( ) ; $ route = $ this -> getRequest ( ) -> getVar ( 'endpoint' ) ? : $ this -> config ( ) -> default_route ; if ( ! $ route && ! empty ( $ routes ) ) { $ route = $ routes [ 0 ] ; } if ( ! $ route ) { throw new \ RuntimeException (... | Initialise the controller sanity check load javascript . Note that permission checks are handled by DevelopmentAdmin . |
45,031 | protected function findAvailableRoutes ( ) { $ routes = [ ] ; $ rules = Director :: config ( ) -> get ( 'rules' ) ; foreach ( $ rules as $ pattern => $ controllerInfo ) { $ routeClass = ( is_string ( $ controllerInfo ) ) ? $ controllerInfo : $ controllerInfo [ 'Controller' ] ; try { $ routeController = Injector :: inst... | Find all available graphql routes |
45,032 | public function all ( $ order_id , $ params = [ ] , array $ options = array ( ) ) { list ( $ code , $ line_items ) = $ this -> httpClient -> get ( "/orders/{$order_id}/line_items" , $ params , $ options ) ; return $ line_items ; } | Retrieve order s line items |
45,033 | public function create ( $ order_id , array $ lineItem , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ lineItem , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdLineItem ) = $ this -> httpClient -> post ( "/orders/{$order_id}/line_items" , $ attributes , $ options ) ; retur... | Create a line item |
45,034 | public function get ( $ order_id , $ id , array $ options = array ( ) ) { list ( $ code , $ line_item ) = $ this -> httpClient -> get ( "/orders/{$order_id}/line_items/{$id}" , null , $ options ) ; return $ line_item ; } | Retrieve a single line item |
45,035 | public function create ( array $ contact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ contact , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ( $ cod... | Create a contact |
45,036 | public function update ( $ id , array $ contact , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ contact , array_flip ( self :: $ keysToPersist ) ) ; if ( isset ( $ attributes [ 'custom_fields' ] ) && empty ( $ attributes [ 'custom_fields' ] ) ) unset ( $ attributes [ 'custom_fields' ] ) ; list ... | Update a contact |
45,037 | public function getState ( ) { return [ 'items' => $ this -> items , 'rules' => $ this -> rules , 'nested' => $ this -> nested , 'dynamic' => $ this -> dynamic , 'filter' => $ this -> filter ] ; } | Convert object into an array . |
45,038 | public function embed ( $ name , array $ value , $ separator = '.' , $ merge = false ) { if ( isset ( $ value [ 'rules' ] ) ) { $ this -> rules = array_merge ( $ this -> rules , $ value [ 'rules' ] ) ; } $ name = $ separator !== '.' ? str_replace ( $ separator , '.' , $ name ) : $ name ; if ( isset ( $ value [ 'form' ]... | Embed an array to the blueprint . |
45,039 | public function getPropertyName ( $ path = null , $ separator = '.' ) { $ parts = explode ( $ separator , $ path ) ; $ nested = $ this -> nested ; $ result = [ ] ; while ( ( $ part = array_shift ( $ parts ) ) !== null ) { if ( ! isset ( $ nested [ $ part ] ) ) { if ( isset ( $ nested [ '*' ] ) ) { $ part = '*' ; } else... | Returns name of the property with given path . |
45,040 | protected function getNested ( $ path = null , $ separator = '.' ) { if ( ! $ path ) { return $ this -> nested ; } $ parts = explode ( $ separator , $ path ) ; $ item = array_pop ( $ parts ) ; $ nested = $ this -> nested ; foreach ( $ parts as $ part ) { if ( ! isset ( $ nested [ $ part ] ) ) { $ part = '*' ; if ( ! is... | Get property from the definition . |
45,041 | protected function parseFormFields ( array $ fields , array $ params , $ prefix = '' , $ parent = '' , $ merge = false , array $ formPath = [ ] ) { if ( isset ( $ fields [ 'type' ] ) && ! \ is_array ( $ fields [ 'type' ] ) ) { return ; } foreach ( $ fields as $ key => $ field ) { $ this -> parseFormField ( $ key , $ fi... | Gets all field definitions from the blueprints . |
45,042 | protected function addProperty ( $ path ) { $ parts = explode ( '.' , $ path ) ; $ item = array_pop ( $ parts ) ; $ nested = & $ this -> nested ; foreach ( $ parts as $ part ) { if ( ! isset ( $ nested [ $ part ] ) || ! \ is_array ( $ nested [ $ part ] ) ) { $ nested [ $ part ] = [ ] ; } $ nested = & $ nested [ $ part ... | Add property to the definition . |
45,043 | protected function validateField ( $ fieldName , $ value ) { if ( ! $ this -> validateValue ( $ value ) ) { $ this -> validationError ( $ fieldName , _t ( __CLASS__ . '.InvalidValue' , 'Synonyms cannot contain words separated by spaces' ) ) ; } } | Validate field values raising errors if the values are invalid . |
45,044 | protected function validateValue ( $ value ) { $ lines = array_filter ( explode ( "\n" , $ value ) ) ; $ lines = array_filter ( $ lines , function ( $ line ) { $ line = trim ( $ line ) ; return ! empty ( $ line ) && $ line [ 0 ] !== '#' ; } ) ; foreach ( $ lines as $ line ) { if ( ! $ this -> validateLine ( $ line ) ) ... | Check field values to see that they doesn t contain spaces between words . |
45,045 | protected function validateLine ( $ line ) { $ line = trim ( $ line ) ; $ parts = explode ( ',' , $ line ) ; $ parts = array_filter ( $ parts ) ; foreach ( $ parts as $ part ) { if ( ! $ this -> validatePart ( $ part ) ) { return false ; } } return true ; } | Check each line to see that it doesn t contain spaces between words . |
45,046 | protected function validatePart ( $ part ) { if ( strpos ( $ part , '=>' ) !== false ) { $ subs = explode ( '=>' , $ part ) ; $ subs = array_filter ( $ subs ) ; foreach ( $ subs as $ sub ) { if ( ! $ this -> validateNoSpaces ( $ sub ) ) { return false ; } } return true ; } return $ this -> validateNoSpaces ( $ part ) ;... | Check each part of the line doesn t contain spaces between words . |
45,047 | private static function parseQuotedScalar ( $ scalar , & $ i ) { if ( ! Parser :: preg_match ( '/' . self :: REGEX_QUOTED_STRING . '/Au' , substr ( $ scalar , $ i ) , $ match ) ) { throw new ParseException ( sprintf ( 'Malformed inline YAML string: %s.' , substr ( $ scalar , $ i ) ) ) ; } $ output = substr ( $ match [ ... | Parses a YAML quoted scalar . |
45,048 | public function create ( array $ note , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ note , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ createdNote ) = $ this -> httpClient -> post ( "/notes" , $ attributes , $ options ) ; return $ createdNote ; } | Create a note |
45,049 | public function update ( $ id , array $ note , array $ options = array ( ) ) { $ attributes = array_intersect_key ( $ note , array_flip ( self :: $ keysToPersist ) ) ; list ( $ code , $ updatedNote ) = $ this -> httpClient -> put ( "/notes/{$id}" , $ attributes , $ options ) ; return $ updatedNote ; } | Update a note |
45,050 | public function isValid ( ) { if ( ! is_string ( $ this -> accessToken ) ) { $ msg = 'Provided access token is invalid as it is not a string' ; throw new Errors \ ConfigurationError ( $ msg ) ; } if ( preg_match ( '/\s/' , $ this -> accessToken ) ) { $ msg = 'Provided access token is invalid ' . 'as it contains disallo... | Checks if provided configuration is valid . |
45,051 | public static function configure ( ) { if ( ! class_exists ( Solr :: class ) ) { return ; } $ options = static :: config ( ) -> get ( 'options' ) ; switch ( $ options [ 'version' ] ) { case 'cwp-4' : $ solrOptions = self :: options_for_cwp ( $ options ) ; break ; case 'local-4' : $ solrOptions = self :: options_for_loc... | Configure Solr . |
45,052 | public function addPath ( $ scheme , $ prefix , $ paths , $ override = false , $ force = false ) { $ list = [ ] ; foreach ( ( array ) $ paths as $ path ) { if ( \ is_array ( $ path ) ) { if ( \ count ( $ path ) !== 2 || ! \ is_string ( $ path [ 0 ] ) || ! \ is_string ( $ path [ 1 ] ) ) { throw new \ BadMethodCallExcept... | Add new paths to the scheme . |
45,053 | public function getPaths ( $ scheme = null ) { return ! $ scheme ? $ this -> schemes : ( isset ( $ this -> schemes [ $ scheme ] ) ? $ this -> schemes [ $ scheme ] : [ ] ) ; } | Return all scheme lookup paths . |
45,054 | public function isStream ( $ uri ) { try { list ( $ scheme , ) = $ this -> normalize ( $ uri , true , true ) ; } catch ( \ Exception $ e ) { return false ; } return $ this -> schemeExists ( $ scheme ) ; } | Returns true if uri is resolvable by using locator . |
45,055 | public function findResource ( $ uri , $ absolute = true , $ first = false ) { if ( ! \ is_string ( $ uri ) ) { throw new \ BadMethodCallException ( 'Invalid parameter $uri.' ) ; } return $ this -> findCached ( $ uri , false , $ absolute , $ first ) ; } | Find highest priority instance from a resource . |
45,056 | public function findResources ( $ uri , $ absolute = true , $ all = false ) { if ( ! \ is_string ( $ uri ) ) { throw new \ BadMethodCallException ( 'Invalid parameter $uri.' ) ; } return $ this -> findCached ( $ uri , true , $ absolute , $ all ) ; } | Find all instances from a resource . |
45,057 | public function mergeResources ( array $ uris , $ absolute = true , $ all = false ) { $ uris = array_unique ( $ uris ) ; $ lists = [ [ ] ] ; foreach ( $ uris as $ uri ) { $ lists [ ] = $ this -> findResources ( $ uri , $ absolute , $ all ) ; } return call_user_func_array ( 'array_merge' , $ lists ) ; } | Find all instances from a list of resources . |
45,058 | public function fillCache ( $ uri ) { $ cacheKey = $ uri . '@cache' ; if ( ! isset ( $ this -> cache [ $ cacheKey ] ) ) { $ this -> cache [ $ cacheKey ] = true ; $ iterator = new \ RecursiveIteratorIterator ( $ this -> getRecursiveIterator ( $ uri ) , \ RecursiveIteratorIterator :: SELF_FIRST ) ; foreach ( $ iterator a... | Pre - fill cache by a stream . |
45,059 | public function clearCache ( $ uri = null ) { if ( $ uri ) { $ this -> clearCached ( $ uri , true , true , true ) ; $ this -> clearCached ( $ uri , true , true , false ) ; $ this -> clearCached ( $ uri , true , false , true ) ; $ this -> clearCached ( $ uri , true , false , false ) ; $ this -> clearCached ( $ uri , fal... | Reset locator cache . |
45,060 | public function moveUpAction ( $ id ) { $ repo = $ this -> getDoctrine ( ) -> getManager ( ) -> getRepository ( $ this -> admin -> getClass ( ) ) ; $ result = $ repo -> find ( $ id ) ; $ repo -> moveUp ( $ result ) ; if ( $ referer = $ this -> getRequest ( ) -> headers -> get ( 'referer' ) ) { return $ this -> redirect... | Move the item up . Used for Tree admins |
45,061 | protected function bindAndRender ( $ action ) { $ templateKey = 'edit' ; if ( $ action == 'edit' ) { $ id = $ this -> getRequest ( ) -> get ( $ this -> admin -> getIdParameter ( ) ) ; $ object = $ this -> admin -> getObject ( $ id ) ; if ( ! $ object ) { throw new NotFoundHttpException ( sprintf ( 'unable to find the o... | Binds the request to the form and only renders the resulting form . |
45,062 | public function createQuery ( $ context = 'list' ) { if ( $ context === 'list' ) { $ em = $ this -> getModelManager ( ) -> getEntityManager ( $ this -> getClass ( ) ) ; $ cmd = $ em -> getMetadataFactory ( ) -> getMetadataFor ( $ this -> getClass ( ) ) ; $ queryBuilder = $ em -> createQueryBuilder ( ) ; $ queryBuilder ... | Override the default query builder to utilize correct sorting |
45,063 | public function filterWithChildren ( $ qb , $ alias , $ field , $ value ) { if ( ! ( $ value [ 'value' ] && is_numeric ( $ value [ 'value' ] ) ) ) { return null ; } $ parentQb = clone $ qb ; $ parentQb -> where ( $ parentQb -> expr ( ) -> eq ( sprintf ( '%s.id' , $ alias ) , ':id' ) ) ; $ parentQb -> setParameter ( 'id... | Get item plus children |
45,064 | protected function mapAttributesToRoles ( $ class , $ attributes ) { $ mappedAttributes = array ( ) ; foreach ( $ this -> pool -> getAdminClasses ( ) as $ adminClass => $ adminCodes ) { if ( $ class === $ adminClass || $ class instanceof $ adminClass ) { foreach ( $ adminCodes as $ adminCode ) { $ admin = $ this -> poo... | Maps regular attributes such as VIEW EDIT etc to their respective SONATA role name such as ROLE_FOO_BAR_BAZ_EDIT |
45,065 | public function adminUrl ( $ subject , $ action , $ parameters = array ( ) ) { if ( is_object ( $ subject ) ) { $ className = get_class ( $ subject ) ; } elseif ( is_string ( $ subject ) ) { $ className = $ subject ; if ( strpos ( $ className , ':' ) !== false ) { list ( $ namespace , $ entity ) = explode ( ':' , $ cla... | Render an url to a sonata admin |
45,066 | public function onKernelResponse ( KernelEvent $ event ) { if ( $ event -> getRequestType ( ) === HttpKernelInterface :: MASTER_REQUEST && $ this -> wasTxStarted && $ this -> doctrine -> getConnection ( ) -> getTransactionIsolation ( ) > 0 ) { if ( $ this -> doctrine -> getConnection ( ) -> isRollbackOnly ( ) ) { $ thi... | Commits the transaction if started |
45,067 | public function quicklistAction ( Request $ request ) { $ quicklist = $ this -> get ( 'zicht_admin.quicklist' ) ; if ( $ request -> get ( 'repo' ) && $ request -> get ( 'pattern' ) ) { if ( $ request -> get ( 'language' ) ) { $ language = $ request -> get ( 'language' ) ; } else { $ language = null ; } return new JsonR... | Displays a quick list control for jumping to entries registered in the quick list service |
45,068 | public function onEvent ( Event $ anyEvent , $ eventName , EventDispatcherInterface $ dispatcher ) { if ( isset ( $ this -> propagations [ $ eventName ] ) ) { foreach ( $ this -> propagations [ $ eventName ] as $ builder ) { $ builder -> buildAndForwardEvent ( $ anyEvent ) ; } } } | Builds and forwards the event for all progragations registered for the specified event type . |
45,069 | public function getRepositoryConfigs ( $ exposedOnly = true ) { if ( $ exposedOnly ) { return array_filter ( $ this -> repos , function ( $ item ) { return isset ( $ item [ 'exposed' ] ) && $ item [ 'exposed' ] === true ; } ) ; } return $ this -> repos ; } | Returns all configurations |
45,070 | private function getFirstAdminPerClass ( $ class ) { $ code = null ; $ admins = $ this -> adminPool -> getAdminClasses ( ) ; foreach ( $ admins as $ key => $ value ) { if ( $ key === $ class ) { $ code = current ( $ value ) ; break ; } } return $ code === null ? $ this -> adminPool -> getAdminByClass ( $ class ) : $ th... | Gets the first admin when there are multiple definitions . |
45,071 | public function getResults ( $ repository , $ pattern , $ language = null , $ max = 15 ) { $ queryResults = $ this -> findRecords ( $ repository , $ pattern , $ language ) ; $ results = array ( ) ; foreach ( $ queryResults as $ record ) { $ admin = $ this -> getFirstAdminPerClass ( get_class ( $ record ) ) ; if ( ! $ a... | Get the result suggestions for the passed pattern |
45,072 | public function getOne ( $ repository , $ id ) { $ repoConfig = $ this -> repos [ $ repository ] ; return $ this -> doctrine -> getRepository ( $ repoConfig [ 'repository' ] ) -> find ( $ id ) ; } | Return a single record by it s id . Used to map the front - end variable back to an object from the repository . |
45,073 | public function createResultRecord ( $ record , $ admin ) { $ resultRecord = array ( 'label' => ( string ) $ record , 'value' => ( string ) $ record , 'url' => ( $ admin ? $ admin -> generateObjectUrl ( 'edit' , $ record ) : null ) , 'id' => ( $ admin ? $ admin -> id ( $ record ) : null ) ) ; return $ resultRecord ; } | Creates result record |
45,074 | public function addMenuItem ( MenuEvent $ e ) { $ array = $ e -> getMenuConfig ( ) ; $ this -> menu -> addChild ( $ this -> factory -> createItem ( $ array [ 'name' ] , $ array ) ) ; } | Add a child to the menu |
45,075 | public static function reorderTabs ( FormMapper $ formMapper , array $ tabOrder ) { $ tabsOriginal = $ formMapper -> getAdmin ( ) -> getFormTabs ( ) ; $ tabOrder = array_filter ( $ tabOrder , function ( $ key ) use ( $ tabsOriginal ) { return array_key_exists ( $ key , $ tabsOriginal ) ; } ) ; $ tabs = array_merge ( ar... | Allows to reorder Tabs |
45,076 | public function map ( FormMapper $ formMapper , $ helpPrefix = null ) { $ this -> formMapper = $ formMapper ; $ this -> helpPrefix = $ helpPrefix ; return $ this ; } | Start a mapping of fields on the given formMapper |
45,077 | public function add ( $ name , $ type = null , array $ options = array ( ) , array $ fieldDescriptionOptions = array ( ) ) { if ( null === $ this -> formMapper ) { throw new LogicException ( 'No FormMapper to add fields to, please make sure you start with AdminUtil->map' ) ; } $ this -> formMapper -> add ( $ name , $ t... | Add a field to the given formMapper |
45,078 | public function listItem ( $ type , $ dir = '.' , $ recursive = false , $ ignore = array ( ) ) { if ( $ type != 'dir' && $ type != 'file' ) { throw new \ InvalidArgumentException ( '$type must "file" or "dir"' ) ; } $ fileList = $ this -> nList ( $ dir ) ; $ fileInfo = array ( ) ; foreach ( $ fileList as $ file ) { $ f... | List of file or directory |
45,079 | public function wget ( $ httpFile , $ remote ) { if ( ! ini_get ( 'allow_url_fopen' ) ) { throw new \ RuntimeException ( 'allow_url_fopen must enabled' ) ; } if ( ! $ fileData = file_get_contents ( $ httpFile ) ) { throw new \ RuntimeException ( 'Can nat get file content' ) ; } $ parseFile = $ this -> parseLastDirector... | Upload file to ssh server from http address |
45,080 | public function fromMixed ( $ mixed , DOMElement $ domElement = null ) { $ domElement = is_null ( $ domElement ) ? $ this : $ domElement ; if ( is_array ( $ mixed ) ) { foreach ( $ mixed as $ index => $ mixedElement ) { if ( is_int ( $ index ) ) { if ( $ index == 0 ) { $ node = $ domElement ; } else { $ node = $ this -... | CONSTRUCTS ELEMENTS AND TEXTS FROM AN ARRAY OR STRING . THE ARRAY CAN CONTAIN AN ELEMENT S NAME IN THE INDEX PART AND AN ELEMENT S TEXT IN THE VALUE PART . |
45,081 | public static function build ( ServerInterface $ server ) { if ( $ server instanceof SftpServer ) { return new SftpDirectory ( $ server ) ; } elseif ( $ server instanceof FtpServer || $ server instanceof SslServer ) { return new FtpDirectory ( $ server ) ; } else { throw new \ InvalidArgumentException ( 'The argument i... | Build method for Directory classes |
45,082 | public static function build ( ServerInterface $ server ) { if ( $ server instanceof SftpServer ) { return new SftpFile ( $ server ) ; } elseif ( $ server instanceof FtpServer || $ server instanceof SslServer ) { return new FtpFile ( $ server ) ; } else { throw new \ InvalidArgumentException ( 'The argument is must ins... | Build method for File classes |
45,083 | public static function createFromJsonObject ( string $ value ) { $ json = \ json_decode ( $ value , true ) ; if ( ! \ is_array ( $ json ) ) { throw new \ InvalidArgumentException ( 'Invalid key or key set.' ) ; } return self :: createFromValues ( $ json ) ; } | Creates a key from a Json string . |
45,084 | public static function createFromValues ( array $ values ) { if ( \ array_key_exists ( 'keys' , $ values ) && \ is_array ( $ values [ 'keys' ] ) ) { return JWKSet :: createFromKeyData ( $ values ) ; } return JWK :: create ( $ values ) ; } | Creates a key or key set from the given input . |
45,085 | public static function createFromSecret ( string $ secret , array $ additional_values = [ ] ) : JWK { $ values = \ array_merge ( $ additional_values , [ 'kty' => 'oct' , 'k' => Base64Url :: encode ( $ secret ) , ] ) ; return JWK :: create ( $ values ) ; } | This method create a JWK object using a shared secret . |
45,086 | public static function createFromKeyFile ( string $ file , ? string $ password = null , array $ additional_values = [ ] ) : JWK { $ values = KeyConverter :: loadFromKeyFile ( $ file , $ password ) ; $ values = \ array_merge ( $ values , $ additional_values ) ; return JWK :: create ( $ values ) ; } | This method will try to load and convert a key file into a JWK object . If the key is encrypted the password must be set . |
45,087 | public static function createFromKey ( string $ key , ? string $ password = null , array $ additional_values = [ ] ) : JWK { $ values = KeyConverter :: loadFromKey ( $ key , $ password ) ; $ values = \ array_merge ( $ values , $ additional_values ) ; return JWK :: create ( $ values ) ; } | This method will try to load and convert a key into a JWK object . If the key is encrypted the password must be set . |
45,088 | public static function createFromX5C ( array $ x5c , array $ additional_values = [ ] ) : JWK { $ values = KeyConverter :: loadFromX5C ( $ x5c ) ; $ values = \ array_merge ( $ values , $ additional_values ) ; return JWK :: create ( $ values ) ; } | This method will try to load and convert a X . 509 certificate chain into a public key . |
45,089 | public static function formatByte ( $ byte ) { if ( $ byte == 0 ) { return '0 B' ; } $ s = array ( 'B' , 'Kb' , 'Mb' , 'Gb' , 'Tb' , 'Pb' ) ; $ e = floor ( log ( $ byte ) / log ( 1024 ) ) ; return sprintf ( '%.2f ' . $ s [ $ e ] , ( $ byte / pow ( 1024 , floor ( $ e ) ) ) ) ; } | Format file size to human readable |
45,090 | public function execute ( $ command , callable $ next ) { try { $ result = $ next ( $ command ) ; } catch ( \ Exception $ exception ) { $ this -> eventRecorder -> eraseEvents ( ) ; throw $ exception ; } $ recordedEvents = $ this -> eventRecorder -> releaseEvents ( ) ; foreach ( $ recordedEvents as $ event ) { $ this ->... | Dispatches all the recorded events in the EventBus and erases them |
45,091 | private function ignoreItem ( $ type , $ name , $ ignore ) { if ( $ type == 'file' && in_array ( pathinfo ( $ name , PATHINFO_EXTENSION ) , $ ignore ) ) { return true ; } elseif ( $ type == 'dir' && in_array ( $ name , $ ignore ) ) { return true ; } return false ; } | Ignore item to itemList |
45,092 | public function fetchUniqueIconsList ( ) { $ md5s = [ ] ; foreach ( $ this -> getIconsList ( ) as $ path => $ name ) { $ hash = md5_file ( $ path ) ; if ( in_array ( $ hash , $ md5s , true ) ) { continue ; } $ md5s [ $ path ] = $ hash ; $ list [ $ path ] = $ name ; } return $ list ; } | Fetches list of unique icons . |
45,093 | public function fetchIconsList ( ) { $ dir = Yii :: getAlias ( '@hiqdev/paymenticons/assets/png/xs' ) ; $ files = scandir ( $ dir ) ; $ list = [ ] ; foreach ( $ files as $ file ) { if ( $ file [ 0 ] === '.' ) { continue ; } $ name = pathinfo ( $ file ) [ 'filename' ] ; $ list [ "$dir/$file" ] = $ name ; } return $ list... | Scans directory to prepare list of icons . |
45,094 | public function genCss ( ) { $ sizes = [ 'xs' => 'height: 38px; width: 60px;' , 'sm' => 'height: 75px; width: 120px;' , 'md' => 'height: 240px; width: 150px;' , 'lg' => 'height: 480px; width: 300px;' , ] ; $ res = '.pi { display: inline-block;height: 38px;width: 60px; }' . PHP_EOL ; foreach ( array_keys ( $ sizes ) as ... | Generates CSS file . |
45,095 | public function wget ( $ httpFile , $ remote , $ mode = FTP_BINARY ) { if ( ! ini_get ( 'allow_url_fopen' ) ) { throw new \ RuntimeException ( 'allow_url_fopen must enabled' ) ; } if ( ! $ handle = fopen ( $ httpFile ) ) { throw new \ RuntimeException ( 'File can not opened' ) ; } if ( ! ftp_fput ( $ this -> session , ... | Upload file to ftp server from http address |
45,096 | protected function listItem ( $ type , $ dir = '/.' , $ recursive = false , $ ignore = array ( ) ) { if ( $ type == 'dir' ) { $ bool = true ; } elseif ( $ type == 'file' ) { $ bool = false ; } else { throw new \ InvalidArgumentException ( '$type must "file" or "dir"' ) ; } $ parseDir = $ this -> parseLastDirectory ( $ ... | List of file |
45,097 | public function get_baselayers ( DataContainer $ dc ) { $ id = 0 ; if ( $ dc -> activeRecord -> c4g_map_id != 0 ) { $ id = $ dc -> activeRecord -> c4g_map_id ; } else { $ id = $ this -> firstMapId ; } $ profile = $ this -> Database -> prepare ( "SELECT b.baselayers " . "FROM tl_c4g_maps a, tl_c4g_map_profiles b " . "WH... | Return all base layers for current Map Profile as array |
45,098 | public function get_maps ( DataContainer $ dc ) { $ maps = $ this -> Database -> prepare ( "SELECT * FROM tl_c4g_maps WHERE is_map=1 AND published=1" ) -> execute ( ) ; if ( $ maps -> numRows > 0 ) { while ( $ maps -> next ( ) ) { if ( ! isset ( $ this -> firstMapId ) ) { $ this -> firstMapId = $ maps -> id ; } $ retur... | Return all defined maps |
45,099 | public function getAllLocStyles ( DataContainer $ dc ) { $ locStyles = $ this -> Database -> prepare ( "SELECT id,name FROM tl_c4g_map_locstyles ORDER BY name" ) -> execute ( ) ; while ( $ locStyles -> next ( ) ) { $ return [ $ locStyles -> id ] = $ locStyles -> name ; } return $ return ; } | Return all Location Styles as array |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.