idx int64 0 241k | question stringlengths 64 6.21k | target stringlengths 5 803 |
|---|---|---|
227,900 | function ReadTranslations ( ) { $ lang = PhpTranslator :: Singleton ( ) -> GetLanguage ( ) ; \ RequireOnceIfExists ( PathUtil :: BundleTranslationsFile ( $ this , $ lang ) ) ; \ RequireOnceIfExists ( PathUtil :: ModuleTranslationsFile ( $ this , $ lang ) ) ; } | Reads the translation files |
227,901 | static function MyBundle ( ) { $ className = \ get_class ( new static ( ) ) ; $ endPos = strpos ( $ className , '\\Modules\\' ) ; $ bundleNS = Str :: Start ( $ className , $ endPos ) ; $ startPos = strrpos ( $ bundleNS , '\\' ) ; return Str :: Part ( $ bundleNS , $ startPos + 1 ) ; } | The bundle name |
227,902 | final function Render ( ) { $ this -> output = '' ; $ this -> ReadTranslations ( ) ; if ( $ this -> BeforeInit ( ) ) { return $ this -> output ; } if ( $ this -> Init ( ) ) { return $ this -> output ; } if ( $ this -> BeforeGather ( ) ) { return $ this -> output ; } $ this -> GatherOutput ( ) ; $ this -> AfterGather ( ... | Gets the desired output |
227,903 | private function constructInternalRegularExpression ( $ path , $ routePattern ) { if ( empty ( $ routePattern ) ) return false ; $ fullRoute = $ path ; if ( substr ( $ fullRoute , - 1 ) == '/' ) { $ fullRoute = substr ( $ fullRoute , 0 , - 1 ) ; } $ fullRoute .= $ routePattern ; $ patternSegments = $ this -> urlSegment... | Construct the internal pattern to test the urls against |
227,904 | public static function merge ( RecordInterface $ left , RecordInterface $ right ) { return Record :: fromArray ( array_merge ( $ left -> getProperties ( ) , $ right -> getProperties ( ) ) , $ right -> getDisplayName ( ) ) ; } | Merges data from two records into a new record . The right record overwrites values from the left record |
227,905 | public function addSdkOption ( $ key , $ value ) { if ( $ key === 'version' && $ value !== self :: REQUIRED_DYNAMODB_API_VERSION ) { throw ODMException :: dynamodbApiInvalidVersion ( self :: REQUIRED_DYNAMODB_API_VERSION ) ; } $ this -> sdkOptions [ $ key ] = $ value ; } | Set an AWS SDK configuration option . |
227,906 | public function getPersistentCollectionGenerator ( ) { if ( ! isset ( $ this -> odmOptions [ 'persistentCollectionGenerator' ] ) ) { $ this -> odmOptions [ 'persistentCollectionGenerator' ] = new DefaultPersistentCollectionGenerator ( $ this -> getPersistentCollectionDir ( ) , $ this -> getPersistentCollectionNamespace... | Get the persistent collection generator . |
227,907 | public function insertSystemVersion ( $ details = null , $ backtrace = null ) { if ( is_null ( $ this -> cfVersion ) ) return false ; $ db = $ this -> getConnection ( ) ; $ version = $ db -> insertRecord ( 'sysversion' , array ( 'CFVersion' => $ this -> cfVersion , 'CreationDate' => $ this -> DateFactory -> newStorageD... | Increments the current system version |
227,908 | public function getMetaValue ( $ metaKey ) { $ metas = $ this -> getMeta ( ) ; foreach ( $ metas as $ meta ) { if ( $ meta -> getMetaKey ( ) == $ metaKey ) { return ( $ meta -> getMetaValue ( ) ) ; } } return '' ; } | Get meta value of a given meta key |
227,909 | public function getAvailableMenu ( ) { $ availableMenus = array ( ) ; $ menus = $ this -> getMenu ( ) ; if ( ! $ menus ) { return ( NULL ) ; } foreach ( $ menus as $ menu ) { $ availableMenus [ ] = $ menu -> getLabel ( ) ; } return ( $ availableMenus ) ; } | Get available menu |
227,910 | private function getURL ( $ array , $ key ) { $ countArray = $ this -> array_depth ( $ array ) - 1 ; switch ( $ countArray ) { case 1 : $ url = $ array [ 'geen' ] [ 'url' ] ; $ id = $ array [ 'geen' ] [ 'id' ] ; $ class = $ array [ 'geen' ] [ 'class' ] ; $ attrib = $ array [ 'geen' ] [ 'attrib' ] ; return [ $ url , $ i... | Private function to get the URL linked with the menu item |
227,911 | public function createMenu ( $ idNav = '' , $ classNav = '' , $ attributesNav = '' , $ idList = '' , $ classList = '' , $ attributesList = '' ) { $ this -> openNav ( $ idNav , $ classNav , $ attributesNav ) ; $ this -> createList ( '' , $ idList , $ classList , $ attributesList ) ; $ this -> closeNav ( ) ; return $ thi... | To return the created menu |
227,912 | public function addMenu ( $ url , $ id , $ class , $ attributes , $ menu1 , $ menu2 = 'geen' , $ menu3 = 'geen' , $ menu4 = 'geen' , $ menu5 = 'geen' , $ menu6 = 'geen' ) { $ this -> dataMenu [ $ menu1 ] [ $ menu2 ] [ $ menu3 ] [ $ menu4 ] [ $ menu5 ] [ $ menu6 ] [ 'url' ] = $ url ; $ this -> dataMenu [ $ menu1 ] [ $ m... | Adding a menu item |
227,913 | public function array_depth ( $ array ) { $ max_depth = 1 ; foreach ( $ array as $ value ) { if ( is_array ( $ value ) ) { $ depth = $ this -> array_depth ( $ value ) + 1 ; if ( $ depth > $ max_depth ) { $ max_depth = $ depth ; } } } return $ max_depth ; } | This returns the depth of an array |
227,914 | public function injectSubject ( \ PHPCraft \ Subject \ Subject $ subject ) { $ this -> subjects [ $ subject -> name ] = $ subject ; } | Injects another subject |
227,915 | protected function getUsedTraits ( ) { $ reflection = new \ ReflectionClass ( $ this ) ; $ properties = $ reflection -> getProperties ( ) ; $ traits = [ ] ; foreach ( $ properties as $ property ) { $ name = $ property -> getName ( ) ; if ( substr ( $ name , 0 , 3 ) == 'has' ) { $ traits [ ] = substr ( $ name , 3 ) ; } ... | Gets traits used by class |
227,916 | protected function checkTraitsDependencies ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'setTraitDependencies' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; $ this -> check... | Loads traits dependencies from other traits |
227,917 | protected function checkTraitDependencies ( $ traitName ) { if ( isset ( $ this -> traitsDependencies [ $ traitName ] ) ) { $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ this -> traitsDependencies [ $ traitName ] as $ requiredTrait ) { $ propertyName = 'has' . $ requiredTrait ; if ( ! $ reflection -> ha... | Checks whether traits required by another trait are used |
227,918 | protected function processConfiguration ( $ configuration ) { if ( isset ( $ configuration [ 'subjects' ] [ $ this -> name ] [ 'locale' ] ) && $ configuration [ 'subjects' ] [ $ this -> name ] [ 'locale' ] ) { $ this -> loadApplicationTranslations ( $ this -> name , $ configuration [ 'subjects' ] [ $ this -> name ] [ '... | Processes configuration checks for mandatory parameters extracts found parameters |
227,919 | protected function buildPathToArea ( $ language = false ) { $ path = [ ] ; if ( $ language ) { $ path [ ] = $ language ; } elseif ( isset ( $ this -> route [ 'parameters' ] [ 'language' ] ) ) { $ path [ ] = $ this -> route [ 'parameters' ] [ 'language' ] ; } if ( isset ( $ this -> route [ 'parameters' ] [ 'area' ] ) ) ... | builds path to area from route |
227,920 | protected function buildPathToSubject ( $ language = false ) { $ path = $ this -> buildPathToArea ( $ language ) ; foreach ( ( array ) $ this -> ancestors as $ ancestor => $ primaryKeyValues ) { $ path [ ] = $ ancestor ; $ path [ ] = implode ( '|' , array_values ( $ primaryKeyValues ) ) ; } if ( isset ( $ this -> route... | builds path to subject from route |
227,921 | protected function buildPathToAncestor ( $ lastAncestor ) { $ path = $ this -> buildPathToArea ( ) ; foreach ( ( array ) $ this -> ancestors as $ ancestor => $ primaryKeyValues ) { $ path [ ] = $ ancestor ; if ( $ ancestor != $ lastAncestor ) { $ path [ ] = implode ( '|' , array_values ( $ primaryKeyValues ) ) ; } else... | builds path to an ancestor |
227,922 | protected function checkTraitsInjections ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'setTraitInjections' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; $ this -> checkTrai... | Checks that injections needed by traits have been performed |
227,923 | protected function checkTraitInjections ( $ traitName ) { if ( isset ( $ this -> traitsInjections [ $ traitName ] ) ) { $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ this -> traitsInjections [ $ traitName ] as $ propertyName ) { if ( ! $ reflection -> hasProperty ( $ propertyName ) || ! $ this -> $ prop... | Checks whether required objects for a trais have been injected |
227,924 | protected function traitsInit ( ) { $ traits = $ this -> getUsedTraits ( ) ; $ reflection = new \ ReflectionClass ( $ this ) ; foreach ( $ traits as $ trait ) { $ methodName = 'initTrait' . $ trait ; if ( $ reflection -> hasMethod ( $ methodName ) ) { $ this -> $ methodName ( ) ; } } } | Performs initialization tasks needed by traits calling the optional initTraitTrait - name method |
227,925 | public function loadTranslations ( $ key , $ pathToIniFile ) { $ path = $ pathToIniFile ; if ( ! is_file ( $ path ) ) { throw new \ InvalidArgumentException ( sprintf ( "Translation file not found into path %s" , $ path ) ) ; } else { $ this -> translations [ $ key ] = parse_ini_file ( $ path , true ) ; } } | adds a translations ini file content to subject translations |
227,926 | public function execAction ( ) { if ( ! $ this -> action ) { throw new \ Exception ( sprintf ( 'no action defined for subject %s' , $ this -> name ) ) ; } try { $ this -> checkTraitsInjections ( ) ; $ this -> traitsInit ( ) ; $ this -> { 'exec' . $ this -> sanitizeAction ( $ this -> action ) } ( ) ; } catch ( Exception... | tries to exec current action |
227,927 | public static function replace ( array $ words , $ replacement , $ text ) { $ replace = ( mb_strlen ( $ replacement ) > 1 ) ? $ replacement : static :: transformReplacement ( $ words , $ replacement ) ; return str_replace ( $ words , $ replace , $ text ) ; } | Replace the text with replacement according to the given words . |
227,928 | protected static function transformReplacement ( array $ words , $ replace ) { return array_map ( function ( $ value ) use ( $ replace ) { return str_repeat ( $ replace , mb_strlen ( $ value ) ) ; } , $ words ) ; } | Get words replacement . |
227,929 | protected function initNavigation ( ) { Yii :: $ app -> params [ 'nav' ] [ 'wavecms_form' ] = [ 'label' => FontAwesome :: icon ( 'paper-plane' ) . Yii :: t ( 'wavecms_form/main' , 'Forms' ) , 'url' => 'javascript: ;' , 'options' => [ 'class' => 'drop-down' ] , 'permission' => 'wavecms-form' , 'position' => 5000 , 'item... | Init left navigation |
227,930 | public static function generate ( ) { $ oDb = Factory :: service ( 'PDODatabase' ) ; $ oSettingsService = Factory :: service ( 'AppSetting' ) ; $ oModel = Factory :: model ( 'Blog' , 'nails/module-blog' ) ; $ aRoutes = [ ] ; $ oRows = $ oDb -> query ( 'SELECT id FROM ' . $ oModel -> getTableName ( ) ) ; if ( ! $ oRows ... | Returns an array of routes for this module |
227,931 | public function defaultAction ( ) { $ em = $ this -> getEntityManager ( ) ; $ pagerParams = [ 'itemsCountPerPage' => static :: ITEMS_ON_PAGE , 'sort' => Application :: getRequest ( ) -> getSort ( ) , ] ; $ repository = $ em -> getRepository ( $ this -> entityName ) ; $ grid = new \ Cmf \ Component \ Grid ( [ 'fields' =... | Default CRUD action . Show list of items . |
227,932 | public function creationOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addMessage ( $ lng [ self :: MSG_CREATION_OK ] ) ; return $ this -> forward ( 'default' ) ; } | Creation of a new item is successfully |
227,933 | public function editionOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addSuccessMessage ( $ lng [ self :: MSG_EDITION_OK ] ) ; return $ this -> forward ( 'default' ) ; } | Edition of a item is successfully |
227,934 | public function deletingOkAction ( ) { $ lng = \ Cmf \ Language \ Factory :: get ( $ this ) ; HelperFactory :: getMessageBox ( ) -> addMessage ( $ lng [ self :: MSG_DELETING_OK ] ) ; return $ this -> forward ( 'default' ) ; } | Deleting of a item is successfully |
227,935 | public function addInput ( $ fieldset , $ type , $ id = '' , $ class = '' , $ attributes = '' , $ name = '' , $ value = '' , $ placeholder = '' , $ labelText = '' , $ labelId = '' , $ labelClass = '' , $ labelAttributes = '' , $ div = FALSE , $ divId = '' , $ divClass = '' , $ divAttributes = '' ) { $ this -> formData ... | With this function you add Input elements to the form |
227,936 | public function addFieldset ( $ name , $ legend , $ fieldsetId = '' , $ fieldsetClass = '' , $ fieldsetAttributes = '' , $ legendId = '' , $ legendClass = '' , $ legendAttributes = '' ) { $ this -> fieldsetData [ $ this -> nrFieldset ] [ 'name' ] = $ name ; $ this -> fieldsetData [ $ this -> nrFieldset ] [ 'legend' ] =... | With this function you add a fieldset to your form |
227,937 | public function createForm ( $ name , $ action = '' , $ method = 'post' , $ id = '' , $ class = '' , $ attributes = '' ) { $ formOutput = '' ; foreach ( $ this -> fieldsetData as $ fieldData ) { $ formOutput .= $ this -> fieldset ( 'open' , $ fieldData [ 'fieldsetId' ] , $ fieldData [ 'fieldsetClass' ] , $ fieldData [ ... | Use this function to create the form from the configured input and fieldset data |
227,938 | private function fixInputAttributes ( & $ field ) { if ( is_array ( $ field [ 'attributes' ] ) ) { $ field [ 'attributes' ] [ 'placeholder' ] = $ field [ 'placeholder' ] ; } else { $ field [ 'attributes' ] .= sprintf ( ' placeholder="%s"' , $ field [ 'placeholder' ] ) ; $ field [ 'attributes' ] = trim ( $ field [ 'attr... | Adds the placeholder to the attributes with string or array detection of attributes |
227,939 | public static function dump ( $ data , int $ deep = 10 ) { if ( -- $ deep < 0 ) return '...' ; else if ( ! Collection :: is ( $ data ) ) return $ data ; else { $ _data = Collection :: copy ( $ data , false ) ; if ( is_object ( $ data ) && ! ( $ data instanceof \ StdClass ) ) try { if ( \ method_exists ( $ data , '__deb... | Preprocess the data before log it |
227,940 | public function nestedWhere ( string $ column , \ Closure $ nested , string $ lOpr = "IN" ) : self { $ this -> qBuilder -> nestedWhere ( $ column , $ nested , $ lOpr , "AND" ) ; return $ this ; } | Where Nested Select |
227,941 | public function join ( string $ table , string $ type = "INNER JOIN" ) : self { $ this -> qBuilder -> join ( $ table , $ type ) ; return $ this ; } | Add table to join |
227,942 | public function joinCond ( string $ primKey , string $ forKey , string $ cOpr = "=" ) : self { $ this -> qBuilder -> joinCond ( $ primKey , $ forKey , $ cOpr , "AND" ) ; return $ this ; } | Add join condition |
227,943 | protected function setSoftDelete ( ) { $ softDelete = $ this -> config [ "database.softDelete" ] ; $ this -> softDelete = $ softDelete [ "enabled" ] ?? false ; $ this -> delCol = $ softDelete [ "column" ] ?? "" ; $ this -> delValType = $ softDelete [ "value" ] ?? 0 ; } | Set soft deletion |
227,944 | protected function setTimestampConfig ( ) { $ timestamp = $ this -> config [ "database.timestamp" ] ; $ this -> timestamps = $ this -> timestamps === null ? ( $ timestamp [ "enabled" ] ?? false ) : $ this -> timestamps ; $ this -> createdColumn = $ this -> createdColumn ? : ( $ timestamp [ "createdColumn" ] ?? "created... | Set Timestamp Config |
227,945 | private static function generateHash ( $ value , string $ namespace = '' ) : string { if ( \ is_object ( $ value ) ) { $ value = spl_object_hash ( $ value ) ; } elseif ( \ is_array ( $ value ) ) { array_walk_recursive ( $ value , function ( & $ v ) { if ( \ is_object ( $ v ) ) { $ v = spl_object_hash ( $ v ) ; } } ) ; ... | Generates a SHA - 256 hash for the given value . |
227,946 | private static function flatten ( array $ array , & $ output ) : void { if ( null === $ output ) { $ output = [ ] ; } foreach ( $ array as $ key => $ value ) { if ( \ is_array ( $ value ) ) { self :: flatten ( $ value , $ output ) ; continue ; } $ output [ $ key ] = $ value ; } } | Flattens an array into the given output variable . |
227,947 | public function findPagesOfMenu ( $ menuName , $ lang = NULL ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT p FROM FulgurioLightCMSBundle:Page p JOIN p.menu m WHERE m.label=:menuName ORDER BY m.position' ) ; $ query -> setParameter ( 'menuName' , $ menuName ) ; $ results = $ query -> getResult ( ... | Get page from a given menu name |
227,948 | public function upMenuPagesPosition ( $ menuName , $ position , $ positionLimit = NULL ) { if ( is_null ( $ positionLimit ) ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'UPDATE FulgurioLightCMSBundle:PageMenu m SET m.position=m.position-1 WHERE m.position>=:position AND m.label=:menuName' ) ; } else { ... | Up pages menu position |
227,949 | public function getLastMenuPosition ( $ menuName ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'SELECT MAX(m.position) FROM FulgurioLightCMSBundle:PageMenu m WHERE m.label=:menuName' ) ; $ query -> setParameter ( 'menuName' , $ menuName ) ; return $ query -> getSingleScalarResult ( ) ; } | Get last position in menu |
227,950 | public function getBaseUri ( ) { $ script = $ this -> get ( 'script' ) ; $ base = str_replace ( '\\' , '/' , dirname ( $ script ) ) ; if ( $ base != '/' ) { $ url = strtolower ( $ this -> get ( 'scheme' ) ) . $ this -> get ( 'name' ) . $ base ; } else { $ url = strtolower ( $ this -> get ( 'scheme' ) ) . $ this -> get ... | Get current base Uri |
227,951 | public function getCurrentUri ( $ absolute = true ) { if ( $ absolute ) { return $ this -> get ( 'scheme' ) . $ this -> get ( 'name' ) . $ this -> get ( 'uri' ) ; } else { return $ this -> get ( 'uri' ) ; } } | Get current uri . |
227,952 | public function init ( ) { $ this -> data [ 'host' ] = ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ? $ _SERVER [ 'HTTP_HOST' ] : '' ) ; $ this -> data [ 'script' ] = ( isset ( $ _SERVER [ 'SCRIPT_NAME' ] ) ? $ _SERVER [ 'SCRIPT_NAME' ] : '' ) ; $ this -> data [ 'uri' ] = ( isset ( $ _SERVER [ 'REQUEST_URI' ] ) ? $ _SERVER [ ... | Initialize Request data . |
227,953 | public function redirect ( $ url , $ status = 301 ) { $ status = ( int ) $ status ; if ( ! empty ( $ url ) ) { header ( $ this -> get ( 'protocol' ) . ' 301 Redirect' ) ; header ( 'Status: ' . $ status . ' Redirect' ) ; header ( 'Location: ' . $ url ) ; exit ( 0 ) ; } else { throw new \ Exception ( 'Url is empty !' ) ;... | Redirect on specified url . |
227,954 | public static function walkDir ( string $ path , callable $ callback ) : void { $ realPath = realpath ( $ path ) ; if ( ! is_string ( $ realPath ) || ! is_dir ( $ realPath ) ) { throw new InvalidArgumentException ( sprintf ( "Passed path \"%s\" (%s) isn't a directory" , $ path , var_export ( $ realPath , true ) ) ) ; }... | Walks directory recursively . |
227,955 | public static function removeDir ( string $ path ) : void { self :: walkDir ( $ path , function ( SplFileInfo $ file ) : void { $ path = $ file -> getRealPath ( ) ; $ file -> isDir ( ) ? rmdir ( $ path ) : unlink ( $ path ) ; } ) ; rmdir ( $ path ) ; } | Removes directory recursively . |
227,956 | public static function handle ( $ number = 0 , $ message = '' , $ file = '' , $ line = 0 , array $ context = [ ] ) { self :: $ context = $ context ; self :: $ message = $ message ; self :: $ number = $ number ; self :: $ trace = debug_backtrace ( ) ; self :: $ file = $ file ; self :: $ line = $ line ; $ level = ob_get_... | Fatal error handle |
227,957 | public function load ( $ configFile = null ) { $ this -> configData = json_decode ( file_get_contents ( $ this -> templateFile ) ) ; if ( $ configFile == null ) { $ configFile = $ this -> configFile ; } if ( file_exists ( $ configFile ) ) { $ configData = json_decode ( file_get_contents ( $ configFile ) ) ; if ( ! $ co... | Load or reload the configuration from the specified configuration file and template |
227,958 | public function save ( $ configFile = null , $ jsonOptions = 0 , $ saveUnset = false ) { if ( $ configFile == null ) { $ configFile = $ this -> configFile ; } $ data = new \ StdClass ; foreach ( $ this -> configData as $ name => $ itemData ) { if ( isset ( $ itemData -> value ) ) { ValueByPath :: setValueByPath ( $ dat... | Save the configuration to the specified configuration file |
227,959 | public function hasDefaultValue ( $ name ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } return isset ( $ this -> configData -> { $ name } -> defaultValue ) ; } | Check whether the given configuration value has a default value . |
227,960 | public function getValue ( $ name ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } $ itemData = $ this -> configData -> { $ name } ; if ( isset ( $ itemData -> value ) ) { return $ itemData -> value ; } if ( isset ( $ itemData -> defaultValue ) ) { return $ itemData -> d... | Get the value of the given configuration path . |
227,961 | public function setValue ( $ name , $ value ) { if ( ! $ this -> hasValue ( $ name ) ) { throw new UnknownConfigValueException ( $ name ) ; } $ itemData = $ this -> configData -> { $ name } ; if ( $ value === $ itemData -> defaultValue ) { unset ( $ itemData -> value ) ; } else { $ itemData -> value = $ value ; } } | Set the value of the given property path . |
227,962 | public function get ( $ name ) { return isset ( $ this -> collection [ $ name ] ) ? $ this -> collection [ $ name ] : null ; } | Retrieve the property definition by name . |
227,963 | public function import ( $ list ) { if ( ! is_array ( $ list ) && ! ( $ list instanceof Iterator ) ) { throw new InvalidArgumentException ( "Expected a list of properties and types" ) ; } foreach ( $ list as $ name => $ type ) { $ this -> add ( $ name , $ type ) ; } return $ this ; } | Add a list of properties and types |
227,964 | public function add ( $ name , $ type ) { $ property = clone self :: $ propertyPrototype ; $ this -> collection [ $ name ] = $ property -> setName ( $ name ) -> setRawType ( $ type ) ; return $ this ; } | Add a single property and type |
227,965 | public function export ( ) { $ result = array ( ) ; foreach ( $ this -> collection as $ name => $ property ) { $ result [ $ name ] = $ property -> getRawType ( ) ; } return $ result ; } | Export a list of properties and types |
227,966 | public function setUp ( array $ params ) { if ( ! isset ( $ params [ 'endpoint' ] ) ) { throw new \ RuntimeException ( 'Parameter "endpoint" missing.' ) ; } if ( ! isset ( $ params [ 'api_access_key' ] ) ) { throw new \ RuntimeException ( 'Parameter "api_access_key" missing.' ) ; } $ this -> params = $ params ; } | Set up the parameters . |
227,967 | public function listAction ( ) { $ entities = $ this -> container -> get ( "haven_web.faq.read_handler" ) -> getAll ( ) ; foreach ( $ entities as $ entity ) { $ delete_forms [ $ entity -> getId ( ) ] = $ this -> container -> get ( "haven_web.faq.form_handler" ) -> createDeleteForm ( $ entity -> getId ( ) ) -> createVie... | Finds and displays all faqs for admin . |
227,968 | public function get ( array $ handler , array $ settings ) { $ report = null ; $ this -> hook -> attach ( 'module.ga_report.get.before' , $ handler , $ settings , $ report , $ this ) ; if ( isset ( $ report ) ) { return $ report ; } if ( empty ( $ settings [ 'ga_profile_id' ] [ $ settings [ 'store_id' ] ] ) ) { throw n... | Returns an array of parsed reporting data |
227,969 | public function clearCache ( $ handler_id = null , $ store_id = null ) { $ pattern = 'ga_report.' ; if ( isset ( $ handler_id ) ) { $ pattern .= "$handler_id." ; } if ( isset ( $ store_id ) ) { $ pattern .= "$store_id" ; } $ this -> cache -> clear ( '' , array ( 'pattern' => "$pattern*" ) ) ; } | Clear cached report data |
227,970 | public function request ( array $ settings , array $ handler ) { if ( empty ( $ settings [ 'ga_profile_id' ] ) ) { throw new OutOfRangeException ( 'Google Analytics profile ID is empty in the request settings' ) ; } $ service = $ this -> getService ( $ settings ) ; $ request = new \ Google_Service_AnalyticsReporting_Re... | Returns an object of Google Analytics service response |
227,971 | protected function setRequestDate ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'date' ] ) && count ( $ handler [ 'query' ] [ 'date' ] ) == 2 ) { list ( $ from , $ to ) = $ handler [ 'query' ] [ 'date' ] ; $ date = new \ Google_Service_AnalyticsReporting_DateRange ; $ date -> setStartDate ( $... | Sets request date range |
227,972 | protected function setRequestMetrics ( $ request , array $ handler ) { if ( empty ( $ handler [ 'query' ] [ 'metrics' ] ) ) { throw new OutOfRangeException ( 'No query metrics data found in the handler' ) ; } $ metrics = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'metrics' ] as $ i => $ name ) { $ metric =... | Sets request metrics from a handler |
227,973 | protected function setRequestSorting ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'sort' ] ) ) { $ orders = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'sort' ] as $ field => $ params ) { $ params += array ( 'VALUE' , 'ASCENDING' ) ; list ( $ type , $ direction ) = array_map ( 's... | Sets request sorting from a handler |
227,974 | protected function setRequestDimensions ( $ request , array $ handler ) { if ( ! empty ( $ handler [ 'query' ] [ 'dimensions' ] ) ) { $ dimensions = array ( ) ; foreach ( ( array ) $ handler [ 'query' ] [ 'dimensions' ] as $ name ) { $ dimension = new \ Google_Service_AnalyticsReporting_Dimension ; $ dimension -> setNa... | Sets request dimensions from a handler |
227,975 | public function getResults ( $ response ) { $ results = array ( 'rows' => array ( ) ) ; for ( $ report_index = 0 ; $ report_index < count ( $ response ) ; $ report_index ++ ) { $ report = $ response [ $ report_index ] ; $ header = $ report -> getColumnHeader ( ) ; $ dimension_headers = $ header -> getDimensions ( ) ; $... | Returns an array of results from the response object |
227,976 | protected function getClient ( array $ settings ) { if ( empty ( $ settings [ 'credential_id' ] ) ) { throw new OutOfRangeException ( 'Credential ID is empty in Google client settings' ) ; } $ client = $ this -> getApiModule ( ) -> getGoogleClient ( $ settings [ 'credential_id' ] ) ; $ client -> setApplicationName ( 'A... | Returns Google Client class instance |
227,977 | public function deleteNodeData ( $ nodeId ) { $ query = $ this -> getEntityManager ( ) -> createQuery ( 'DELETE FROM YdleHubBundle:NodeData d WHERE d.node = :node' ) -> setParameter ( 'node' , $ nodeId ) ; return $ query -> execute ( ) ; } | Delete all data for a specific node |
227,978 | protected function OnSuccess ( ) { $ action = $ this -> group -> Exists ( ) ? Action :: Update ( ) : Action :: Create ( ) ; $ this -> group -> SetName ( $ this -> Value ( 'Name' ) ) ; $ this -> group -> SetCreateContainers ( ( bool ) $ this -> Value ( 'CreateContainers' ) ) ; $ this -> group -> SetCreateLayouts ( ( boo... | Saves the group and redirects to the list |
227,979 | public function addControl ( Control ... $ controls ) : ControlCollection { foreach ( $ controls as $ control ) { $ control -> setForm ( $ this ) ; $ this -> controls [ $ control -> getName ( ) ] = $ control ; } return $ this ; } | Add controls to form . |
227,980 | public function isSequence ( & $ name = null ) { if ( preg_match ( "/^nextval\\('([^']+)'::regclass\\)$/" , $ this -> data [ 'default' ] , $ matches ) ) { $ name = $ matches [ 1 ] ; return true ; } $ name = null ; return false ; } | Does this datatype link to a sequence |
227,981 | public function isNormalityEntity ( & $ entity = null ) { if ( $ this -> getEntity ( ) === 'normality' ) { $ entity = $ this -> data [ 'normality' ] ; return true ; } $ entity = null ; return false ; } | Does this dataType reference a normality entity? |
227,982 | public function isEntity ( & $ entity = null ) { if ( isset ( $ this -> data [ 'entity' ] ) ) { $ entity = $ this -> data [ 'entity' ] ; return true ; } $ entity = null ; return false ; } | Does this DataType reference a Entity? |
227,983 | public function isEnum ( & $ enumName = null ) { if ( isset ( $ this -> data [ 'enumName' ] ) ) { $ enumName = $ this -> data [ 'enumName' ] ; return true ; } $ enumName = null ; return false ; } | Does this dataType reference a enum? |
227,984 | public function hasDefault ( & $ default = null ) { if ( empty ( $ this -> data [ 'default' ] ) ) { $ default = null ; return false ; } $ default = $ this -> data [ 'default' ] ; return true ; } | Does this dataType have a default value . If so what is it . |
227,985 | public function serialize ( ) { $ output = array ( ) ; foreach ( $ this -> data as $ key => $ value ) { if ( ! array_key_exists ( $ key , static :: $ defaults ) or static :: $ defaults [ $ key ] !== $ value ) { $ output [ $ key ] = $ value ; } } return json_encode ( array ( $ this -> name , $ this -> entity , $ this ->... | Serialize a dataType |
227,986 | public static function unserialize ( $ data ) { $ data = json_decode ( $ data , true ) ; return new static ( $ data [ 0 ] , $ data [ 1 ] , $ data [ 2 ] , $ data [ 3 ] ) ; } | Unserialize a dataType |
227,987 | public static function makeFromAttribute ( PgAttribute $ attribute ) { $ name = $ attribute -> name ; $ entity = $ attribute -> getRelation ( ) -> getEntityName ( ) ; $ type = $ attribute -> getType ( ) ; $ fullyQualifiedName = $ attribute -> getFullyQualifiedName ( ) ; $ data = array ( 'isPrimaryKey' => $ attribute ->... | Generate a dataType from a Bond \ Pg \ Catalog \ PgAttribute |
227,988 | public static function makeFromRelation ( PgClass $ relation ) { $ output = array ( ) ; foreach ( $ relation -> getAttributes ( ) as $ attribute ) { $ dataType = static :: makeFromAttribute ( $ attribute ) ; $ output [ $ dataType -> name ] = $ dataType ; } return $ output ; } | Generate a array of DataTypes from a Bond \ Pg \ Catalog \ PgClass object |
227,989 | public function toQueryTag ( $ cast = false ) { return sprintf ( '%%%s:%s%s%%' , $ this -> name , isset ( $ this -> data [ 'enumName' ] ) ? 'text' : $ this -> data [ 'type' ] , $ this -> data [ 'isNullable' ] ? '|null' : '' , $ cast ? 'cast' : '' ) ; } | Return a query tag for use in dynamic sql . |
227,990 | public function getQueryModifier ( QuoteInterface $ quoting , $ cast = true ) { $ modifier = new Modifier ( $ quoting , $ this -> data [ 'type' ] , false ) ; if ( $ this -> data [ 'isNullable' ] ) { $ modifier -> add ( 'pre' , '\Bond\nullify' ) ; } if ( $ cast ) { if ( strtolower ( $ this -> data [ 'type' ] ) !== $ thi... | Get a modifier customised to work on this datatype |
227,991 | public function resolve ( $ template ) { foreach ( $ this as $ resolver ) { $ resource = $ resolver -> resolve ( $ template ) ; if ( ! is_null ( $ resource ) ) { return $ resource ; } } return null ; } | Returns result from first resolver that matches |
227,992 | public function forceFill ( array $ attributes ) { $ model = $ this ; return static :: unguarded ( function ( ) use ( $ model , $ attributes ) { return $ model -> fill ( $ attributes ) ; } ) ; } | Fill the model with an array of attributes . Force mass assignment . |
227,993 | public static function all ( $ columns = [ '*' ] ) { $ columns = is_array ( $ columns ) ? $ columns : func_get_args ( ) ; $ instance = new static ; return $ instance -> newQuery ( ) -> get ( $ columns ) ; } | Get all of the models from the database . |
227,994 | public function run ( $ action , Request $ request , Response $ response ) { $ this -> init ( ) ; if ( ! $ this -> initCalled ) { throw new IllegalStateException ( "Controller::init() must be called" ) ; } $ this -> response = $ response ; $ this -> headers = $ response -> getHeaders ( ) ; return $ this -> { $ action .... | Runs the controller . |
227,995 | protected static function createMenuLevel ( $ array , $ level , $ elements = [ ] , $ currentItems = [ ] , $ activeClass = 'active' , $ startLevel = 0 , $ numLevels = 2 ) { $ menu = ( $ level >= $ startLevel ? '<ul' . Link :: htmlClass ( $ elements [ 'ul_default' ] . ' ' . $ elements [ 'ul_class' ] , '' ) . Link :: html... | Creates a menu level |
227,996 | protected static function wrapChildren ( $ item , $ children ) { if ( ( is_string ( $ item [ 'child_wrap' ] ) || is_array ( $ item [ 'child_wrap' ] ) ) && ! empty ( $ item [ 'child_wrap' ] ) ) { return ( is_array ( $ item [ 'child_wrap' ] ) ? '<' . $ item [ 'child_wrap' ] [ 0 ] . ' class="' . $ item [ 'child_wrap' ] [ ... | Wrap any child elements in a given element |
227,997 | public static function build ( $ array , $ elements = [ ] , $ currentItems = [ ] , $ activeClass = 'active' , $ startLevel = 0 , $ numLevels = 2 , $ caret = false , $ linkDDExtras = false ) { if ( is_array ( $ elements ) && ! empty ( $ elements ) ) { Link :: $ linkDefaults = $ elements ; } if ( $ caret !== false && is_... | Build the navigation menu item |
227,998 | public function buildTag ( $ tag , $ counter , $ permalink ) { $ tagObject = new $ this -> tagEntity ( ) ; $ tagObject -> setTag ( $ tag ) ; $ tagObject -> setCounter ( $ counter ) ; $ tagObject -> setPage ( $ permalink ) ; return $ tagObject ; } | Build a Tag entity |
227,999 | private function setProviders ( $ providers ) { foreach ( $ providers as $ key => $ value ) { $ this -> provides [ ] = $ value ; $ this -> app -> appProviders [ ] = [ $ key => $ value ] ; } } | Set the appProviders in the main application object and set the provides array for registering the sevice providers |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.