idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
5,500 | public static function split ( string $ string , string $ delimiter = ',' ) : array { return preg_split ( '/\s*' . preg_quote ( $ delimiter , '/' ) . '\s*/' , $ string , - 1 , PREG_SPLIT_NO_EMPTY ) ; } | Splits a string into chunks on a given delimiter . |
5,501 | public static function padBoth ( $ str , $ length , $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padBoth ( $ length , $ padStr ) ; } | Returns a new string of a given length such that both sides of the string are padded . |
5,502 | public static function padLeft ( string $ str , int $ length , string $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padLeft ( $ length , $ padStr ) ; } | Returns a new string of a given length such that the beginning of the string is padded . |
5,503 | public static function padRight ( string $ str , int $ length , string $ padStr = ' ' ) : string { return ( string ) BaseStringy :: create ( $ str ) -> padRight ( $ length , $ padStr ) ; } | Returns a new string of a given length such that the end of the string is padded . |
5,504 | public static function asciiCharMap ( ) : array { if ( self :: $ _asciiCharMap !== null ) { return self :: $ _asciiCharMap ; } self :: $ _asciiCharMap = ( new Stringy ( '' ) ) -> getAsciiCharMap ( ) ; return self :: $ _asciiCharMap ; } | Returns ASCII character mappings merging in any custom defined mappings from the customAsciiCharMappings config setting . |
5,505 | public static function convertToUtf8 ( string $ string ) : string { if ( static :: isUtf8 ( $ string ) ) { return HtmlPurifier :: cleanUtf8 ( $ string ) ; } $ config = \ HTMLPurifier_Config :: createDefault ( ) ; $ config -> set ( 'Core.Encoding' , static :: encoding ( $ string ) ) ; $ string = HtmlPurifier :: cleanUtf... | Attempts to convert a string to UTF - 8 and clean any non - valid UTF - 8 characters . |
5,506 | public static function encodeMb4 ( string $ string ) : string { if ( max ( array_map ( 'ord' , str_split ( $ string ) ) ) >= 240 ) { $ string = preg_replace_callback ( '/./u' , function ( array $ match ) { if ( strlen ( $ match [ 0 ] ) >= 4 ) { $ unpacked = unpack ( 'H*' , mb_convert_encoding ( $ match [ 0 ] , 'UTF-32'... | HTML - encodes any 4 - byte UTF - 8 characters . |
5,507 | public function add_page ( $ config ) { foreach ( $ this -> required_params ( ) as $ param ) { if ( ! isset ( $ config [ $ param ] ) ) { throw new \ RuntimeException ( 'Missing required parameter "' . $ param . '" for submenu' ) ; } } $ this -> config [ 'submenu-pages' ] [ ] = $ config ; } | Add a page to this menu . |
5,508 | private function set_config ( $ config ) { if ( ! isset ( $ config [ 'title' ] ) ) { throw new \ RuntimeException ( 'Missing required parameter "title" for menu' ) ; } if ( ! isset ( $ config [ 'slug' ] ) || '' == $ config [ 'slug' ] ) { $ config [ 'slug' ] = \ Amarkal \ Common \ Tools :: strtoslug ( $ config [ 'title'... | Set the configuration for this menu page . |
5,509 | public function add_menu_page ( ) { extract ( $ this -> config ) ; $ icon .= '' != $ class ? '" class="' . $ class : '' ; $ icon .= array ( ) != $ style ? '" style="' . $ this -> array_to_css ( $ style ) : '' ; $ page = $ this -> config [ 'submenu-pages' ] [ 0 ] ; \ add_menu_page ( $ title , $ title , $ page [ 'capabil... | Add this page and all it s submenus to the admin sidebar . |
5,510 | private function array_to_css ( array $ rules ) { $ css = '' ; foreach ( $ rules as $ rule => $ value ) { $ css .= $ rule . ':' . $ value . ';' ; } return $ css ; } | Array to CSS . |
5,511 | public static function available_map_fields ( $ class ) { if ( ! in_array ( $ class , self :: config ( ) -> allowed_classes ) || ! \ ClassInfo :: exists ( $ class ) ) return false ; $ available = \ Config :: inst ( ) -> get ( $ class , 'public_fields' ) ? \ Config :: inst ( ) -> get ( $ class , 'public_fields' ) : arra... | Return an array of fields that can be mapped to a class name Looks for public_fields set via config otherwise defaults to summary_fields |
5,512 | private static function init ( ) { ob_start ( ) ; set_time_limit ( 0 ) ; ini_set ( 'memory_limit' , '256M' ) ; ini_set ( 'upload_max_filesize' , '128M' ) ; ini_set ( 'post_max_size' , '256M' ) ; ini_set ( 'max_input_time' , '7200' ) ; ini_set ( 'max_execution_time' , '0' ) ; ini_set ( 'expect.timeout' , '7200' ) ; ini_... | function will attempt to alocate more resources to run the sync |
5,513 | public static function getLogData ( $ syncid , $ type = 'all' , $ limitstart = null , $ limit = null , $ sort = 'id' , $ dir = 'ASC' ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> select ( '*' ) -> from ( '#__jfusion_sync_details' ) -> where ( 'syncid = ' . $ db -> quote ( $ syncid ) ) ; if (... | Retrieve log data |
5,514 | public static function saveData ( Registry $ syncdata ) { $ db = Factory :: getDBO ( ) ; $ data = new stdClass ; $ data -> syncdata = $ syncdata -> toString ( ) ; $ data -> syncid = $ syncdata -> get ( 'syncid' ) ; $ data -> time_start = time ( ) ; $ data -> action = $ syncdata -> get ( 'action' ) ; $ db -> insertObjec... | Save sync data |
5,515 | public static function markResolved ( $ id ) { $ db = Factory :: getDBO ( ) ; $ query = $ db -> getQuery ( true ) -> update ( '#__jfusion_sync_details' ) -> set ( 'action = ' . $ db -> quote ( 'resolved' ) ) -> where ( 'id = ' . $ db -> quote ( $ id ) ) ; $ db -> setQuery ( $ query ) ; $ db -> execute ( ) ; } | Marks an error in sync details as resolved to prevent it from constantly showing up in the resolve error view |
5,516 | protected static function getFieldDefinition ( Schema $ schema , Type $ parentType , Field $ fieldAST ) { $ name = $ fieldAST -> get ( 'name' ) -> get ( 'value' ) ; $ schemaMeta = Introspection :: schemaMetaFieldDefinition ( ) ; if ( $ name === $ schemaMeta -> getName ( ) && $ schema -> getQueryType ( ) === $ parentTyp... | Not exactly the same as the executor s definition of getFieldDef in this statically evaluated environment we do not always have an Object type and need to handle Interface and Union types . |
5,517 | protected function factorySyncService ( $ serviceName ) { $ syncClass = '\\ufocoder\\SyncSocial\\components\\services\\' . ucfirst ( $ serviceName ) ; if ( ! class_exists ( $ syncClass ) ) { throw new Exception ( Yii :: t ( 'SyncSocial' , 'SyncSocial Extension not support "{serviceName}" service' , [ 'serviceName' => $... | Create service synchronizer wrapper class |
5,518 | public function syncActiveRecord ( $ serviceName = null , ActiveRecord $ model ) { $ service = $ this -> getService ( $ serviceName ) ; if ( $ service -> isConnected ( ) && ! $ this -> isExistsSyncModelByActiveRecord ( $ service , $ model ) ) { $ message = $ model -> { $ this -> modelAttribute } ; $ function = $ this -... | Post message with URL to Social Network |
5,519 | public function dispatch ( Event $ event ) { foreach ( $ this -> getSubscribers ( $ event ) as $ subscriber ) { $ subscriber -> trigger ( $ event ) ; } return $ this ; } | Dispatched ein Event |
5,520 | public static function create ( $ name = null , $ conf = null ) { if ( is_null ( $ name ) ) { $ name = static :: $ _default ; } if ( ! is_null ( $ conf ) && is_array ( $ conf ) ) { return static :: $ _instances [ $ name ] = new static ( $ name , $ conf ) ; } if ( ! isset ( static :: $ _instances [ $ name ] ) ) { static... | Get an auth instance or create one |
5,521 | public function kill_restore ( ) { CCCookie :: delete ( $ this -> config -> get ( 'restore.id_cookie' ) ) ; CCCookie :: delete ( $ this -> config -> get ( 'restore.token_cookie' ) ) ; } | Kill the restore keys |
5,522 | public function restore_key ( $ user ) { return \ CCStr :: hash ( $ user -> password . '@' . $ user -> { $ this -> config -> user_key } . '%' . \ CCIn :: client ( ) -> agent ) ; } | generate the current restore key |
5,523 | public function login ( ) { return $ this -> select_logins ( ) -> where ( 'restore_id' , $ this -> user -> { $ this -> config -> user_key } ) -> where ( 'restore_token' , $ this -> restore_key ( $ this -> user ) ) -> limit ( 1 ) -> run ( ) ; } | Get the current login of the user |
5,524 | public function validate ( $ identifier , $ password ) { $ user = null ; $ user_model = $ this -> config -> user_model ; foreach ( $ this -> config -> identifiers as $ property ) { if ( $ user = $ user_model :: find ( $ property , $ identifier ) ) { break ; } } if ( ! $ user ) { return false ; } if ( empty ( $ user -> ... | Validate an identifier with the password In other words is the login correct? |
5,525 | public function sign_in ( \ Auth \ User $ user , $ keep_login = true ) { $ this -> session -> set ( $ this -> config -> session_key , $ user -> { $ this -> config -> user_key } ) ; $ this -> user = $ user ; $ this -> user -> last_login = time ( ) ; $ this -> user = \ CCEvent :: pass ( 'auth.sign_in' , $ this -> user ) ... | Sign the user and optinal also set the resore keys |
5,526 | public function sign_out ( ) { if ( ! $ this -> authenticated ) { return false ; } \ DB :: delete ( $ this -> config -> get ( 'logins.table' ) ) -> where ( 'restore_token' , $ this -> restore_key ( $ this -> user ) ) -> run ( ) ; $ this -> session -> delete ( $ this -> config -> session_key ) ; $ this -> user = \ CCEve... | Sign a user out |
5,527 | public function renderToggleButton ( ) { if ( $ this -> toggleButton !== null ) { $ tag = ArrayHelper :: removeValue ( $ this -> toggleButton , 'tag' , 'button' ) ; $ label = ArrayHelper :: removeValue ( $ this -> toggleButton , 'label' , 'Show' ) ; if ( $ tag === 'button' && ! isset ( $ this -> toggleButton [ 'type' ]... | Renders the toggle button |
5,528 | protected function renderCloseButton ( ) { if ( $ this -> closeButton !== null ) { $ tag = ArrayHelper :: removeValue ( $ this -> closeButton , 'tag' , 'a' ) ; $ label = ArrayHelper :: removeValue ( $ this -> closeButton , 'label' , '×' ) ; if ( $ tag === 'button' && ! isset ( $ this -> closeButton [ 'type' ] ) )... | Renders the close button . |
5,529 | public function init ( ) { parent :: init ( ) ; $ this -> datetimeFormat = ( empty ( Yii :: $ app -> params [ 'site' ] -> datetimeFormat ) ) ? $ this -> datetimeFormat : Yii :: $ app -> params [ 'site' ] -> datetimeFormat ; $ this -> timezone = ( empty ( Yii :: $ app -> params [ 'site' ] -> timezone ) ) ? $ this -> tim... | Set default timezone and datetime format for model |
5,530 | public function getDisplayDateTime ( $ input , $ format = null , $ timezone = null ) { return \ enpii \ enpiiCms \ helpers \ DateTimeHelper :: fromDbFormat ( $ input , ( $ format === null ? $ this -> datetimeFormat : $ format ) , ( $ timezone === null ? $ this -> timezone : $ timezone ) ) ; } | Display datetime from the result retrieve from database ( stored by GMT datetime |
5,531 | public function getCreatedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> created_at , $ format , $ timezone ) ; } | Display create_at datetime |
5,532 | public function getUpdatedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> updated_at , $ format , $ timezone ) ; } | Display updated_at datetime |
5,533 | public function getPublishedAt ( $ format = null , $ timezone = null ) { return $ this -> getDisplayDateTime ( $ this -> published_at , $ format , $ timezone ) ; } | Display published_at datetime |
5,534 | public function getUploadTmpPath ( ) { $ path = Yii :: getAlias ( '@root' . '/' . Yii :: $ app -> params [ 'uploads' ] [ 'folderName' ] . '/' . 'tmp' ) ; if ( ! file_exists ( $ path ) ) { FileHelper :: createDirectory ( $ path , 0777 ) ; } return $ path ; } | Temporary upload path |
5,535 | public function setTogglingControl ( Control $ control ) { $ control -> checkId ( ) ; if ( $ control instanceof Scriptable ) { $ control -> setScriptEvents ( true ) ; } $ this -> togglingControl = $ control ; return $ this ; } | Set the toggling Control |
5,536 | public function setOnlyShow ( $ onlyShow ) { $ this -> onlyShow = ( bool ) $ onlyShow ; if ( $ this -> onlyShow ) { $ this -> onlyHide = null ; } return $ this ; } | Set Show Only |
5,537 | public function setOnlyHide ( $ onlyHide ) { $ this -> onlyHide = ( bool ) $ onlyHide ; if ( $ this -> onlyHide ) { $ this -> onlyShow = null ; } return $ this ; } | Set Hide Only |
5,538 | protected function dumpRequest ( Request $ request ) { $ body = $ request -> getBody ( ) ; $ dump = "Body of request is:\n" ; if ( is_object ( $ body ) || is_array ( $ body ) ) { $ dump .= json_encode ( $ body ) ; } elseif ( is_string ( $ body ) ) { $ dump .= sprintf ( '"%s"' , $ body ) ; } return $ dump ; } | returns a importable string representation of the request |
5,539 | public function render ( array $ data , ContextInterface $ context ) { $ data += [ 'name' => '' , 'templateVars' => [ ] , 'escape' => true ] ; unset ( $ data [ 'val' ] ) ; $ title = ( Arr :: key ( 'title' , $ data ) ) ? $ data [ 'title' ] : $ data [ 'name' ] ; return $ this -> _templates -> format ( 'file' , [ 'title' ... | Render a file upload form widget . |
5,540 | public function getMatches ( ) { $ matches = ArrayHelper :: merge ( $ this -> homeMatches , $ this -> awayMatches ) ; ArrayHelper :: multisort ( $ matches , 'date' , SORT_ASC ) ; return $ matches ; } | Get all matches |
5,541 | public function showAction ( Request $ request ) { $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ rep = $ em -> getRepository ( 'AnimeDbAppBundle:Notice' ) ; $ notice = $ rep -> getFirstShow ( ) ; $ response = $ this -> getCacheTimeKeeper ( ) -> getResponse ( [ ] , - 1 , new JsonResponse ( ) ) ; $ response -> s... | Show last notice . |
5,542 | protected function setConnectedRelationOptions ( ) { $ pivotTable = $ this -> defaultOptions [ 'pivot_table' ] ; $ foreignKey = $ this -> defaultOptions [ 'foreign_key' ] ; $ relatedKey = $ this -> defaultOptions [ 'related_key' ] ; if ( ! $ this -> db -> isTableExists ( $ pivotTable ) ) { $ question = "Can't find tabl... | get connected db relation options |
5,543 | public static function make ( $ attributes = [ ] ) { $ jobset = new static ( ) ; $ model = $ jobset -> makeModel ( $ attributes ) ; $ jobset -> setModel ( $ model ) ; $ jobset -> makeJobs ( ) ; $ jobsetTryAt = $ jobset -> getJobsEarliestTryAt ( ) ; $ jobset -> model -> setTryAt ( $ jobsetTryAt ) ; $ jobset -> model -> ... | Make new jobset |
5,544 | public static function get ( $ id ) { $ jobset = new static ( ) ; $ model = $ jobset -> findModel ( $ id ) ; $ jobset -> setModel ( $ model ) ; $ jobset -> initJobs ( ) ; return $ jobset ; } | Get an existed jobset |
5,545 | public function execute ( ) { if ( $ this -> isFinished ( ) || $ this -> isFailed ( ) ) { return true ; } if ( ! $ this -> isInTime ( ) ) { return false ; } if ( $ this -> isDispatched ( ) || $ this -> isCanceled ( ) ) { return false ; } try { if ( ! $ this -> jobs ) { $ this -> initJobs ( ) ; } $ this -> doUnorderedJo... | If return true the jobset should be dispatched with considering its status Or the jobset process should be terminated |
5,546 | public function dispatched ( ) { if ( $ this -> isFinished ( ) || $ this -> isFailed ( ) ) { $ status = $ this -> isFinished ( ) ? JobsConst :: JOB_SET_STATUS_FINISHED_AND_DISPATCHED : JobsConst :: JOB_SET_STATUS_FAILED_AND_DISPATCHED ; return $ this -> model -> updateStatus ( $ status ) ; } return false ; } | After successfully notice to commander we mark the jobset as dispatched here . |
5,547 | public function getJobsetExecutionStatus ( ) { $ finished = count ( $ this -> jobs ) > 0 ? true : false ; $ failed = false ; $ middle = false ; foreach ( $ this -> jobs as $ job ) { if ( $ job -> isFailed ( ) ) { $ finished = false ; $ middle = false ; $ failed = true ; break ; } $ finished = $ finished && $ job -> isF... | Get jobset execution status from sub jobs statuses . At least one job failed the jobset is failed . All jobs finished the jobset is finished . At least one job has been executed the jobset is ongoing . All jobs have not been executed the jobset is in default status . |
5,548 | protected function doOrderedJobs ( ) { $ jobNames = $ this -> getOrderedJobNames ( ) ; foreach ( $ jobNames as $ jobName ) { $ job = $ this -> getLocalJob ( $ jobName ) ; if ( ! $ job ) { throw new \ Exception ( "job [$jobName] not exists" ) ; } $ job -> execute ( ) ; $ this -> updateLocalJob ( $ job ) ; if ( ! $ job -... | Do ordered jobs |
5,549 | protected function doUnorderedJobs ( ) { $ jobNames = $ this -> getUnorderedJobNames ( ) ; foreach ( $ jobNames as $ jobName ) { $ job = $ this -> getLocalJob ( $ jobName ) ; if ( ! $ job ) { throw new \ Exception ( "job [$jobName] not exists" ) ; } $ job -> execute ( ) ; $ this -> updateLocalJob ( $ job ) ; } } | Do unordered jobs |
5,550 | protected function getJobsEarliestTryAt ( ) { $ tryAt = date ( 'Y-m-d H:i:s' ) ; foreach ( $ this -> jobs as $ job ) { if ( ! $ job -> isFinished ( ) && Helper :: datetimeLT ( $ job -> getTryAt ( ) , $ tryAt ) ) { $ tryAt = $ job -> getTryAt ( ) ; } } return $ tryAt ; } | get the earliest job try at time except the finished jobs |
5,551 | public static function format ( string $ format , string ... $ arguments ) : string { foreach ( $ arguments as $ key => $ value ) { $ format = str_replace ( "{{$key}}" , ( string ) $ value , $ format ) ; } return $ format ; } | Replaces the format items in a specified string with the string representation of n specified objects . |
5,552 | public static function ellipsize ( string $ string , int $ maxLength , string $ suffix = '...' ) : string { if ( $ maxLength < 0 ) { throw new \ InvalidArgumentException ( '$maxLength is negative' ) ; } if ( strlen ( $ string ) <= $ maxLength ) { return $ string ; } $ trimmedLength = $ maxLength - strlen ( $ suffix ) ;... | Truncates the string to the given length with an ellipsis at the end . |
5,553 | public function enable ( $ enable = true ) { if ( ! is_bool ( $ enable ) ) { throw new InvalidArgumentException ( "enable must be a boolean. [$enable] given." ) ; } $ this -> enabled = $ enable ; return $ this ; } | Enable the option . |
5,554 | public function hasValue ( $ value ) { $ index = array_search ( $ value , $ this -> values ) ; if ( $ index === false ) { return false ; } return true ; } | Return whether this option has the given value or not . |
5,555 | public function addValue ( $ value ) { $ this -> assertCanHaveValue ( ) ; $ this -> assertValueIsValid ( $ value ) ; if ( $ this -> canHaveMultipleValues ( ) && ! $ this -> hasValue ( $ value ) ) { $ value = array_merge ( $ this -> values , ( array ) $ value ) ; } $ this -> values = ( array ) $ value ; return $ this ; ... | Add a new value to this option . |
5,556 | public function addValues ( array $ values = [ ] ) { $ this -> assertCanHaveMultipleValues ( ) ; foreach ( $ values as $ value ) { $ this -> addValue ( $ value ) ; } return $ this ; } | Add multiple values to this option . |
5,557 | public function removeValue ( $ value ) { if ( ! $ this -> canHaveMultipleValues ( ) && ! isset ( $ value ) ) { $ this -> values = [ ] ; $ this -> enable ( $ enable = false ) ; return $ this ; } $ this -> assertValueIsValid ( $ value ) ; $ this -> assertCanHaveValue ( ) ; if ( $ this -> hasValue ( $ value ) ) { $ index... | Remove the given value from the option . |
5,558 | public function removeValues ( array $ values = [ ] ) { $ this -> assertCanHaveMultipleValues ( ) ; foreach ( $ values as $ value ) { $ this -> removeValue ( $ value ) ; } return $ this ; } | Remove the given values from the option . |
5,559 | public function getArray ( ) { $ options = [ ] ; if ( $ this -> isDisabled ( ) || $ this -> canHaveValue ( ) && empty ( $ this -> values ) ) { return $ options ; } foreach ( $ this -> values as $ value ) { $ options [ ] = $ this -> flag ( ) ; $ options [ ] = $ value ; } if ( empty ( $ options ) ) { $ options [ ] = $ th... | Get the option and its values as an array . |
5,560 | private function parseFlag ( $ flag ) { $ flag = trim ( $ flag ) ; $ pattern = '/^' . '(' . '(?<flag>(?:-\w|--\w[\w-]+))' . '(?<enable>\+)?' . ')' . '(' . '(?<can_have_value>=)?' . '(?<can_have_multiple_values>\*)?' . '(?<values>' . '(?(<can_have_multiple_values>)' . '(\w+,)*\w+|' . '(?(<can_have_value>)' . '\w+' . ')'... | Parse a given flag . |
5,561 | private function setDescription ( $ description = null ) { if ( isset ( $ description ) && ! is_string ( $ description ) ) { throw new InvalidArgumentException ( "Description must be a string. [$description] given." ) ; } $ this -> description = $ description ; } | Set the description . |
5,562 | private function setValues ( $ values ) { if ( ! empty ( $ values ) ) { if ( $ this -> canHaveMultipleValues ( ) ) { $ this -> addValues ( $ values ) ; } elseif ( $ this -> canHaveValue ( ) ) { $ this -> addValue ( $ values ) ; } } return $ this ; } | Set the values for this option . |
5,563 | public function Link ( $ action = null ) { $ name = $ this -> name ; if ( ( $ pos = stripos ( $ name , '[' ) ) !== false ) { $ name = substr ( $ name , 0 , $ pos ) ; $ action = substr ( $ this -> name , $ pos + 1 , strlen ( $ this -> name ) - 1 - ( $ pos + 1 ) ) . 'Tree' ; } return Controller :: join_links ( $ this -> ... | Return a Link to this field |
5,564 | private function setWhereResultCallback ( QueryBuilder $ qb ) { if ( ! empty ( $ this -> callbacks [ 'WhereResult' ] ) ) { foreach ( $ this -> callbacks [ 'WhereResult' ] as $ callback ) { $ callback ( $ qb ) ; } } return $ this ; } | Set where result callback . |
5,565 | private function setWhereAllCallback ( QueryBuilder $ qb ) { if ( ! empty ( $ this -> callbacks [ 'WhereAll' ] ) ) { foreach ( $ this -> callbacks [ 'WhereAll' ] as $ callback ) { $ callback ( $ qb ) ; } } return $ this ; } | Set where all callback . |
5,566 | private function setSelectFrom ( ) { foreach ( $ this -> selectColumns as $ key => $ value ) { $ this -> qb -> addSelect ( $ key ) ; } $ this -> qb -> from ( $ this -> entity , $ this -> tableName ) ; return $ this ; } | Set select from . |
5,567 | private function setLeftJoins ( QueryBuilder $ qb ) { foreach ( $ this -> joins as $ key => $ value ) { $ qb -> leftJoin ( $ key , $ value ) ; } return $ this ; } | Set leftJoins . |
5,568 | private function setOrderBy ( ) { if ( isset ( $ this -> requestParams [ 'order' ] ) && count ( $ this -> requestParams [ 'order' ] ) ) { $ counter = count ( $ this -> requestParams [ 'order' ] ) ; for ( $ i = 0 ; $ i < $ counter ; ++ $ i ) { $ columnIdx = ( integer ) $ this -> requestParams [ 'order' ] [ $ i ] [ 'colu... | Ordering . Construct the ORDER BY clause for server - side processing SQL query . |
5,569 | private function setLimit ( ) { if ( isset ( $ this -> requestParams [ 'start' ] ) && - 1 != $ this -> requestParams [ 'length' ] ) { $ this -> qb -> setFirstResult ( $ this -> requestParams [ 'start' ] ) -> setMaxResults ( $ this -> requestParams [ 'length' ] ) ; } return $ this ; } | Paging . Construct the LIMIT clause for server - side processing SQL query . |
5,570 | private function getCountAllResults ( $ rootEntityIdentifier ) { $ qb = $ this -> em -> createQueryBuilder ( ) ; $ qb -> select ( 'count(distinct ' . $ this -> tableName . '.' . $ rootEntityIdentifier . ')' ) ; $ qb -> from ( $ this -> entity , $ this -> tableName ) ; $ this -> setLeftJoins ( $ qb ) ; $ this -> setWher... | Query results before filtering . |
5,571 | private function execute ( ) { $ query = $ this -> qb -> getQuery ( ) ; if ( true === $ this -> configs [ 'translation_query_hints' ] ) { if ( true === $ this -> doctrineExtensions ) { $ query -> setHint ( \ Doctrine \ ORM \ Query :: HINT_CUSTOM_OUTPUT_WALKER , 'Gedmo\\Translatable\\Query\\TreeWalker\\TranslationWalker... | Constructs a Query instance . |
5,572 | private function entityFieldToArray ( array $ data , $ entity , $ path ) { $ parts = explode ( '.' , $ path , 2 ) ; if ( count ( $ parts ) === 1 ) { if ( $ entity instanceof \ Traversable ) { $ data = [ ] ; foreach ( $ entity as $ item ) { $ id = $ this -> em -> getClassMetadata ( get_class ( $ item ) ) -> getSingleIde... | Normalizes an entity path into an array . Each entity of each level will have its id set . All values are retrieved using a property accessor with magic call activated . |
5,573 | private function setIdentifierFromAssociation ( $ association , $ key = '' , $ i = 0 , $ metadata = null ) { if ( null === $ metadata ) { $ metadata = $ this -> metadata ; } if ( is_string ( $ association ) ) { $ targetEntityClass = $ metadata -> getAssociationTargetClass ( $ association ) ; $ targetMetadata = $ this -... | Set identifier from association . |
5,574 | private function isSelectColumn ( $ data ) { if ( null !== $ data && ! in_array ( $ data , $ this -> virtualColumns ) ) { return true ; } return false ; } | Is select column . |
5,575 | private function isSearchColumn ( AbstractColumn $ column ) { if ( false === $ this -> configs [ 'search_on_non_visible_columns' ] ) { if ( null !== $ column -> getDql ( ) && true === $ column -> getSearchable ( ) && true === $ column -> getVisible ( ) ) { return true ; } } else { if ( null !== $ column -> getDql ( ) &... | Is search column . |
5,576 | private function renderImage ( $ imageName , ImageColumn $ column ) { return $ this -> twig -> render ( 'SgDatatablesBundle:Helper:ii_render_image.html.twig' , array ( 'image_id' => 'sg_image_' . uniqid ( rand ( 10000 , 99999 ) ) , 'image_name' => $ imageName , 'filter' => $ column -> getImagineFilter ( ) , 'path' => $... | Render image . |
5,577 | public function countUserRoles ( Criteria $ criteria = null , $ distinct = false , PropelPDO $ con = null ) { $ partial = $ this -> collUserRolesPartial && ! $ this -> isNew ( ) ; if ( null === $ this -> collUserRoles || null !== $ criteria || $ partial ) { if ( $ this -> isNew ( ) && null === $ this -> collUserRoles )... | Returns the number of related UserRole objects . |
5,578 | public function addUserRole ( UserRole $ l ) { if ( $ this -> collUserRoles === null ) { $ this -> initUserRoles ( ) ; $ this -> collUserRolesPartial = true ; } if ( ! in_array ( $ l , $ this -> collUserRoles -> getArrayCopy ( ) , true ) ) { $ this -> doAddUserRole ( $ l ) ; if ( $ this -> userRolesScheduledForDeletion... | Method called to associate a UserRole object to this object through the UserRole foreign key attribute . |
5,579 | public function getUserRolesJoinUser ( $ criteria = null , $ con = null , $ join_behavior = Criteria :: LEFT_JOIN ) { $ query = UserRoleQuery :: create ( null , $ criteria ) ; $ query -> joinWith ( 'User' , $ join_behavior ) ; return $ this -> getUserRoles ( $ query , $ con ) ; } | If this collection has already been initialized with an identical criteria it returns the collection . Otherwise if this Role is new it will return an empty collection ; or if this Role has previously been saved it will retrieve related UserRoles from storage . |
5,580 | public function sendRequest ( $ request , $ wait = self :: WAIT ) { $ this -> getSocket ( ) -> send ( $ request , ( $ wait ) ? 0 : \ ZMQ :: MODE_DONTWAIT ) ; return $ this ; } | Send request via ZMQ socket . |
5,581 | protected function getValue ( $ key ) { if ( ! array_key_exists ( $ key , $ this -> store ) ) { throw new KeyNotFoundException ( ) ; } $ getResult = $ this -> store [ $ key ] ; $ unserialized = @ unserialize ( $ getResult ) ; if ( Util :: hasInternalExpireTime ( $ unserialized ) ) { $ this -> handleTtl ( $ key , $ unse... | Gets value watches expiring . |
5,582 | protected function handleTtl ( $ key , $ expireSetTs , $ expireSec ) { $ ttl = $ expireSetTs + $ expireSec - time ( ) ; if ( $ ttl <= 0 ) { unset ( $ this -> store [ $ key ] ) ; throw new KeyNotFoundException ( ) ; } return $ ttl ; } | If ttl is lesser or equals 0 delete key . |
5,583 | protected function connectHandshake ( $ host , $ port = 443 , $ http_ver = '1.1' , array & $ headers = array ( ) ) { $ request = "CONNECT $host:$port HTTP/$http_ver\r\n" . "Host: " . $ this -> config [ 'proxy_host' ] . "\r\n" ; if ( isset ( $ this -> config [ 'useragent' ] ) ) { $ request .= "User-agent: " . $ this -> ... | Preform handshaking with HTTPS proxy using CONNECT method |
5,584 | public function setTranslation ( string $ locale , string $ value ) { if ( strlen ( $ value ) === 0 ) { unset ( $ this -> translations [ $ locale ] ) ; } else { $ this -> translations [ $ locale ] = mb_convert_encoding ( $ value , 'UTF-8' , 'UTF-8' ) ; } return $ this ; } | Sets a translation of the localised string . |
5,585 | public function initDoctrinePackage ( ) { $ module = $ GLOBALS [ 'env' ] [ 'container' ] -> getModule ( 'Doctrine' ) ; $ this -> dc = new DCPackage ( $ module , $ module -> getEntityManager ( $ this -> getConnectionName ( ) ) ) ; $ this -> attachEntityMetaListener ( ) ; } | Erstellt das DCPackage |
5,586 | public function hydrateEntity ( $ entityName , $ identifier ) { return $ this -> getDoctrinePackage ( ) -> getRepository ( $ this -> getDoctrinePackage ( ) -> getModule ( ) -> getEntityName ( $ entityName ) ) -> hydrate ( $ identifier ) ; } | Hydriert ein einzelnes Entity |
5,587 | public function dispatch ( ) { $ handler = current ( $ this -> handlers ) ; if ( ! $ handler ) { return ; } $ this -> resolveHandler ( $ handler ) ; return $ this ; } | Dispatch handlers . |
5,588 | function getKarma ( $ circle , $ player ) { if ( ! $ circle ) { throw new Exception ( 'Invalid circle' ) ; } if ( ! $ player ) { throw new Exception ( 'Invalid player' ) ; } return $ this -> execute ( 'GET' , '/trust/%s/karma/%s/' , array ( $ circle , $ player ) ) ; } | Get how many times a player has been blacklisted and whitelisted within a circle |
5,589 | public function createSection ( $ settings = null ) { $ sectionCount = $ this -> _countSections ( ) + 1 ; $ section = new PHPWord_Section ( $ sectionCount , $ settings ) ; $ this -> _sectionCollection [ ] = $ section ; return $ section ; } | Create a new Section |
5,590 | public function addFontStyle ( $ styleName , $ styleFont , $ styleParagraph = null ) { PHPWord_Style :: addFontStyle ( $ styleName , $ styleFont , $ styleParagraph ) ; } | Adds a font style definition to styles . xml |
5,591 | public function addTableStyle ( $ styleName , $ styleTable , $ styleFirstRow = null ) { PHPWord_Style :: addTableStyle ( $ styleName , $ styleTable , $ styleFirstRow ) ; } | Adds a table style definition to styles . xml |
5,592 | public function addTitleStyle ( $ titleCount , $ styleFont , $ styleParagraph = null ) { PHPWord_Style :: addTitleStyle ( $ titleCount , $ styleFont , $ styleParagraph ) ; } | Adds a heading style definition to styles . xml |
5,593 | public function loadTemplate ( $ strFilename ) { if ( file_exists ( $ strFilename ) ) { $ template = new PHPWord_Template ( $ strFilename ) ; return $ template ; } else { trigger_error ( 'Template file ' . $ strFilename . ' not found.' , E_ERROR ) ; } } | Load a Template File |
5,594 | public function addItem ( Control $ item , Control $ control , $ isStartElement = false ) { $ menuElement = new MenuElement ( $ item , $ control ) ; $ this -> addElement ( $ menuElement , $ isStartElement ) ; return $ this ; } | Add a Menu item |
5,595 | public function addElement ( MenuElement $ menuElement , $ isStartElement = false ) { if ( ! in_array ( $ menuElement , $ this -> elements , true ) ) { array_push ( $ this -> elements , $ menuElement ) ; if ( $ isStartElement ) { $ this -> setStartElement ( $ menuElement ) ; } else { $ menuElement -> getControl ( ) -> ... | Add a Menu Element |
5,596 | public function setStartElement ( MenuElement $ startElement = null ) { $ this -> startElement = $ startElement ; if ( $ startElement && ! in_array ( $ startElement , $ this -> elements , true ) ) { array_push ( $ this -> elements , $ startElement ) ; } return $ this ; } | Set the Element to start with |
5,597 | protected function getElementsArrayText ( ) { $ elements = array ( ) ; foreach ( $ this -> elements as $ element ) { $ elementId = $ element -> getItem ( ) -> getId ( ) ; $ elements [ $ elementId ] = $ element -> getControl ( ) -> getId ( ) ; } return Builder :: getArray ( $ elements , true ) ; } | Build the array text for the Elements |
5,598 | public function getTagNameList ( ) { $ tags = $ this -> owner -> Tags ( ) ; $ names = [ ] ; foreach ( $ tags as $ tag ) { $ names [ ] = $ tag -> Name ; } return implode ( ', ' , $ names ) ; } | Helper to get a comma separated list of all the associated tags . |
5,599 | public function getRelatedFAQs ( $ limit = null ) { $ tags = $ this -> owner -> Tags ( ) ; if ( $ tags -> count ( ) == 0 ) { return null ; } $ faqs = FAQ :: get ( ) -> innerJoin ( 'FAQ_Tags' , '"FAQ"."ID" = "FAQ_Tags"."FAQID"' ) -> where ( sprintf ( '"FAQ_Tags"."TaxonomyTermID" IN (%s)' , implode ( ',' , $ tags -> colu... | Helper to get all the FAQ articles that are tagged with the same tags . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.