idx int64 0 60.3k | question stringlengths 92 4.62k | target stringlengths 7 635 |
|---|---|---|
37,400 | public function stopPlaying ( $ liveCallUuid ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to stop playing in? No callUuid given" ) ; } $ this -> client -> delete ( $ this -> uri . $ liveCallUuid . '/Play/' , [ ] ) ; } | Stop playing audio in a live call |
37,401 | public function startSpeaking ( $ liveCallUuid , $ text , array $ optionalArgs = [ ] ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to speak in? No callUuid given" ) ; } if ( empty ( $ text ) ) { throw new PlivoValidationException ( "text cannot be null" ) ; } $ response = $ this... | Start speaking in a live call |
37,402 | public function stopSpeaking ( $ liveCallUuid ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to stop speaking in? No callUuid given" ) ; } $ this -> client -> delete ( $ this -> uri . $ liveCallUuid . '/Speak/' , [ ] ) ; } | Stop speaking in a live call |
37,403 | public function dtmf ( $ liveCallUuid , $ digits , $ leg = null ) { if ( empty ( $ liveCallUuid ) ) { throw new PlivoValidationException ( "Which call to send digits in? No callUuid given" ) ; } if ( empty ( $ digits ) ) { throw new PlivoValidationException ( "digits cannot be null" ) ; } $ response = $ this -> client ... | Send digits in a live call |
37,404 | public function cancel ( $ requestUuid ) { if ( empty ( $ requestUuid ) ) { throw new PlivoValidationException ( "Which call request to cancel? No requestUuid given" ) ; } $ this -> client -> delete ( "Account/" . $ this -> pathParams [ 'authId' ] . "/Request/" . $ requestUuid . '/' , [ ] ) ; } | Cancel the request |
37,405 | public function getList ( $ countryIso , $ optionalArgs = [ ] ) { $ response = $ this -> client -> fetch ( $ this -> uri , array_merge ( [ 'country_iso' => $ countryIso ] , $ optionalArgs ) ) ; $ phoneNumbers = [ ] ; foreach ( $ response -> getContent ( ) [ 'objects' ] as $ phoneNumber ) { $ newNumber = new PhoneNumber... | Return a list of available phone numbers based on country ISO |
37,406 | public function buy ( $ phoneNumber , $ appId = null ) { $ response = $ this -> client -> update ( $ this -> uri . $ phoneNumber . '/' , [ 'app_id' => $ appId ] ) ; $ responseContents = $ response -> getContent ( ) ; if ( ! array_key_exists ( "error" , $ responseContents ) ) { return new PhoneNumberBuyResponse ( $ resp... | Buy a phone number |
37,407 | public function getErrorMessage ( ) { if ( array_key_exists ( 'error' , $ this -> responseData ? : [ ] ) ) { if ( is_string ( $ this -> responseData [ 'error' ] ) ) { return json_encode ( $ this -> responseData [ 'error' ] ) ; } elseif ( array_key_exists ( 'error' , $ this -> responseData [ 'error' ] ) ) { return json_... | Retrieves the error message from the response |
37,408 | public function getException ( $ message ) { switch ( $ this -> statusCode ) { case 400 : return $ message ? new PlivoValidationException ( $ message ) : new PlivoValidationException ( "A parameter is missing or " . "is invalid while accessing resource" ) ; break ; case 401 : return $ message ? new PlivoAuthenticationE... | Returns an exceptions with a message based on the status code |
37,409 | public static function appendParamsToUrl ( $ url , $ params ) { if ( empty ( $ params ) ) { return $ url ; } $ getParams = http_build_query ( $ params , null , '&' ) ; return $ url . '?' . $ getParams ; } | Append the parameters to the url for GET request |
37,410 | public function getDefaultHeaders ( ) { return [ 'User-Agent' => 'plivo-php/' . implode ( '.' , [ Version :: MAJOR , Version :: MINOR , Version :: PATCH ] ) . ' (PHP ' . $ this -> phpVersion . ')' , 'Accept-Encoding' => '*' , 'Content-type' => 'application/json' ] ; } | Return the default headers that every request should use . |
37,411 | public function update ( $ name , $ enabled = null ) { return $ this -> proxyToInterface ( ) -> update ( $ this -> pathParams [ 'subAuthId' ] , $ name , $ enabled ) ; } | Update the subaccount |
37,412 | public function makeException ( ) { $ this -> thrownException = new PlivoResponseException ( null , null , null , $ this -> decodedContent , $ this -> statusCode ) ; echo $ this -> thrownException -> getMessage ( ) ; } | Instantiates an exception to be thrown later . |
37,413 | public function decodeContent ( ) { $ this -> decodedContent = json_decode ( $ this -> content , true ) ? : [ "error" => $ this -> content ] ; if ( ! $ this -> ok ( ) ) { $ this -> makeException ( ) ; } } | Decodes the JSON and then checks if the response is 2xx accordingly creates an exception |
37,414 | public function list ( ) { $ response = $ this -> client -> fetch ( $ this -> uri , [ ] ) ; return json_encode ( $ response -> getContent ( ) , JSON_FORCE_OBJECT ) ; } | You can call this method to retrieve all your addresses |
37,415 | public function get ( $ addressId ) { $ uri = $ this -> uri . $ addressId . '/' ; $ response = $ this -> client -> fetch ( $ uri , [ ] ) ; return json_encode ( $ response -> getContent ( ) , JSON_FORCE_OBJECT ) ; } | You can call this method to fetch a particular address |
37,416 | public function add ( $ params ) { $ response = $ this -> client -> update ( $ this -> uri , $ params ) ; return json_encode ( $ response -> getContent ( ) , JSON_FORCE_OBJECT ) ; } | You can call this method to add an address |
37,417 | public function update ( $ addressId , $ params ) { $ uri = $ this -> uri . $ addressId . '/' ; $ response = $ this -> client -> update ( $ uri , $ params ) ; return json_encode ( $ response -> getContent ( ) , JSON_FORCE_OBJECT ) ; } | You can call this method to update an address |
37,418 | public function delete ( $ addressId ) { if ( ArrayOperations :: checkNull ( [ $ addressId ] ) ) { throw new PlivoValidationException ( 'address id is mandatory' ) ; } $ uri = $ this -> uri . $ addressId . '/' ; $ response = $ this -> client -> delete ( $ uri , [ ] ) ; return json_encode ( $ response -> getContent ( ) ... | Delete an address |
37,419 | public function get ( $ name ) { if ( ! $ this -> has ( $ name ) ) { throw new \ InvalidArgumentException ( sprintf ( 'No filesystem is registered for name "%s"' , $ name ) ) ; } return $ this -> maps [ $ name ] ; } | Retrieves a filesystem by its name . |
37,420 | public function apply ( \ DomDocument $ document , \ DOMElement $ rootElement , NodeInterface $ node ) : void { if ( $ this -> hasValue ( $ node ) ) { $ this -> addElement ( $ document , $ rootElement , $ node ) ; } } | adds the accurate DomElement content according to the node s property |
37,421 | protected function setNonEmptyAttribute ( \ DomElement $ element , string $ name , string $ value = null ) : void { if ( ! is_null ( $ value ) ) { $ element -> setAttribute ( $ name , $ value ) ; } } | Sets the attribute only if the value is not empty |
37,422 | protected function appendNonEmptyChild ( \ DomDocument $ document , \ DOMElement $ element , string $ name , string $ value = null ) : void { if ( ! is_null ( $ value ) ) { $ element -> appendChild ( $ document -> createElement ( $ name , $ value ) ) ; } } | Appends a child node only if the value is not null |
37,423 | protected function extractFeeds ( string $ html ) : array { $ dom = new \ DOMDocument ( ) ; $ dom -> loadHTML ( $ html ) ; $ links = $ dom -> getElementsByTagName ( 'link' ) ; $ feeds = [ ] ; foreach ( $ links as $ link ) { if ( $ this -> isFeedLink ( $ link ) ) { $ feeds [ ] = $ link -> getAttribute ( 'href' ) ; } } r... | Extract feeds Urls from HTML stream |
37,424 | protected function isFeedLink ( \ DomElement $ element ) : bool { return $ element -> hasAttribute ( 'type' ) && in_array ( $ element -> getAttribute ( 'type' ) , self :: VALID_TYPES ) ; } | Tells if the given Element contains a valid Feed Url |
37,425 | public function addFilter ( FilterInterface $ filter ) : Reader { foreach ( $ this -> parsers as $ parser ) { $ parser -> addFilter ( $ filter ) ; } return $ this ; } | adds a filter to every parsers |
37,426 | public function getFeedRuleSet ( ) : RuleSet { if ( is_null ( $ this -> feedRuleSet ) ) { $ this -> feedRuleSet = $ this -> buildFeedRuleSet ( ) ; } return $ this -> feedRuleSet ; } | Returns the RuleSet used to parse the feed s main node |
37,427 | public function parse ( Document $ document , FeedInterface $ feed ) : FeedInterface { if ( ! $ this -> standard -> canHandle ( $ document ) ) { throw new UnsupportedFormatException ( 'this is not a supported format' ) ; } $ this -> checkBodyStructure ( $ document , $ this -> standard -> getMandatoryFields ( ) ) ; $ th... | Tries to parse the document |
37,428 | public function getPsrResponse ( FeedInterface $ feed , string $ standard , int $ maxAge = 600 , bool $ public = true ) : ResponseInterface { $ this -> logAction ( $ feed , "creating a PSR 7 Response in $standard format" ) ; $ formatter = $ this -> getStandard ( $ standard ) -> getFormatter ( ) ; $ responseBuilder = ne... | Get a PSR - 7 compliant response for the given feed |
37,429 | public function buildFeedRuleSet ( ) : RuleSet { $ ruleSet = $ this -> buildBaseRuleSet ( ) ; $ ruleSet -> add ( new LinkNode ( ) ) -> add ( new PublicId ( 'id' ) ) -> add ( new Language ( 'lang' ) ) -> add ( $ this -> getModifiedSinceRule ( 'updated' ) ) ; return $ ruleSet ; } | Builds and returns a rule set to parse the root node |
37,430 | public function buildItemRuleSet ( ) : RuleSet { $ ruleSet = $ this -> buildFeedRuleSet ( ) ; $ ruleSet -> add ( new Author ( ) ) -> add ( new Description ( 'content' ) , [ 'summary' ] ) ; return $ ruleSet ; } | Builds and returns a rule set to parse an item |
37,431 | public function guessDateFormat ( string $ date ) : ? string { foreach ( $ this -> dateFormats as $ format ) { $ test = \ DateTime :: createFromFormat ( $ format , $ date ) ; if ( $ test instanceof \ DateTime ) { $ this -> lastGuessedFormat = $ format ; return $ format ; } } return null ; } | Tries to guess the date s format from the list |
37,432 | public function convertToDateTime ( string $ string ) : \ DateTime { $ string = trim ( $ string ) ; foreach ( [ $ this -> getLastGuessedFormat ( ) , $ this -> guessDateFormat ( $ string ) ] as $ format ) { $ date = $ this -> newDate ( ( string ) $ format , $ string ) ; if ( $ date instanceof \ DateTime ) { $ date -> se... | Creates a DateTime instance for the given string . Default format is RFC2822 |
37,433 | public function stringToDateTime ( string $ string ) : \ DateTime { $ this -> logger -> notice ( "unsupported date format, use strtotime() to build the DateTime instance : {$string}" ) ; if ( false === strtotime ( $ string ) ) { throw new \ InvalidArgumentException ( 'Impossible to convert date : ' . $ string ) ; } $ d... | Creates a DateTime instance for the given string if the format was not catch from the list |
37,434 | private function createConfigWrapper ( ) : ConfigWrapper { $ factory = new LazyLoadingValueHolderFactory ( ) ; $ initializer = function ( & $ wrappedObject , LazyLoadingInterface $ proxy , $ method , array $ parameters , & $ initializer ) { $ initializer = null ; $ wrappedObject = new ConfigWrapper ( $ this -> aggregat... | Create lazy loaded configuration . |
37,435 | public function transform ( $ value ) : ? string { if ( ! is_array ( $ value ) || empty ( $ value ) ) { return null ; } return implode ( ',' , array_column ( $ value , 'id' ) ) ; } | Transforms a domain specific Location objects into a Location s ID comma separated string . |
37,436 | public function reverseTransform ( $ value ) : ? array { if ( empty ( $ value ) ) { return [ ] ; } if ( ! is_string ( $ value ) ) { throw new TransformationFailedException ( 'Expected a string.' ) ; } $ value = explode ( ',' , $ value ) ; try { return array_map ( [ $ this -> locationService , 'loadLocation' ] , $ value... | Transforms a Location s ID string into a domain specific Location objects . |
37,437 | public function listAction ( Request $ request ) : Response { $ page = $ request -> query -> get ( 'page' ) ?? 1 ; $ pagerfanta = new Pagerfanta ( new ArrayAdapter ( $ this -> languageService -> loadLanguages ( ) ) ) ; $ pagerfanta -> setMaxPerPage ( $ this -> defaultPaginationLimit ) ; $ pagerfanta -> setCurrentPage (... | Renders the language list . |
37,438 | public function viewAction ( Language $ language ) : Response { $ deleteForm = $ this -> formFactory -> deleteLanguage ( new LanguageDeleteData ( $ language ) ) ; return $ this -> render ( '@ezdesign/admin/language/view.html.twig' , [ 'language' => $ language , 'deleteForm' => $ deleteForm -> createView ( ) , 'canEdit'... | Renders the view of a language . |
37,439 | public function deleteAction ( Request $ request , Language $ language ) : Response { $ form = $ this -> formFactory -> deleteLanguage ( new LanguageDeleteData ( $ language ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function (... | Deletes a language . |
37,440 | public function bulkDeleteAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> deleteLanguages ( new LanguagesDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( LanguagesDeleteData $ data... | Handles removing languages based on submitted form . |
37,441 | private function getTimePeriodChoices ( ) : array { $ choices = [ ] ; foreach ( $ this -> getTimePeriodField ( ) as $ label => $ value ) { $ choices [ $ label ] = $ value ; } return $ choices ; } | Generate time periods options available to choose . |
37,442 | private function getTimePeriodField ( ) : array { return [ $ this -> translator -> trans ( 'search.last_week' , [ ] , 'search' ) => 'P0Y0M7D' , $ this -> translator -> trans ( 'search.last_month' , [ ] , 'search' ) => 'P0Y1M0D' , $ this -> translator -> trans ( 'search.last_year' , [ ] , 'search' ) => 'P1Y0M0D' , $ thi... | Returns available time periods values . |
37,443 | public function mapConfig ( array $ enabledCustomStyles ) { $ config = [ ] ; foreach ( $ enabledCustomStyles as $ styleName ) { if ( ! isset ( $ this -> customStylesConfiguration [ $ styleName ] ) ) { throw new RuntimeException ( "RichText Custom Style configuration for {$styleName} not found." ) ; } $ customStyleConfi... | Map Configuration for the given list of enabled Custom Styles . |
37,444 | public function bulkDeleteAction ( Request $ request , Role $ role ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'role' , 'assign' ) ) ; $ form = $ this -> formFactory -> deleteRoleAssignments ( new RoleAssignmentsDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted... | Handles removing role assignments based on submitted form . |
37,445 | protected function getLanguagesPriority ( array $ languagesMap ) : array { $ priority = [ ] ; $ fallback = [ ] ; $ siteAccesses = $ this -> configResolver -> getParameter ( 'list' , 'ezpublish' , 'siteaccess' ) ; foreach ( $ siteAccesses as $ siteAccess ) { $ siteAccessLanguages = $ this -> configResolver -> getParamet... | Returns list of languages in a prioritized form . |
37,446 | public function createContentDraft ( FormActionEvent $ event ) : void { $ data = $ event -> getData ( ) ; if ( ! $ data instanceof ContentTranslationData ) { return ; } $ contentDraft = $ this -> contentService -> createContentDraft ( $ data -> content -> contentInfo ) ; $ fields = array_filter ( $ data -> fieldsData ,... | Creates content draft based in data submitted by the user and injects ContentUpdateData to the event . |
37,447 | public function viewSectionContentAction ( Section $ section , int $ page = 1 , int $ limit = 10 ) : Response { $ sectionContentAssignForm = $ this -> formFactory -> assignContentSectionForm ( new SectionContentAssignData ( $ section ) ) -> createView ( ) ; $ query = new Query ( ) ; $ query -> sortClauses [ ] = new Sor... | Fragment action which renders list of contents assigned to section . |
37,448 | public function bulkDeleteAction ( Request $ request ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'section' , 'edit' ) ) ; $ form = $ this -> formFactory -> deleteSections ( new SectionsDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this ... | Handles removing sections based on submitted form . |
37,449 | private function canUserAssignSectionToSomeContent ( Section $ section ) : bool { $ hasAccess = $ this -> permissionResolver -> hasAccess ( 'section' , 'assign' ) ; if ( is_bool ( $ hasAccess ) ) { return $ hasAccess ; } $ restrictedNewSections = $ this -> permissionChecker -> getRestrictions ( $ hasAccess , NewSection... | Specifies if the User has access to assigning a given Section to Content . |
37,450 | private function resolveProfilePictureField ( ApiUser $ user ) : ? Field { $ contentType = $ user -> getContentType ( ) ; foreach ( $ user -> getFields ( ) as $ field ) { $ fieldDef = $ contentType -> getFieldDefinition ( $ field -> fieldDefIdentifier ) ; if ( 'ezimage' === $ fieldDef -> fieldTypeIdentifier ) { return ... | Returns first occurrence of an ezimage fieldtype . |
37,451 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof ContentInfo ) { throw new TransformationFailedException ( 'Expected a ' . ContentInfo :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific ContentInfo object into a Content s ID . |
37,452 | public function isSatisfiedBy ( $ contentInfo ) : bool { $ versions = $ this -> contentService -> loadVersions ( $ contentInfo ) ; foreach ( $ versions as $ checkedVersionInfo ) { if ( $ checkedVersionInfo -> isDraft ( ) && $ checkedVersionInfo -> versionNo > $ contentInfo -> currentVersionNo && $ checkedVersionInfo ->... | Checks if Content has draft conflict . |
37,453 | public function map ( ValueObject $ value ) : PolicyUpdateData { $ data = new PolicyUpdateData ( ) ; $ data -> setModule ( $ value -> module ) ; $ data -> setFunction ( $ value -> function ) ; $ data -> setLimitations ( $ value -> getLimitations ( ) ) ; return $ data ; } | Maps given PolicyUpdateStruct object to a PolicyUpdateData object . |
37,454 | public function reverseMap ( $ data ) : PolicyUpdateStruct { $ policyUpdateStruct = new PolicyUpdateStruct ( ) ; foreach ( $ data -> getLimitations ( ) as $ limitation ) { if ( ! empty ( $ limitation -> limitationValues ) ) { $ policyUpdateStruct -> addLimitation ( $ limitation ) ; } } return $ policyUpdateStruct ; } | Maps given PolicyUpdateData object to a PolicyUpdateStruct object . |
37,455 | public function removeAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> removeLocation ( new ContentLocationRemoveData ( ) ) ; $ form -> handleRequest ( $ request ) ; $ contentInfo = $ form -> getData ( ) -> getContentInfo ( ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHan... | Handles removing locations assigned to content item based on submitted form . |
37,456 | public function addAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> addLocation ( new ContentLocationAddData ( ) ) ; $ form -> handleRequest ( $ request ) ; $ contentInfo = $ form -> getData ( ) -> getContentInfo ( ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> h... | Handles assigning new location to the content item based on submitted form . |
37,457 | public function updateVisibilityAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> updateVisibilityLocation ( ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && $ form -> isValid ( ) ) { $ data = $ form -> getData ( ) ; $ location = $ data -> getLocation ( ) ; $ hidde... | Handles toggling visibility location of a content item based on submitted form . |
37,458 | public function updateAction ( Request $ request ) : Response { $ form = $ this -> formFactory -> updateLocation ( ) ; $ form -> handleRequest ( $ request ) ; $ location = $ form -> getData ( ) -> getLocation ( ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( Loc... | Handles update existing location . |
37,459 | public function assignSectionAction ( Request $ request ) : Response { $ form = $ this -> createForm ( LocationAssignSectionType :: class , new LocationAssignSubtreeData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> submitHandler -> handle ( $ form , function ( ... | Handles assigning section to subtree . |
37,460 | public function map ( ValueObject $ value ) : PolicyCreateData { if ( ! $ value instanceof PolicyCreateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . PolicyCreateStruct :: class ) ; } $ data = new PolicyCreateData ( ) ; $ data -> setModule ( $ value -> module ) ; $ data -> setFunc... | Maps given PolicyCreateStruct object to a PolicyCreateData object . |
37,461 | public function reverseMap ( $ data ) : PolicyCreateStruct { if ( ! $ data instanceof PolicyCreateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . PolicyCreateData :: class ) ; } $ policyCreateStruct = new PolicyCreateStruct ( [ 'module' => $ data -> getModule ( ) , 'function' => $ dat... | Maps given PolicyCreateData object to a PolicyCreateStruct object . |
37,462 | public function bulkDeleteAction ( Request $ request ) : Response { $ this -> denyAccessUnlessGranted ( new Attribute ( 'role' , 'delete' ) ) ; $ form = $ this -> formFactory -> deleteRoles ( new RolesDeleteData ( ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) ) { $ result = $ this -> subm... | Handles removing roles based on submitted form . |
37,463 | public function listAction ( Request $ request ) : Response { $ data = new URLListData ( ) ; $ form = $ this -> formFactory -> createUrlListForm ( $ data , '' , [ 'method' => Request :: METHOD_GET , 'csrf_protection' => false , ] ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSubmitted ( ) && ! $ form -> ... | Renders the URLs list . |
37,464 | public function editAction ( Request $ request , int $ urlId ) : Response { $ url = $ this -> urlService -> loadById ( $ urlId ) ; $ form = $ this -> formFactory -> createUrlEditForm ( new URLUpdateData ( [ 'id' => $ url -> id , 'url' => $ url -> url , ] ) ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isSu... | Displays the edit form and processes it once submitted . |
37,465 | public function viewAction ( Request $ request , int $ urlId ) : Response { $ url = $ this -> urlService -> loadById ( $ urlId ) ; $ usages = new Pagerfanta ( new URLUsagesAdapter ( $ url , $ this -> urlService ) ) ; $ usages -> setCurrentPage ( $ request -> query -> getInt ( 'page' , 1 ) ) ; $ usages -> setMaxPerPage ... | Renders the view of a URL . |
37,466 | private function buildListQuery ( URLListData $ data ) : URLQuery { $ query = new URLQuery ( ) ; $ query -> sortClauses = [ new SortClause \ URL ( ) , ] ; $ criteria = [ new Criterion \ VisibleOnly ( ) , ] ; if ( $ data -> searchQuery !== null ) { $ criteria [ ] = new Criterion \ Pattern ( $ data -> searchQuery ) ; } i... | Builds URL criteria from list data . |
37,467 | protected function getUsers ( ) : array { return $ this -> repository -> sudo ( function ( Repository $ repository ) { $ query = new LocationQuery ( ) ; $ query -> filter = new ContentTypeIdentifier ( 'user' ) ; $ query -> offset = 0 ; $ query -> limit = 10 ; $ query -> performCount = true ; $ query -> sortClauses [ ] ... | Get users list . |
37,468 | public function loadContentLanguages ( Content $ content ) : array { $ contentLanguages = $ content -> versionInfo -> languageCodes ; $ filter = function ( Language $ language ) use ( $ contentLanguages ) { return $ language -> enabled && in_array ( $ language -> languageCode , $ contentLanguages , true ) ; } ; $ langu... | Loads system languages with filtering applied . |
37,469 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof User ) { throw new TransformationFailedException ( 'Expected a ' . User :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific User object into a Users s ID . |
37,470 | public function reverseTransform ( $ value ) : ? User { if ( empty ( $ value ) ) { return null ; } if ( ! is_numeric ( $ value ) ) { throw new TransformationFailedException ( 'Expected a numeric string.' ) ; } try { return $ this -> userService -> loadUser ( $ value ) ; } catch ( NotFoundException $ e ) { throw new Tra... | Transforms a Users s ID integer into a domain specific User object . |
37,471 | public function supply ( ContentView $ view ) { $ contentTypes = [ ] ; $ subitemsRows = [ ] ; $ location = $ view -> getLocation ( ) ; $ childrenCount = $ this -> locationService -> getLocationChildCount ( $ location ) ; $ subitemsLimit = ( int ) $ this -> userSettingService -> getUserSetting ( 'subitems_limit' ) -> va... | Fetches data for Subitems module to populate it with preloaded data . |
37,472 | public function clickListElement ( string $ name ) : void { $ this -> context -> getElementByText ( $ name , $ this -> fields [ 'listElement' ] ) -> click ( ) ; } | Click link element with given name . |
37,473 | public function isElementSelectable ( string $ name ) : bool { $ position = $ this -> context -> getElementPositionByText ( $ name , $ this -> fields [ 'listElement' ] ) ; $ checkbox = $ this -> context -> findElement ( sprintf ( $ this -> fields [ 'tableCell' ] , $ position , 1 ) . $ this -> fields [ 'checkboxInput' ]... | Check if checkbox left to link element if active . |
37,474 | private function humanize ( string $ text ) : string { $ replace = [ 'Content Type' ] ; $ search = [ 'class' ] ; return ucfirst ( trim ( str_replace ( $ search , $ replace , strtolower ( preg_replace ( [ '/([A-Z])/' , '/[_\s]+/' ] , [ '_$1' , ' ' ] , $ text ) ) ) ) ) ; } | Makes a technical name human readable . |
37,475 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof APIRole ) { throw new TransformationFailedException ( 'Expected a ' . APIRole :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific Role object into a Role identifier . |
37,476 | public function reverseTransform ( $ value ) : ? APIRole { if ( empty ( $ value ) ) { return null ; } try { return $ this -> roleService -> loadRole ( $ value ) ; } catch ( NotFoundException $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } } | Transforms a Role identifier into a domain specific Role object . |
37,477 | public function getContentTypeIcon ( string $ identifier ) : string { $ icon = $ this -> resolveIcon ( $ identifier ) ; $ fragment = null ; if ( strpos ( $ icon , '#' ) !== false ) { list ( $ icon , $ fragment ) = explode ( '#' , $ icon ) ; } return $ this -> packages -> getUrl ( $ icon ) . ( $ fragment ? '#' . $ fragm... | Returns path to content type icon . |
37,478 | public function clickListElement ( string $ name , ? string $ contentType = null ) : void { $ pagination = ElementFactory :: createElement ( $ this -> context , Pagination :: ELEMENT_NAME ) ; $ elementPositionInTable = $ this -> getElementPositionInTable ( $ name , $ contentType ) ; $ isElementInTable = ( bool ) $ elem... | Click link element for sub - item with given name . |
37,479 | public function mapConfig ( array $ enabledCustomTags ) { $ config = [ ] ; foreach ( $ enabledCustomTags as $ tagName ) { if ( ! isset ( $ this -> customTagsConfiguration [ $ tagName ] ) ) { throw new RuntimeException ( "RichText Custom Tag configuration for {$tagName} not found." ) ; } $ customTagConfiguration = $ thi... | Map Configuration for the given list of enabled Custom Tags . |
37,480 | private function getAttributeTypeMapper ( string $ tagName , string $ attributeName , string $ attributeType ) : AttributeMapper { if ( isset ( $ this -> supportedTagAttributeMappersCache [ $ attributeType ] ) ) { return $ this -> supportedTagAttributeMappersCache [ $ attributeType ] ; } foreach ( $ this -> customTagAt... | Get first available Custom Tag Attribute Type mapper . |
37,481 | private function translateLabels ( array $ config ) : array { foreach ( $ config as $ tagName => $ tagConfig ) { $ config [ $ tagName ] [ 'label' ] = $ this -> translator -> trans ( $ tagConfig [ 'label' ] , [ ] , $ this -> translationDomain ) ; $ config [ $ tagName ] [ 'description' ] = $ this -> translator -> trans (... | Process Custom Tags config and translate labels for UI . |
37,482 | private function isAssocArray ( $ item ) : bool { if ( ! is_array ( $ item ) ) { return false ; } if ( $ item === [ ] ) { return false ; } return array_keys ( $ item ) !== range ( 0 , count ( $ item ) - 1 ) ; } | Checks if item is associative array type . |
37,483 | public function verifyFieldHasValue ( string $ fieldName , $ value , ? string $ containerName = null ) : void { $ fieldElement = $ this -> getField ( $ fieldName , $ containerName ) ; Assert :: assertEquals ( $ value , $ fieldElement -> getValue ( ) , 'Field has wrong value' ) ; } | Verify that field values are set . |
37,484 | public function selectFieldDefinition ( string $ fieldName ) : void { $ this -> context -> findElement ( $ this -> fields [ 'fieldTypesList' ] , $ this -> defaultTimeout ) -> selectOption ( $ fieldName ) ; } | Select field definition with given name from select list . |
37,485 | public function verifyNewFieldDefinitionFormExists ( string $ fieldName ) : void { $ form = $ this -> context -> getElementByText ( sprintf ( $ this :: NEW_FIELD_TITLE_PATTERN , EzFieldElement :: getFieldInternalNameByName ( $ fieldName ) ) , $ this -> fields [ 'fieldDefinitionName' ] ) ; if ( $ form === null ) { throw... | Verifies that form container with new field definition of given name is visible . |
37,486 | public function clickButton ( string $ label , int $ indexOfButton = 0 ) : void { $ formButtons = $ this -> context -> findAllElements ( $ this -> fields [ 'button' ] , $ this -> context -> findElement ( $ this -> fields [ 'mainFormSection' ] ) ) ; $ filteredButtons = array_values ( array_filter ( $ formButtons , funct... | Click button with given label . |
37,487 | public function expandFieldDefinition ( string $ fieldName ) : void { $ container = $ this -> context -> findElement ( $ this -> getFieldDefinitionContainerLocator ( sprintf ( $ this :: NEW_FIELD_TITLE_PATTERN , EzFieldElement :: getFieldInternalNameByName ( $ fieldName ) ) ) ) ; Assert :: assertNotNull ( $ container ,... | Expand field definition if it is collapsed . |
37,488 | public function getFieldDefinitionContainerLocator ( string $ containerName ) : string { $ containerIndex = $ this -> context -> getElementPositionByText ( $ containerName , $ this -> fields [ 'fieldDefinitionName' ] ) ; return sprintf ( $ this -> fields [ 'fieldDefinitionContainer' ] , $ containerIndex ) ; } | Returns NodeElement that contains all fields for specified content type field type . |
37,489 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof Language ) { throw new TransformationFailedException ( 'Expected a ' . Language :: class . ' object.' ) ; } return $ value -> languageCode ; } | Transforms a domain specific Language object into a Language s ID . |
37,490 | protected function determineTargetUrl ( Request $ request ) { if ( ( new IsAdmin ( $ this -> siteAccessGroups ) ) -> isSatisfiedBy ( $ request -> attributes -> get ( 'siteaccess' ) ) ) { $ this -> options [ 'default_target_path' ] = $ this -> defaultTargetPath ; $ target = $ this -> getTargetPath ( $ request -> getSess... | Builds the target URL according to the defined options . Overwrites default page after login for admin siteaccess . |
37,491 | public function map ( ValueObject $ value ) : SectionUpdateData { if ( ! $ value instanceof SectionUpdateStruct ) { throw new InvalidArgumentException ( 'value' , 'must be an instance of ' . SectionUpdateStruct :: class ) ; } return new SectionUpdateData ( new Section ( [ 'identifier' => $ value -> identifier , 'name' ... | Maps given SectionUpdateStruct object to a SectionUpdateData object . |
37,492 | public function reverseMap ( $ data ) : SectionUpdateStruct { if ( ! $ data instanceof SectionUpdateData ) { throw new InvalidArgumentException ( 'data' , 'must be an instance of ' . SectionUpdateData :: class ) ; } return new SectionUpdateStruct ( [ 'name' => $ data -> getName ( ) , 'identifier' => $ data -> getIdenti... | Maps given SectionUpdateData object to a SectionUpdateStruct object . |
37,493 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof APILocation ) { throw new TransformationFailedException ( 'Expected a ' . APILocation :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific Location object into a Location s identifier . |
37,494 | public function reverseTransform ( $ value ) : ? APILocation { if ( empty ( $ value ) ) { return null ; } try { return $ this -> locationService -> loadLocation ( $ value ) ; } catch ( NotFoundException $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } } | Transforms a Location s ID into a domain specific Location object . |
37,495 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof APIRoleAssignment ) { throw new TransformationFailedException ( 'Expected a ' . APIRoleAssignment :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific RoleAssignment object into a RoleAssignment string . |
37,496 | public function reverseTransform ( $ value ) : ? APIRoleAssignment { if ( empty ( $ value ) ) { return null ; } try { return $ this -> roleService -> loadRoleAssignment ( $ value ) ; } catch ( NotFoundException $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } } | Transforms a RoleAssignment s ID into a domain specific RoleAssignment object . |
37,497 | private function processContentEditFormTemplates ( array $ formTemplates ) { $ priorities = array_column ( $ formTemplates , 'priority' ) ; array_multisort ( $ priorities , SORT_DESC , $ formTemplates ) ; return array_column ( $ formTemplates , 'template' ) ; } | Processes given prioritized list of templates sorts them according to their priorities and returns as a simple list of templates . |
37,498 | public function transform ( $ value ) { if ( null === $ value ) { return null ; } if ( ! $ value instanceof APISection ) { throw new TransformationFailedException ( 'Expected a ' . APISection :: class . ' object.' ) ; } return $ value -> id ; } | Transforms a domain specific Section object into a Section identifier . |
37,499 | public function reverseTransform ( $ value ) : ? APISection { if ( empty ( $ value ) ) { return null ; } try { return $ this -> sectionService -> loadSection ( $ value ) ; } catch ( NotFoundException $ e ) { throw new TransformationFailedException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } } | Transforms a Section identifier into a domain specific Section object . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.