idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
59,700 | protected function extractVisibility ( $ comments = '' ) { $ visible = TRUE ; preg_match ( '/@visible\ (true|false)\n/i' , $ comments , $ visibility ) ; if ( count ( $ visibility ) ) { $ visible = ! ( 'false' === $ visibility [ 1 ] ) ; } return $ visible ; } | Extract visibility from doc comments |
59,701 | protected function extractDescription ( $ comments = '' ) { $ description = '' ; $ docs = explode ( "\n" , $ comments ) ; if ( count ( $ docs ) ) { foreach ( $ docs as & $ doc ) { if ( ! preg_match ( '/(\*\*|\@)/' , $ doc ) && preg_match ( '/\*\ /' , $ doc ) ) { $ doc = explode ( '* ' , $ doc ) ; $ description = $ doc ... | Method that extract the description for the endpoint |
59,702 | public static function extractVarType ( $ comments = '' ) { $ type = 'string' ; preg_match ( '/@var\ (.*) (.*)\n/i' , $ comments , $ varType ) ; if ( count ( $ varType ) ) { $ aux = trim ( $ varType [ 1 ] ) ; $ type = str_replace ( ' ' , '' , strlen ( $ aux ) > 0 ? $ varType [ 1 ] : $ varType [ 2 ] ) ; } return $ type ... | Method that extract the type of a variable |
59,703 | protected function extractPayload ( $ model , $ comments = '' ) { $ payload = [ ] ; preg_match ( '/@payload\ (.*)\n/i' , $ comments , $ doc ) ; $ isArray = false ; if ( count ( $ doc ) ) { $ namespace = str_replace ( '{__API__}' , $ model , $ doc [ 1 ] ) ; if ( false !== strpos ( $ namespace , '[' ) && false !== strpos... | Method that extract the payload for the endpoint |
59,704 | protected function extractDtoProperties ( $ class ) { $ properties = [ ] ; $ reflector = new \ ReflectionClass ( $ class ) ; if ( $ reflector -> isSubclassOf ( self :: DTO_INTERFACE ) ) { $ properties = array_merge ( $ properties , InjectorHelper :: extractVariables ( $ reflector ) ) ; } return $ properties ; } | Extract all the properties from Dto class |
59,705 | protected function extractReturn ( $ model , $ comments = '' ) { $ modelDto = [ ] ; preg_match ( '/\@return\ (.*)\((.*)\)\n/i' , $ comments , $ returnTypes ) ; if ( count ( $ returnTypes ) ) { if ( array_key_exists ( 1 , $ returnTypes ) ) { $ modelDto = $ this -> extractDtoProperties ( $ returnTypes [ 1 ] ) ; } if ( ar... | Extract return class for api endpoint |
59,706 | protected function extractModelFields ( $ namespace ) { $ payload = [ ] ; try { $ reflector = new \ ReflectionClass ( $ namespace ) ; if ( NULL !== $ reflector && $ reflector -> isSubclassOf ( self :: MODEL_INTERFACE ) ) { $ tableMap = $ namespace :: TABLE_MAP ; $ tableMap = $ tableMap :: getTableMap ( ) ; foreach ( $ ... | Extract all fields from a ActiveResource model |
59,707 | protected function extractMethodInfo ( $ namespace , \ ReflectionMethod $ method , \ ReflectionClass $ reflection , $ module ) { $ methodInfo = NULL ; $ docComments = $ method -> getDocComment ( ) ; if ( FALSE !== $ docComments && preg_match ( '/\@route\ /i' , $ docComments ) ) { $ api = $ this -> extractApi ( $ reflec... | Method that extract all the needed info for each method in each API |
59,708 | public static function extractProperties ( \ ReflectionClass $ reflector , $ type = \ ReflectionProperty :: IS_PROTECTED , $ pattern = self :: INJECTABLE_PATTERN ) { $ properties = [ ] ; foreach ( $ reflector -> getProperties ( $ type ) as $ property ) { $ doc = $ property -> getDocComment ( ) ; if ( preg_match ( $ pat... | Method that extract the properties of a Class |
59,709 | public static function checkIsRequired ( $ doc ) { $ required = false ; if ( false !== preg_match ( '/@required/' , $ doc , $ matches ) ) { $ required = ( bool ) count ( $ matches ) ; } return $ required ; } | Method extract if a variable is required |
59,710 | public static function checkIsVisible ( $ doc ) { $ visible = false ; if ( false !== preg_match ( '/@visible\s+([^\s]+)/' , $ doc , $ matches ) ) { $ visible = count ( $ matches ) < 2 || 'false' !== strtolower ( $ matches [ 1 ] ) ; } return $ visible ; } | Method extract if a class or variable is visible |
59,711 | public static function getClassProperties ( $ class ) { $ properties = [ ] ; Logger :: log ( 'Extracting annotations properties from class ' . $ class ) ; $ selfReflector = new \ ReflectionClass ( $ class ) ; if ( false !== $ selfReflector -> getParentClass ( ) ) { $ properties = self :: getClassProperties ( $ selfRefl... | Method that extract all the properties of a class |
59,712 | protected static function saveConfigParams ( array $ data , array $ extra ) { Logger :: log ( 'Saving required config parameters' ) ; if ( array_key_exists ( 'label' , $ extra ) && is_array ( $ extra [ 'label' ] ) ) { foreach ( $ extra [ 'label' ] as $ index => $ field ) { if ( array_key_exists ( $ index , $ extra [ 'v... | Method that saves the configuration |
59,713 | protected static function saveExtraParams ( array $ data ) { $ final_data = array ( ) ; if ( count ( $ data ) > 0 ) { Logger :: log ( 'Saving extra configuration parameters' ) ; foreach ( $ data as $ key => $ value ) { if ( null !== $ value || $ value !== '' ) { $ final_data [ $ key ] = $ value ; } } } return $ final_d... | Method that saves the extra parameters into the configuration |
59,714 | public function isConfigured ( ) { Logger :: log ( 'Checking configuration' ) ; $ configured = ( count ( $ this -> config ) > 0 ) ; if ( $ configured ) { foreach ( static :: $ required as $ required ) { if ( ! array_key_exists ( $ required , $ this -> config ) ) { $ configured = false ; break ; } } } return $ configure... | Method that checks if the platform is proper configured |
59,715 | public function checkTryToSaveConfig ( ) { $ uri = Request :: getInstance ( ) -> getRequestUri ( ) ; $ method = Request :: getInstance ( ) -> getMethod ( ) ; return ( preg_match ( '/^\/admin\/(config|setup)$/' , $ uri ) !== false && strtoupper ( $ method ) === 'POST' ) ; } | Method that check if the user is trying to save the config |
59,716 | public static function save ( array $ data , array $ extra = null ) { $ data = self :: saveConfigParams ( $ data , $ extra ) ; $ final_data = self :: saveExtraParams ( $ data ) ; $ saved = false ; try { $ final_data = array_filter ( $ final_data , function ( $ key , $ value ) { return in_array ( $ key , self :: $ requi... | Method that saves all the configuration in the system |
59,717 | public function loadConfigData ( ) { $ this -> config = json_decode ( file_get_contents ( CONFIG_DIR . DIRECTORY_SEPARATOR . self :: CONFIG_FILE ) , true ) ? : [ ] ; $ this -> debug = array_key_exists ( 'debug' , $ this -> config ) ? ( bool ) $ this -> config [ 'debug' ] : FALSE ; } | Method that reloads config file |
59,718 | public static function getParam ( $ key , $ defaultValue = null , $ module = null ) { if ( null !== $ module ) { return self :: getParam ( strtolower ( $ module ) . '.' . $ key , self :: getParam ( $ key , $ defaultValue ) ) ; } $ param = self :: getInstance ( ) -> get ( $ key ) ; return ( null !== $ param ) ? $ param ... | Static wrapper for extracting params |
59,719 | public static function setCookieHeaders ( $ cookies ) { if ( ! empty ( $ cookies ) && is_array ( $ cookies ) && false === headers_sent ( ) && ! self :: isTest ( ) ) { foreach ( $ cookies as $ cookie ) { setcookie ( $ cookie [ "name" ] , $ cookie [ "value" ] , ( array_key_exists ( 'expire' , $ cookie ) ) ? $ cookie [ "e... | Method that sets the cookie headers |
59,720 | public function toHtmlInternal ( $ value = null ) { $ strOutput = "<optgroup label=\"{$this->__label}\">\n" ; foreach ( $ this -> __options as $ option ) { $ strOutput .= $ option -> toHtmlInternal ( $ value ) ; } $ strOutput .= "</optgroup>\n" ; return $ strOutput ; } | Generte HTML output |
59,721 | public function setColor ( $ color ) : DeliveryOptions { if ( ! in_array ( $ color , static :: getOptionsForColor ( ) ) ) { throw new InvalidArgumentException ( sprintf ( 'Property %s is not supported for %s' , $ color , __FUNCTION__ ) ) ; } $ this -> data [ 'color' ] = $ color ; return $ this ; } | The option specifies whether a color or black - and - white printing is carried out |
59,722 | public function setCoverLetter ( $ coverLetter ) : DeliveryOptions { if ( ! in_array ( $ coverLetter , static :: getOptionsForCoverLetter ( ) ) ) { throw new InvalidArgumentException ( sprintf ( 'Property %s is not supported for %s' , $ coverLetter , __FUNCTION__ ) ) ; } $ this -> data [ 'coverLetter' ] = $ coverLetter... | The option specifies whether a cover letter is generated for delivery or if it is included in the PDF attachment |
59,723 | public function detectWhenRequestHasNotBeenHandled ( ) { add_action ( 'wp_footer' , function ( ) { $ this -> requestHasBeenHandled ( ) ; } ) ; add_action ( 'shutdown' , function ( ) { if ( ! $ this -> hasRequestBeenHandled ( ) ) { if ( $ this -> has ( '__wp-controller-miss-template' ) && $ this -> has ( '__wp-controlle... | Detect when the request has not been handled and throw an exception |
59,724 | public function getTranslations ( $ locale ) { if ( null === $ locale ) { $ locale = Config :: getParam ( 'default.language' , 'es_ES' ) ; } $ translations = $ this -> tpl -> regenerateTemplates ( ) ; $ localePath = realpath ( BASE_DIR . DIRECTORY_SEPARATOR . 'locale' ) ; $ localePath .= DIRECTORY_SEPARATOR . $ locale ... | Method that regenerates the translations |
59,725 | public function addField ( $ name , $ type , $ validationRules = array ( ) , $ errorHandlers = array ( ) , $ meta = array ( ) ) { foreach ( [ 'dynamic' , 'dynamicLabel' , 'dynamicRemoveLabel' ] as $ metaKey ) { if ( array_key_exists ( $ metaKey , $ meta ) ) { unset ( $ meta [ $ metaKey ] ) ; } } $ objField = ValidForm ... | Add a field to the MultiField collection . |
59,726 | public function addText ( $ strText , $ meta = array ( ) ) { $ objString = new StaticText ( $ strText , $ meta ) ; $ objString -> setMeta ( "parent" , $ this , true ) ; $ this -> __fields -> addObject ( $ objString ) ; return $ objString ; } | Add text to the multifield . |
59,727 | protected function getDynamicHtml ( ) { $ strReturn = "" ; if ( $ this -> __dynamic && ! empty ( $ this -> __dynamicLabel ) ) { $ arrFields = array ( ) ; foreach ( $ this -> __fields as $ field ) { if ( ( get_class ( $ field ) == "ValidFormBuilder\\Hidden" ) && $ field -> isDynamicCounter ( ) ) { continue ; } if ( ! em... | Generate dynamic HTML for client - side field duplication |
59,728 | public function hasContent ( $ intCount = 0 ) { $ blnReturn = false ; foreach ( $ this -> __fields as $ objField ) { if ( get_class ( $ objField ) !== "ValidFormBuilder\\Hidden" ) { $ objValidator = $ objField -> getValidator ( ) ; if ( is_object ( $ objValidator ) ) { $ varValue = $ objValidator -> getValue ( $ intCou... | Loop through all child fields and check their values . If one value is not empty the MultiField has content . |
59,729 | protected function setFromMixedSource ( $ ip ) { if ( is_int ( $ ip ) || is_string ( $ ip ) ) { if ( is_int ( $ ip ) ) { $ ip = long2ip ( $ ip ) ; } if ( is_string ( $ ip ) ) { $ ip = ip2long ( $ ip ) ; } } else { $ ip = false ; } if ( $ ip === false ) { throw new \ Exception ( __METHOD__ . ' requires valid IPV4 addres... | Format and validate for given string or integer formatted IPV4 network address . |
59,730 | public function get ( $ format = self :: FORMAT_LONG_NOTATION ) { return $ format === self :: FORMAT_DOTTED_NOTATION ? long2ip ( $ this -> address ) : $ this -> address ; } | Get the integer or dot - notated - string representation of the address . |
59,731 | protected function getCountersRecursive ( $ objFields , $ objCollection = null ) { if ( is_null ( $ objCollection ) ) { $ objCollection = new Collection ( ) ; } foreach ( $ objFields as $ objField ) { if ( $ objField instanceof Element && $ objField -> isDynamicCounter ( ) ) { $ objCollection -> addObject ( $ objField ... | Get a collection of fields and look for dynamic counters recursively |
59,732 | public function addCondition ( $ strType , $ blnValue , $ arrComparisons , $ intComparisonType = ValidForm :: VFORM_MATCH_ANY ) { if ( $ this -> hasCondition ( $ strType ) ) { $ objCondition = $ this -> getCondition ( $ strType ) ; } else { $ objCondition = new Condition ( $ this , $ strType , $ blnValue , $ intCompari... | Add a new condition to the current field |
59,733 | public function getCondition ( $ strProperty ) { $ objReturn = null ; $ objConditions = $ this -> getConditions ( ) ; foreach ( $ objConditions as $ objCondition ) { if ( $ objCondition -> getProperty ( ) === strtolower ( $ strProperty ) ) { $ objReturn = $ objCondition ; break ; } } if ( is_null ( $ objReturn ) && is_... | Get element s Condition object |
59,734 | public function hasCondition ( $ strProperty ) { $ blnReturn = false ; foreach ( $ this -> __conditions as $ objCondition ) { if ( $ objCondition -> getProperty ( ) === strtolower ( $ strProperty ) ) { $ blnReturn = true ; break ; } } return $ blnReturn ; } | Check if the current field contains a condition object of a specific type |
59,735 | public function getDynamicButtonMeta ( ) { $ strReturn = "" ; $ objCondition = $ this -> getCondition ( "visible" ) ; if ( is_object ( $ objCondition ) ) { $ blnResult = $ objCondition -> isMet ( ) ; if ( $ blnResult ) { if ( ! $ objCondition -> getValue ( ) ) { $ strReturn = " style=\"display:none;\"" ; } } else { if ... | This method determines wheter or not to show the add extra field dynamic button based on it s parent s condition state . |
59,736 | public function setConditionalMeta ( ) { foreach ( $ this -> __conditions as $ objCondition ) { $ blnResult = $ objCondition -> isMet ( ) ; switch ( $ objCondition -> getProperty ( ) ) { case "visible" : if ( $ blnResult ) { if ( $ objCondition -> getValue ( ) ) { $ this -> setMeta ( "style" , "display: block;" ) ; } e... | Based on which conditions are met corresponding metadata is set on the object . |
59,737 | public function setMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( $ property , $ value , $ blnOverwrite ) ; } | Set meta property . |
59,738 | public function setFieldMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( "field" . $ property , $ value , $ blnOverwrite ) ; } | Set field specific meta data |
59,739 | public function getFieldMeta ( $ property = null , $ fallbackValue = "" ) { if ( is_null ( $ property ) ) { $ varReturn = $ this -> __fieldmeta ; } elseif ( isset ( $ this -> __fieldmeta [ $ property ] ) && ! is_null ( $ this -> __fieldmeta [ $ property ] ) ) { $ varReturn = $ this -> __fieldmeta [ $ property ] ; } els... | Get field meta property . |
59,740 | public function setLabelMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( "label" . $ property , $ value , $ blnOverwrite ) ; } | Set label specific meta data |
59,741 | public function setTipMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( "tip" . $ property , $ value , $ blnOverwrite ) ; } | Set tip specific meta data |
59,742 | public function setDynamicLabelMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( "dynamicLabel" . $ property , $ value , $ blnOverwrite ) ; } | Set dynamic label specific meta data |
59,743 | public function setDynamicRemoveLabelMeta ( $ property , $ value , $ blnOverwrite = false ) { return $ this -> __setMeta ( "dynamicRemoveLabel" . $ property , $ value , $ blnOverwrite ) ; } | Set dynamic remove label specific meta data |
59,744 | public function getMeta ( $ property = null , $ fallbackValue = "" ) { if ( is_null ( $ property ) ) { $ varReturn = $ this -> __meta ; } elseif ( isset ( $ this -> __meta [ $ property ] ) && ! is_null ( $ this -> __meta [ $ property ] ) ) { $ varReturn = $ this -> __meta [ $ property ] ; } else { $ varReturn = $ fallb... | Get meta property . |
59,745 | public function getLabelMeta ( $ property = null , $ fallbackValue = "" ) { if ( is_null ( $ property ) ) { $ varReturn = $ this -> __labelmeta ; } elseif ( isset ( $ this -> __labelmeta [ $ property ] ) && ! is_null ( $ this -> __labelmeta [ $ property ] ) ) { $ varReturn = $ this -> __labelmeta [ $ property ] ; } els... | Get label meta property . |
59,746 | protected function conditionsToJs ( $ intDynamicPosition = 0 ) { $ strReturn = "" ; if ( $ this -> hasConditions ( ) && ( count ( $ this -> getConditions ( ) ) > 0 ) ) { foreach ( $ this -> getConditions ( ) as $ objCondition ) { $ strReturn .= "objForm.addCondition(" . json_encode ( $ objCondition -> jsonSerialize ( $... | Generates needed javascript initialization code for client - side conditional logic |
59,747 | protected function matchWithToJs ( $ intDynamicPosition = 0 ) { $ strReturn = "" ; $ objMatchWith = $ this -> getValidator ( ) -> getMatchWith ( ) ; if ( is_object ( $ objMatchWith ) ) { $ strId = ( $ intDynamicPosition == 0 ) ? $ this -> __id : $ this -> __id . "_" . $ intDynamicPosition ; $ strMatchId = ( $ intDynami... | Generate matchWith javascript code |
59,748 | protected function __sanitizeCheckForJs ( $ strCheck ) { $ strCheck = ( empty ( $ strCheck ) ) ? "''" : str_replace ( "'" , "\\'" , $ strCheck ) ; $ strCheck = ( mb_substr ( $ strCheck , - 1 ) == "u" ) ? mb_substr ( $ strCheck , 0 , - 1 ) : $ strCheck ; return $ strCheck ; } | Sanitize a regular expression check for javascript . |
59,749 | protected function __getMetaString ( ) { $ strOutput = "" ; foreach ( $ this -> __meta as $ key => $ value ) { if ( ! in_array ( $ key , array_merge ( $ this -> __reservedmeta , $ this -> __fieldmeta ) ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } return $ strOutput ; } | Convert meta array to html attributes + values |
59,750 | protected function __getFieldMetaString ( ) { $ strOutput = "" ; if ( is_array ( $ this -> __fieldmeta ) ) { foreach ( $ this -> __fieldmeta as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> __reservedmeta ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } } return $ strOutput ; } | Convert fieldmeta array to html attributes + values |
59,751 | protected function __getLabelMetaString ( ) { $ strOutput = "" ; if ( is_array ( $ this -> __labelmeta ) ) { foreach ( $ this -> __labelmeta as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> __reservedmeta ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } } return $ strOutput ; } | Convert labelmeta array to html attributes + values |
59,752 | protected function __getTipMetaString ( ) { $ strOutput = "" ; if ( is_array ( $ this -> __tipmeta ) ) { foreach ( $ this -> __tipmeta as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> __reservedmeta ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } } return $ strOutput ; } | Convert tipmeta array to html attributes + values |
59,753 | protected function __getDynamicLabelMetaString ( ) { $ strOutput = "" ; if ( is_array ( $ this -> __dynamiclabelmeta ) ) { foreach ( $ this -> __dynamiclabelmeta as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> __reservedmeta ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } } return $ strOutput ; } | Convert dynamiclabelmeta array to html attributes + values |
59,754 | protected function __getDynamicRemoveLabelMetaString ( ) { $ strOutput = "" ; if ( is_array ( $ this -> __dynamicremovelabelmeta ) ) { foreach ( $ this -> __dynamicremovelabelmeta as $ key => $ value ) { if ( ! in_array ( $ key , $ this -> __reservedmeta ) ) { $ strOutput .= " {$key}=\"{$value}\"" ; } } } return $ strO... | Convert dynamicRemoveLabelMeta array to html attributes + values |
59,755 | protected function __setMeta ( $ property , $ value , $ blnOverwrite = false ) { $ internalMetaArray = & $ this -> __meta ; $ strMagicKey = null ; foreach ( $ this -> __magicmeta as $ strMagicMeta ) { if ( strpos ( strtolower ( $ property ) , strtolower ( $ strMagicMeta ) ) === 0 && strlen ( $ property ) !== strlen ( $... | Helper method to set meta data |
59,756 | public function getQuery ( $ queryParams ) { return array_key_exists ( $ queryParams , $ this -> query ) ? $ this -> query [ $ queryParams ] : null ; } | Get query params |
59,757 | public function getRootUrl ( $ hasProtocol = true ) { $ url = $ this -> getServerName ( ) ; $ protocol = $ hasProtocol ? $ this -> getProtocol ( ) : '' ; if ( ! empty ( $ protocol ) ) { $ url = $ protocol . $ url ; } if ( ! in_array ( ( integer ) $ this -> getServer ( 'SERVER_PORT' ) , [ 80 , 443 ] , true ) ) { $ url .... | Devuelve la url completa de base |
59,758 | protected function hydrateOrders ( ) { if ( count ( $ this -> query ) ) { Logger :: log ( static :: class . ' gathering query string' , LOG_DEBUG ) ; foreach ( $ this -> query as $ key => $ value ) { if ( $ key === self :: API_ORDER_FIELD && is_array ( $ value ) ) { foreach ( $ value as $ field => $ direction ) { $ thi... | Hydrate order from request |
59,759 | protected function extractPagination ( ) { Logger :: log ( static :: class . ' extract pagination start' , LOG_DEBUG ) ; $ page = array_key_exists ( self :: API_PAGE_FIELD , $ this -> query ) ? $ this -> query [ self :: API_PAGE_FIELD ] : 1 ; $ limit = array_key_exists ( self :: API_LIMIT_FIELD , $ this -> query ) ? $ ... | Extract pagination values |
59,760 | private function addOrders ( ModelCriteria & $ query ) { Logger :: log ( static :: class . ' extract orders start ' , LOG_DEBUG ) ; $ orderAdded = FALSE ; $ tableMap = $ this -> getTableMap ( ) ; foreach ( $ this -> order -> getOrders ( ) as $ field => $ direction ) { if ( $ column = ApiHelper :: checkFieldExists ( $ t... | Add order fields to query |
59,761 | protected function addFilters ( ModelCriteria & $ query ) { if ( count ( $ this -> query ) > 0 ) { $ tableMap = $ this -> getTableMap ( ) ; foreach ( $ this -> query as $ field => $ value ) { if ( self :: API_COMBO_FIELD === $ field ) { ApiHelper :: composerComboField ( $ tableMap , $ query , $ this -> extraColumns , $... | Add filters fields to query |
59,762 | private function paginate ( ) { $ this -> list = null ; try { $ query = $ this -> prepareQuery ( ) ; $ this -> addFilters ( $ query ) ; $ this -> checkReturnFields ( $ query ) ; $ this -> addOrders ( $ query ) ; list ( $ page , $ limit ) = $ this -> extractPagination ( ) ; if ( $ limit === - 1 ) { $ this -> list = $ qu... | Generate list page for model |
59,763 | protected function hydrateRequestData ( ) { $ request = Request :: getInstance ( ) ; $ this -> query = array_merge ( $ this -> query , $ request -> getQueryParams ( ) ) ; $ this -> data = array_merge ( $ this -> data , $ request -> getRawData ( ) ) ; } | Hydrate data from request |
59,764 | public function assertNotThrows ( string $ class , callable $ execute ) : void { try { $ execute ( ) ; } catch ( ExpectationFailedException $ e ) { throw $ e ; } catch ( Throwable $ e ) { static :: assertThat ( $ e , new LogicalNot ( new ConstraintException ( $ class ) ) ) ; return ; } static :: assertThat ( null , new... | Asserts that the callable doesn t throw a specified exception . |
59,765 | public function assertThrows ( string $ class , callable $ execute , callable $ inspect = null ) : void { try { $ execute ( ) ; } catch ( ExpectationFailedException $ e ) { throw $ e ; } catch ( Throwable $ e ) { static :: assertThat ( $ e , new ConstraintException ( $ class ) ) ; if ( $ inspect !== null ) { $ inspect ... | Asserts that the callable throws a specified throwable . If successful and the inspection callable is not null then it is called and the caught exception is passed as argument . |
59,766 | public function cachePoints ( $ metricId , $ num = 1000 , $ page = 1 ) { if ( $ this -> cached != null ) { return $ this -> cached ; } $ this -> cached = $ this -> client -> call ( 'GET' , "metrics/$metricId/points" , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; return $ this -> cached ; } | Cache Points for performance improvement . |
59,767 | public function indexPoints ( $ metricId , $ num = 1000 , $ page = 1 ) { if ( $ this -> cache != false ) { return $ this -> cachePoints ( $ metricId , $ num , $ page ) ; } return $ this -> client -> call ( 'GET' , "metrics/$metricId/points" , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; } | Get a defined number of Points . |
59,768 | public function searchPoints ( $ metricId , $ search , $ by , $ limit = 1 , $ num = 1000 , $ page = 1 ) { $ points = $ this -> indexPoints ( $ metricId , $ num , $ page ) [ 'data' ] ; $ filtered = array_filter ( $ points , function ( $ point ) use ( $ search , $ by ) { if ( array_key_exists ( $ by , $ point ) ) { if ( ... | Search if a defined number of Points exists . |
59,769 | public function getAllRoutes ( ) { $ routes = [ ] ; foreach ( $ this -> getRoutes ( ) as $ path => $ route ) { if ( array_key_exists ( 'slug' , $ route ) ) { $ routes [ $ route [ 'slug' ] ] = $ path ; } } return $ routes ; } | Method that extract all routes in the platform |
59,770 | private function generateSlugs ( $ absoluteTranslationFileName ) { $ translations = I18nHelper :: generateTranslationsFile ( $ absoluteTranslationFileName ) ; foreach ( $ this -> routing as $ key => & $ info ) { $ keyParts = explode ( '#|#' , $ key ) ; $ keyParts = array_key_exists ( 1 , $ keyParts ) ? $ keyParts [ 1 ]... | Parse slugs to create translations |
59,771 | public function setSystemMessageType ( $ messageType ) : Envelope { if ( ! in_array ( $ messageType , static :: getLetterTypeOptions ( ) ) ) { throw new InvalidArgumentException ( sprintf ( 'Property %s is not supported for %s' , $ messageType , __FUNCTION__ ) ) ; } $ this -> data [ 'letterType' ] [ 'systemMessageType'... | Specify the type of E - POST letter |
59,772 | public function addRecipientPrinted ( Recipient \ Hybrid $ recipient ) : Envelope { if ( $ this -> isNormalLetter ( ) ) { throw new LogicException ( sprintf ( 'Can not set recipientsPrinted if message type is "%s"' , self :: LETTER_TYPE_NORMAL ) ) ; } if ( count ( $ this -> getRecipients ( ) ) ) { throw new LogicExcept... | Add a hybrid recipient for printed letters |
59,773 | public function getRecipients ( ) { switch ( $ this -> getSystemMessageType ( ) ) { case self :: LETTER_TYPE_NORMAL : return $ this -> data [ 'recipients' ] ; break ; case self :: LETTER_TYPE_HYBRID : return $ this -> data [ 'recipientsPrinted' ] ; break ; } return null ; } | Get the recipients added to the envelope |
59,774 | public function getEnvelope ( ) : Envelope { if ( null === $ this -> envelope ) { throw new MissingEnvelopeException ( 'No Envelope provided! Provide one beforehand' ) ; } if ( empty ( $ this -> envelope -> getRecipients ( ) ) ) { throw new MissingRecipientException ( 'No recipients provided! Add them beforehand' ) ; }... | Get the envelope |
59,775 | public function setDeliveryOptions ( DeliveryOptions $ deliveryOptions ) : Letter { if ( $ this -> envelope && $ this -> envelope -> isNormalLetter ( ) ) { throw new LogicException ( 'Delivery options are not supported for non-printed letters.' ) ; } $ this -> deliveryOptions = $ deliveryOptions ; return $ this ; } | Set the delivery options |
59,776 | public function getPostageInfo ( ) { if ( null === $ this -> postageInfo ) { throw new MissingPreconditionException ( 'No postage info provided! Provide them beforehand' ) ; } if ( null === $ this -> postageInfo -> getDeliveryOptions ( ) && null !== $ this -> getDeliveryOptions ( ) ) { $ this -> postageInfo -> setDeliv... | Get the postage info |
59,777 | public function create ( ) : Letter { $ multipartElements = [ [ 'name' => 'envelope' , 'contents' => \ GuzzleHttp \ json_encode ( $ this -> getEnvelope ( ) ) , 'headers' => [ 'Content-Type' => $ this -> getEnvelope ( ) -> getMimeType ( ) ] , ] , ] ; if ( $ this -> getCoverLetter ( ) ) { $ multipartElements [ ] = [ 'nam... | Create a draft by given envelope and attachments |
59,778 | public function send ( ) : Letter { $ options = [ 'headers' => [ 'Content-Source' => $ this -> getEndpointMailbox ( ) . '/letters/' . $ this -> getLetterId ( ) , ] , ] ; if ( $ this -> getEnvelope ( ) -> isHybridLetter ( ) && null !== $ this -> getDeliveryOptions ( ) ) { $ options [ 'headers' ] [ 'Content-Type' ] = $ t... | Send the given letter . Delivery options should be set optionally for physical letters |
59,779 | private static function getMimeTypeOfFile ( $ path ) { $ fileInfo = finfo_open ( FILEINFO_MIME_TYPE ) ; $ mime = finfo_file ( $ fileInfo , $ path ) ; finfo_close ( $ fileInfo ) ; return $ mime ; } | Get a file s mime type |
59,780 | public function getCharacter ( $ characterId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'characters' ) ; $ apiUrl .= $ characterId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get character information |
59,781 | public function getCompany ( $ companyId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'companies' ) ; $ apiUrl .= $ companyId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get company information by ID |
59,782 | public function getFranchise ( $ franchiseId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'franchises' ) ; $ apiUrl .= $ franchiseId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get franchise information |
59,783 | public function getGameMode ( $ gameModeId , $ fields = [ 'name' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'game_modes' ) ; $ apiUrl .= $ gameModeId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ ap... | Get game mode information by ID |
59,784 | public function searchGameModes ( $ search , $ fields = [ 'name' , 'slug' , 'url' ] , $ limit = 10 , $ offset = 0 ) { $ apiUrl = $ this -> getEndpoint ( 'game_modes' ) ; $ params = array ( 'fields' => implode ( ',' , $ fields ) , 'limit' => $ limit , 'offset' => $ offset , 'search' => $ search , ) ; $ apiData = $ this ... | Search game modes by name |
59,785 | public function getGame ( $ gameId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'games' ) ; $ apiUrl .= $ gameId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get game information by ID |
59,786 | public function searchGames ( $ search , $ fields = [ '*' ] , $ limit = 10 , $ offset = 0 , $ order = null ) { $ apiUrl = $ this -> getEndpoint ( 'games' ) ; $ params = array ( 'fields' => implode ( ',' , $ fields ) , 'limit' => $ limit , 'offset' => $ offset , 'order' => $ order , 'search' => $ search , ) ; $ apiData ... | Search games by name |
59,787 | public function getGenre ( $ genreId , $ fields = [ 'name' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'genres' ) ; $ apiUrl .= $ genreId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get genre information by ID |
59,788 | public function getKeyword ( $ keywordId , $ fields = [ 'name' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'keywords' ) ; $ apiUrl .= $ keywordId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData... | Get keyword information by ID |
59,789 | public function getPerson ( $ personId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'people' ) ; $ apiUrl .= $ personId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get people information by ID |
59,790 | public function getPlatform ( $ platformId , $ fields = [ 'name' , 'logo' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'platforms' ) ; $ apiUrl .= $ platformId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingl... | Get platform information by ID |
59,791 | public function getPlayerPerspective ( $ perspectiveId , $ fields = [ 'name' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'player_perspectives' ) ; $ apiUrl .= $ perspectiveId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ thi... | Get player perspective information by ID |
59,792 | public function getPulse ( $ pulseId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'pulses' ) ; $ apiUrl .= $ pulseId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get pulse information by ID |
59,793 | public function fetchPulses ( $ fields = [ '*' ] , $ limit = 10 , $ offset = 0 ) { $ apiUrl = $ this -> getEndpoint ( 'pulses' ) ; $ params = array ( 'fields' => implode ( ',' , $ fields ) , 'limit' => $ limit , 'offset' => $ offset ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeMulti... | Search pulses by title |
59,794 | public function getCollection ( $ collectionId , $ fields = [ '*' ] ) { $ apiUrl = $ this -> getEndpoint ( 'collections' ) ; $ apiUrl .= $ collectionId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get collection information by ID |
59,795 | public function getTheme ( $ themeId , $ fields = [ 'name' , 'slug' , 'url' ] ) { $ apiUrl = $ this -> getEndpoint ( 'themes' ) ; $ apiUrl .= $ themeId ; $ params = array ( 'fields' => implode ( ',' , $ fields ) ) ; $ apiData = $ this -> apiGet ( $ apiUrl , $ params ) ; return $ this -> decodeSingle ( $ apiData ) ; } | Get themes information by ID |
59,796 | private function decodeMultiple ( & $ apiData ) { $ resObj = json_decode ( $ apiData ) ; if ( isset ( $ resObj -> status ) ) { $ msg = "Error " . $ resObj -> status . " " . $ resObj -> message ; throw new \ Exception ( $ msg ) ; } else { if ( ! is_array ( $ resObj ) ) { return false ; } else { return $ resObj ; } } } | Decode the response from IGDB extract the multiple resource object . |
59,797 | private function checkAuth ( ) { $ namespace = explode ( '\\' , $ this -> getModelTableMap ( ) ) ; $ module = strtolower ( $ namespace [ 0 ] ) ; $ secret = Config :: getInstance ( ) -> get ( $ module . '.api.secret' ) ; if ( NULL === $ secret ) { $ secret = Config :: getInstance ( ) -> get ( "api.secret" ) ; } if ( NUL... | Check service authentication |
59,798 | public function cacheGroups ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cached != null ) { return $ this -> cached ; } $ this -> cached = $ this -> client -> call ( 'GET' , 'components/groups' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; return $ this -> cached ; } | Cache Group for performance improvement . |
59,799 | public function indexGroups ( $ num = 1000 , $ page = 1 ) { if ( $ this -> cache != false ) { return $ this -> cacheGroups ( $ num , $ page ) ; } return $ this -> client -> call ( 'GET' , 'components/groups' , [ 'query' => [ 'per_page' => $ num , 'current_page' => $ page , ] , ] ) ; } | Get a defined number of Groups . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.