idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
3,600
public function withShortName ( string $ shortName ) : self { $ metadata = clone $ this ; $ metadata -> shortName = $ shortName ; return $ metadata ; }
Returns a new instance with the given short name .
3,601
public function withIri ( string $ iri ) : self { $ metadata = clone $ this ; $ metadata -> iri = $ iri ; return $ metadata ; }
Returns a new instance with the given IRI .
3,602
public function getCollectionOperationAttribute ( ? string $ operationName , string $ key , $ defaultValue = null , bool $ resourceFallback = false ) { return $ this -> findOperationAttribute ( $ this -> collectionOperations , $ operationName , $ key , $ defaultValue , $ resourceFallback ) ; }
Gets a collection operation attribute optionally fallback to a resource attribute .
3,603
public function getItemOperationAttribute ( ? string $ operationName , string $ key , $ defaultValue = null , bool $ resourceFallback = false ) { return $ this -> findOperationAttribute ( $ this -> itemOperations , $ operationName , $ key , $ defaultValue , $ resourceFallback ) ; }
Gets an item operation attribute optionally fallback to a resource attribute .
3,604
public function getSubresourceOperationAttribute ( ? string $ operationName , string $ key , $ defaultValue = null , bool $ resourceFallback = false ) { return $ this -> findOperationAttribute ( $ this -> subresourceOperations , $ operationName , $ key , $ defaultValue , $ resourceFallback ) ; }
Gets a subresource operation attribute optionally fallback to a resource attribute .
3,605
public function getTypedOperationAttribute ( string $ operationType , string $ operationName , string $ key , $ defaultValue = null , bool $ resourceFallback = false ) { switch ( $ operationType ) { case OperationType :: COLLECTION : return $ this -> getCollectionOperationAttribute ( $ operationName , $ key , $ default...
Gets an attribute for a given operation type and operation name .
3,606
private function findOperationAttribute ( ? array $ operations , ? string $ operationName , string $ key , $ defaultValue , bool $ resourceFallback ) { if ( null !== $ operationName && isset ( $ operations [ $ operationName ] [ $ key ] ) ) { return $ operations [ $ operationName ] [ $ key ] ; } if ( $ resourceFallback ...
Gets an operation attribute optionally fallback to a resource attribute .
3,607
private function populateEntrypointProperties ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ shortName , string $ prefixedShortName , array & $ entrypointProperties ) { $ hydraCollectionOperations = $ this -> getHydraOperations ( $ resourceClass , $ resourceMetadata , $ prefixedShortName , tr...
Populates entrypoint properties .
3,608
private function getClass ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ shortName , string $ prefixedShortName , array $ context ) : array { $ class = [ '@id' => $ prefixedShortName , '@type' => 'hydra:Class' , 'rdfs:label' => $ shortName , 'hydra:title' => $ shortName , 'hydra:supportedProp...
Gets a Hydra class .
3,609
private function getPropertyNameCollectionFactoryContext ( ResourceMetadata $ resourceMetadata ) : array { $ attributes = $ resourceMetadata -> getAttributes ( ) ; $ context = [ ] ; if ( isset ( $ attributes [ 'normalization_context' ] [ AbstractNormalizer :: GROUPS ] ) ) { $ context [ 'serializer_groups' ] = ( array )...
Gets the context for the property name factory .
3,610
private function getHydraProperties ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ shortName , string $ prefixedShortName , array $ context ) : array { $ classes = [ ] ; foreach ( $ resourceMetadata -> getCollectionOperations ( ) as $ operationName => $ operation ) { $ inputMetadata = $ resou...
Gets Hydra properties .
3,611
private function getHydraOperations ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ prefixedShortName , bool $ collection ) : array { if ( null === $ operations = $ collection ? $ resourceMetadata -> getCollectionOperations ( ) : $ resourceMetadata -> getItemOperations ( ) ) { return [ ] ; } $...
Gets Hydra operations .
3,612
private function getRange ( PropertyMetadata $ propertyMetadata ) : ? string { $ jsonldContext = $ propertyMetadata -> getAttributes ( ) [ 'jsonld_context' ] ?? [ ] ; if ( isset ( $ jsonldContext [ '@type' ] ) ) { return $ jsonldContext [ '@type' ] ; } if ( null === $ type = $ propertyMetadata -> getType ( ) ) { return...
Gets the range of the property .
3,613
private function getClasses ( array $ entrypointProperties , array $ classes ) : array { $ classes [ ] = [ '@id' => '#Entrypoint' , '@type' => 'hydra:Class' , 'hydra:title' => 'The API entrypoint' , 'hydra:supportedProperty' => $ entrypointProperties , 'hydra:supportedOperation' => [ '@type' => 'hydra:Operation' , 'hyd...
Builds the classes array .
3,614
private function getProperty ( PropertyMetadata $ propertyMetadata , string $ propertyName , string $ prefixedShortName , string $ shortName ) : array { $ propertyData = [ '@id' => $ propertyMetadata -> getIri ( ) ?? "#$shortName/$propertyName" , '@type' => $ propertyMetadata -> isReadableLink ( ) ? 'rdf:Property' : 'h...
Gets a property definition .
3,615
private function computeDoc ( Documentation $ object , array $ classes ) : array { $ doc = [ '@context' => $ this -> getContext ( ) , '@id' => $ this -> urlGenerator -> generate ( 'api_doc' , [ '_format' => self :: FORMAT ] ) , '@type' => 'hydra:ApiDocumentation' ] ; if ( '' !== $ object -> getTitle ( ) ) { $ doc [ 'hy...
Computes the documentation .
3,616
private function getContext ( ) : array { return [ '@vocab' => $ this -> urlGenerator -> generate ( 'api_doc' , [ '_format' => self :: FORMAT ] , UrlGeneratorInterface :: ABS_URL ) . '#' , 'hydra' => ContextBuilderInterface :: HYDRA_NS , 'rdf' => ContextBuilderInterface :: RDF_NS , 'rdfs' => ContextBuilderInterface :: ...
Builds the JSON - LD context for the API documentation .
3,617
protected function isIdentifier ( string $ resourceClass , string $ property ) : bool { return $ property === $ this -> identifierExtractor -> getIdentifierFromResourceClass ( $ resourceClass ) ; }
Is the given property of the given resource class an identifier?
3,618
private function getManager ( $ data ) : ? DoctrineObjectManager { return \ is_object ( $ data ) ? $ this -> managerRegistry -> getManagerForClass ( $ this -> getObjectClass ( $ data ) ) : null ; }
Gets the Doctrine object manager associated with given data .
3,619
private function isDeferredExplicit ( DoctrineObjectManager $ manager , $ data ) : bool { $ classMetadata = $ manager -> getClassMetadata ( $ this -> getObjectClass ( $ data ) ) ; if ( $ classMetadata instanceof ClassMetadataInfo && method_exists ( $ classMetadata , 'isChangeTrackingDeferredExplicit' ) ) { return $ cla...
Checks if doctrine does not manage data automatically .
3,620
public function preUpdate ( PreUpdateEventArgs $ eventArgs ) : void { $ object = $ eventArgs -> getObject ( ) ; $ this -> gatherResourceAndItemTags ( $ object , true ) ; $ changeSet = $ eventArgs -> getEntityChangeSet ( ) ; $ associationMappings = $ eventArgs -> getEntityManager ( ) -> getClassMetadata ( ClassUtils :: ...
Collects tags from the previous and the current version of the updated entities to purge related documents .
3,621
public function onFlush ( OnFlushEventArgs $ eventArgs ) : void { $ em = $ eventArgs -> getEntityManager ( ) ; $ uow = $ em -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { $ this -> gatherResourceAndItemTags ( $ entity , false ) ; $ this -> gatherRelationTags ( $ em , $ entity...
Collects tags from inserted and deleted entities including relations .
3,622
public function postFlush ( ) : void { if ( empty ( $ this -> tags ) ) { return ; } $ this -> purger -> purge ( $ this -> tags ) ; $ this -> tags = [ ] ; }
Purges tags collected during this request and clears the tag list .
3,623
public function onKernelResponse ( FilterResponseEvent $ event ) : void { $ request = $ event -> getRequest ( ) ; $ response = $ event -> getResponse ( ) ; if ( ! $ request -> isMethodCacheable ( ) || ! $ response -> isCacheable ( ) || ( ! $ attributes = RequestAttributesExtractor :: extractAttributes ( $ request ) ) )...
Adds the Cache - Tags header .
3,624
protected function addMatch ( Builder $ aggregationBuilder , string $ field , string $ matchField , string $ operator , string $ value ) { switch ( $ operator ) { case self :: PARAMETER_BETWEEN : $ rangeValue = explode ( '..' , $ value ) ; $ rangeValue = $ this -> normalizeBetweenValues ( $ rangeValue ) ; if ( null ===...
Adds the match stage according to the operator .
3,625
protected function addWhere ( QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator , string $ alias , string $ field , string $ operator , string $ value , string $ nullManagement = null , $ type = null ) { $ type = ( string ) $ type ; try { $ value = false === strpos ( $ type , '_immutable' )...
Adds the where clause according to the chosen null management .
3,626
public static function addJoinOnce ( QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator , string $ alias , string $ association , string $ joinType = null , string $ conditionType = null , string $ condition = null , string $ originAlias = null ) : string { $ join = self :: getExistingJoin (...
Adds a join to the QueryBuilder if none exists .
3,627
public static function getEntityClassByAlias ( string $ alias , QueryBuilder $ queryBuilder , ManagerRegistry $ managerRegistry ) : string { if ( ! \ in_array ( $ alias , $ queryBuilder -> getAllAliases ( ) , true ) ) { throw new \ LogicException ( sprintf ( 'The alias "%s" does not exist in the QueryBuilder.' , $ alia...
Gets the entity class name by an alias used in the QueryBuilder .
3,628
public static function findRootAlias ( string $ alias , QueryBuilder $ queryBuilder ) : string { if ( \ in_array ( $ alias , $ queryBuilder -> getRootAliases ( ) , true ) ) { return $ alias ; } foreach ( $ queryBuilder -> getDQLPart ( 'join' ) as $ rootAlias => $ joins ) { foreach ( $ joins as $ join ) { if ( $ alias =...
Finds the root alias for an alias used in the QueryBuilder .
3,629
public static function traverseJoins ( string $ alias , QueryBuilder $ queryBuilder , ManagerRegistry $ managerRegistry ) : \ Generator { $ rootAliasMap = self :: mapRootAliases ( $ queryBuilder -> getRootAliases ( ) , $ queryBuilder -> getRootEntities ( ) ) ; $ joinParts = $ queryBuilder -> getDQLPart ( 'join' ) ; $ r...
Traverses through the joins for an alias used in the QueryBuilder .
3,630
private static function getExistingJoin ( QueryBuilder $ queryBuilder , string $ alias , string $ association , string $ originAlias = null ) : ? Join { $ parts = $ queryBuilder -> getDQLPart ( 'join' ) ; $ rootAlias = $ originAlias ?? $ queryBuilder -> getRootAliases ( ) [ 0 ] ; if ( ! isset ( $ parts [ $ rootAlias ] ...
Gets the existing join from QueryBuilder DQL parts .
3,631
private static function mapRootAliases ( array $ rootAliases , array $ rootEntities ) : array { $ aliasMap = array_combine ( $ rootAliases , $ rootEntities ) ; if ( false === $ aliasMap ) { throw new \ LogicException ( 'Number of root aliases and root entities do not match.' ) ; } return $ aliasMap ; }
Maps the root aliases to root entity classes .
3,632
private static function mapJoinAliases ( iterable $ joins ) : array { $ aliasMap = [ ] ; foreach ( $ joins as $ join ) { $ alias = $ join -> getAlias ( ) ; $ relationship = $ join -> getJoin ( ) ; if ( false !== strpos ( $ relationship , '.' ) ) { $ aliasMap [ $ alias ] = explode ( '.' , $ relationship ) ; } else { $ a...
Maps the join aliases to the parent alias and association or the entity class .
3,633
private function getOperationFormats ( array $ annotationFormats ) : array { $ resourceFormats = [ ] ; foreach ( $ annotationFormats as $ format => $ value ) { if ( ! is_numeric ( $ format ) ) { $ resourceFormats [ $ format ] = ( array ) $ value ; continue ; } if ( ! \ is_string ( $ value ) ) { throw new InvalidArgumen...
Filter and populate the acceptable formats .
3,634
private function isNestedField ( string $ resourceClass , string $ property ) : bool { return null !== $ this -> getNestedFieldPath ( $ resourceClass , $ property ) ; }
Is the decomposed given property of the given resource class potentially mapped as a nested field in Elasticsearch?
3,635
private function shouldOperationForceEager ( string $ resourceClass , array $ options ) : bool { return $ this -> getBooleanOperationAttribute ( $ resourceClass , $ options , 'force_eager' , $ this -> forceEager ) ; }
Checks if an operation has a force_eager attribute .
3,636
private function shouldOperationFetchPartial ( string $ resourceClass , array $ options ) : bool { return $ this -> getBooleanOperationAttribute ( $ resourceClass , $ options , 'fetch_partial' , $ this -> fetchPartial ) ; }
Checks if an operation has a fetch_partial attribute .
3,637
private function getBooleanOperationAttribute ( string $ resourceClass , array $ options , string $ attributeName , bool $ default ) : bool { $ resourceMetadata = $ this -> resourceMetadataFactory -> create ( $ resourceClass ) ; if ( isset ( $ options [ 'collection_operation_name' ] ) ) { $ attribute = $ resourceMetada...
Get the boolean attribute of an operation or the resource metadata .
3,638
private function hasFetchEagerAssociation ( EntityManager $ em , ClassMetadataInfo $ classMetadata , array & $ checked = [ ] ) : bool { $ checked [ ] = $ classMetadata -> name ; foreach ( $ classMetadata -> getAssociationMappings ( ) as $ mapping ) { if ( ClassMetadataInfo :: FETCH_EAGER === $ mapping [ 'fetch' ] ) { r...
Checks if the class has an associationMapping with FETCH = EAGER .
3,639
private function normalizeIdentifiers ( $ id , ObjectManager $ manager , string $ resourceClass ) : array { $ identifierValues = [ $ id ] ; $ doctrineClassMetadata = $ manager -> getClassMetadata ( $ resourceClass ) ; $ doctrineIdentifierFields = $ doctrineClassMetadata -> getIdentifier ( ) ; $ isOrm = $ manager instan...
Transform and check the identifier composite or not .
3,640
public function getGroupId ( ) { if ( ! $ this -> isGroupEvent ( ) ) { throw new InvalidEventSourceException ( 'This event source is not a group type' ) ; } return isset ( $ this -> event [ 'source' ] [ 'groupId' ] ) ? $ this -> event [ 'source' ] [ 'groupId' ] : null ; }
Returns group ID of the event .
3,641
public function getRoomId ( ) { if ( ! $ this -> isRoomEvent ( ) ) { throw new InvalidEventSourceException ( 'This event source is not a room type' ) ; } return isset ( $ this -> event [ 'source' ] [ 'roomId' ] ) ? $ this -> event [ 'source' ] [ 'roomId' ] : null ; }
Returns room ID of the event .
3,642
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ locationMessage = [ 'type' => MessageType :: LOCATION , 'title' => $ this -> title , 'address' => $ this -> address , 'latitude' => $ this -> latitude , 'longitude' => $ this -> longitude , ] ; if ( $ this -> quickR...
Builds location message structure .
3,643
public function replyMessage ( $ replyToken , MessageBuilder $ messageBuilder ) { return $ this -> httpClient -> post ( $ this -> endpointBase . '/v2/bot/message/reply' , [ 'replyToken' => $ replyToken , 'messages' => $ messageBuilder -> buildMessage ( ) , ] ) ; }
Replies arbitrary message to destination which is associated with reply token .
3,644
public function pushMessage ( $ to , MessageBuilder $ messageBuilder ) { return $ this -> httpClient -> post ( $ this -> endpointBase . '/v2/bot/message/push' , [ 'to' => $ to , 'messages' => $ messageBuilder -> buildMessage ( ) , ] ) ; }
Sends arbitrary message to destination .
3,645
public function multicast ( array $ tos , MessageBuilder $ messageBuilder ) { return $ this -> httpClient -> post ( $ this -> endpointBase . '/v2/bot/message/multicast' , [ 'to' => $ tos , 'messages' => $ messageBuilder -> buildMessage ( ) , ] ) ; }
Sends arbitrary message to multi destinations .
3,646
public function parseEventRequest ( $ body , $ signature , $ eventOnly = true ) { return EventRequestParser :: parseEventRequest ( $ body , $ this -> channelSecret , $ signature , $ eventOnly ) ; }
Parse event request to Event objects .
3,647
public function getGroupMemberProfile ( $ groupId , $ userId ) { $ url = sprintf ( '%s/v2/bot/group/%s/member/%s' , $ this -> endpointBase , urlencode ( $ groupId ) , urlencode ( $ userId ) ) ; return $ this -> httpClient -> get ( $ url , [ ] ) ; }
Gets the user profile of a member of a group that the bot is in . This can be the user ID of a user who has not added the bot as a friend or has blocked the bot .
3,648
public function getRoomMemberProfile ( $ roomId , $ userId ) { $ url = sprintf ( '%s/v2/bot/room/%s/member/%s' , $ this -> endpointBase , urlencode ( $ roomId ) , urlencode ( $ userId ) ) ; return $ this -> httpClient -> get ( $ url , [ ] ) ; }
Gets the user profile of a member of a room that the bot is in . This can be the user ID of a user who has not added the bot as a friend or has blocked the bot .
3,649
public function getGroupMemberIds ( $ groupId , $ start = null ) { $ url = sprintf ( '%s/v2/bot/group/%s/members/ids' , $ this -> endpointBase , urlencode ( $ groupId ) ) ; $ params = is_null ( $ start ) ? [ ] : [ 'start' => $ start ] ; return $ this -> httpClient -> get ( $ url , $ params ) ; }
Gets the user IDs of the members of a group that the bot is in . This includes the user IDs of users who have not added the bot as a friend or has blocked the bot .
3,650
public function getRoomMemberIds ( $ roomId , $ start = null ) { $ url = sprintf ( '%s/v2/bot/room/%s/members/ids' , $ this -> endpointBase , urlencode ( $ roomId ) ) ; $ params = is_null ( $ start ) ? [ ] : [ 'start' => $ start ] ; return $ this -> httpClient -> get ( $ url , $ params ) ; }
Gets the user IDs of the members of a room that the bot is in . This includes the user IDs of users who have not added the bot as a friend or has blocked the bot .
3,651
public function createLinkToken ( $ userId ) { $ url = sprintf ( '%s/v2/bot/user/%s/linkToken' , $ this -> endpointBase , urlencode ( $ userId ) ) ; return $ this -> httpClient -> post ( $ url , [ ] ) ; }
Issues a link token used for the account link feature .
3,652
public function deleteRichMenu ( $ richMenuId ) { $ url = sprintf ( '%s/v2/bot/richmenu/%s' , $ this -> endpointBase , urlencode ( $ richMenuId ) ) ; return $ this -> httpClient -> delete ( $ url ) ; }
Deletes a rich menu .
3,653
public function getRichMenuId ( $ userId ) { $ url = sprintf ( '%s/v2/bot/user/%s/richmenu' , $ this -> endpointBase , urlencode ( $ userId ) ) ; return $ this -> httpClient -> get ( $ url , [ ] ) ; }
Gets the ID of the rich menu linked to a user .
3,654
public function linkRichMenu ( $ userId , $ richMenuId ) { $ url = sprintf ( '%s/v2/bot/user/%s/richmenu/%s' , $ this -> endpointBase , urlencode ( $ userId ) , urlencode ( $ richMenuId ) ) ; return $ this -> httpClient -> post ( $ url , [ ] ) ; }
Links a rich menu to a user . Only one rich menu can be linked to a user at one time .
3,655
public function bulkLinkRichMenu ( $ userIds , $ richMenuId ) { $ url = $ this -> endpointBase . '/v2/bot/richmenu/bulk/link' ; return $ this -> httpClient -> post ( $ url , [ 'richMenuId' => $ richMenuId , 'userIds' => $ userIds ] ) ; }
Links a rich menu to multiple users .
3,656
public function unlinkRichMenu ( $ userId ) { $ url = sprintf ( '%s/v2/bot/user/%s/richmenu' , $ this -> endpointBase , urlencode ( $ userId ) ) ; return $ this -> httpClient -> delete ( $ url ) ; }
Unlinks a rich menu from multiple user .
3,657
public function bulkUnlinkRichMenu ( $ userIds ) { $ url = $ this -> endpointBase . '/v2/bot/richmenu/bulk/unlink' ; return $ this -> httpClient -> post ( $ url , [ 'userIds' => $ userIds ] ) ; }
Unlinks rich menus from multiple users .
3,658
public function downloadRichMenuImage ( $ richMenuId ) { $ url = sprintf ( '%s/v2/bot/richmenu/%s/content' , $ this -> endpointBase , urlencode ( $ richMenuId ) ) ; return $ this -> httpClient -> get ( $ url ) ; }
Downloads an image associated with a rich menu .
3,659
public function uploadRichMenuImage ( $ richMenuId , $ imagePath , $ contentType ) { $ url = sprintf ( '%s/v2/bot/richmenu/%s/content' , $ this -> endpointBase , urlencode ( $ richMenuId ) ) ; return $ this -> httpClient -> post ( $ url , [ '__file' => $ imagePath , '__type' => $ contentType , ] , [ "Content-Type: $con...
Uploads and attaches an image to a rich menu .
3,660
public function getNumberOfSentReplyMessages ( DateTime $ datetime ) { $ url = $ this -> endpointBase . '/v2/bot/message/delivery/reply' ; $ datetime -> setTimezone ( new DateTimeZone ( 'Asia/Tokyo' ) ) ; return $ this -> httpClient -> get ( $ url , [ 'date' => $ datetime -> format ( 'Ymd' ) ] ) ; }
Get number of sent reply messages
3,661
public function build ( ) { if ( isset ( $ this -> style ) ) { return $ this -> style ; } $ this -> style = BuildUtil :: removeNullElements ( [ 'backgroundColor' => $ this -> backgroundColor , 'separator' => $ this -> separator , 'separatorColor' => $ this -> separatorColor , ] ) ; return $ this -> style ; }
Builds block style structure .
3,662
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: IMAGE , 'url' => $ this -> url , 'flex' => $ this -> flex , 'margin' => $ this -> margin , 'align' => $ this -> align , 'gravity' => $ th...
Builds image component structure .
3,663
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: TEXT , 'text' => $ this -> text , 'flex' => $ this -> flex , 'margin' => $ this -> margin , 'size' => $ this -> size , 'align' => $ this ...
Builds text component structure .
3,664
public function buildTemplate ( ) { if ( ! empty ( $ this -> template ) ) { return $ this -> template ; } $ actions = [ ] ; foreach ( $ this -> actionBuilders as $ actionBuilder ) { $ actions [ ] = $ actionBuilder -> buildTemplateAction ( ) ; } $ this -> template = [ 'thumbnailImageUrl' => $ this -> thumbnailImageUrl ,...
Builds column of carousel template structure .
3,665
public function build ( ) { if ( ! empty ( $ this -> container ) ) { return $ this -> container ; } $ this -> container = BuildUtil :: removeNullElements ( [ 'type' => ContainerType :: BUBBLE , 'direction' => $ this -> direction , 'header' => BuildUtil :: build ( $ this -> headerComponentBuilder ) , 'hero' => BuildUtil...
Builds bubble container structure .
3,666
public function buildTemplate ( ) { if ( ! empty ( $ this -> template ) ) { return $ this -> template ; } $ actions = [ ] ; foreach ( $ this -> actionBuilders as $ actionBuilder ) { $ actions [ ] = $ actionBuilder -> buildTemplateAction ( ) ; } $ this -> template = [ 'type' => TemplateType :: BUTTONS , 'text' => $ this...
Builds button template message structure .
3,667
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: SEPARATOR , 'margin' => $ this -> margin , 'color' => $ this -> color , ] ) ; return $ this -> component ; }
Builds separator component structure .
3,668
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } foreach ( $ this -> texts as $ text ) { $ this -> message [ ] = [ 'type' => MessageType :: TEXT , 'text' => $ text , ] ; } if ( $ this -> quickReply ) { $ lastKey = count ( $ this -> message ) - 1 ; $ this -> message ...
Builds text message structure .
3,669
public function build ( ) { if ( isset ( $ this -> styles ) ) { return $ this -> styles ; } $ this -> styles = BuildUtil :: removeNullElements ( [ 'header' => BuildUtil :: build ( $ this -> headerStyleBuilder ) , 'hero' => BuildUtil :: build ( $ this -> heroStyleBuilder ) , 'body' => BuildUtil :: build ( $ this -> body...
Builds bubble styles structure .
3,670
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ sticker = [ 'type' => MessageType :: STICKER , 'packageId' => $ this -> packageId , 'stickerId' => $ this -> stickerId , ] ; if ( $ this -> quickReply ) { $ sticker [ 'quickReply' ] = $ this -> quickReply -> buildQu...
Builds sticker message structure .
3,671
public function build ( ) { $ video = [ 'originalContentUrl' => $ this -> originalContentUrl , 'previewImageUrl' => $ this -> previewImageUrl , 'area' => $ this -> areaBuilder -> build ( ) ] ; if ( $ this -> externalLinkBuilder ) { $ video [ 'externalLink' ] = $ this -> externalLinkBuilder -> build ( ) ; } return $ vid...
Builds video of imagemap .
3,672
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ audioMessage = [ 'type' => MessageType :: AUDIO , 'originalContentUrl' => $ this -> originalContentUrl , 'duration' => $ this -> duration , ] ; if ( $ this -> quickReply ) { $ audioMessage [ 'quickReply' ] = $ this ...
Build audio message structure .
3,673
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ imageMessage = [ 'type' => MessageType :: IMAGE , 'originalContentUrl' => $ this -> originalContentUrl , 'previewImageUrl' => $ this -> previewImageUrl , ] ; if ( $ this -> quickReply ) { $ imageMessage [ 'quickRepl...
Builds image message structure .
3,674
public function buildTemplate ( ) { if ( ! empty ( $ this -> template ) ) { return $ this -> template ; } $ actions = [ ] ; foreach ( $ this -> actionBuilders as $ actionBuilder ) { $ actions [ ] = $ actionBuilder -> buildTemplateAction ( ) ; } $ this -> template = [ 'type' => TemplateType :: CONFIRM , 'text' => $ this...
Builds confirm template structure .
3,675
public function get ( $ url , array $ data = [ ] , array $ headers = [ ] ) { if ( $ data ) { $ url .= '?' . http_build_query ( $ data ) ; } return $ this -> sendRequest ( 'GET' , $ url , $ headers ) ; }
Sends GET request to LINE Messaging API .
3,676
public function post ( $ url , array $ data , array $ headers = null ) { $ headers = is_null ( $ headers ) ? [ 'Content-Type: application/json; charset=utf-8' ] : $ headers ; return $ this -> sendRequest ( 'POST' , $ url , $ headers , $ data ) ; }
Sends POST request to LINE Messaging API .
3,677
public function buildTemplate ( ) { if ( ! empty ( $ this -> template ) ) { return $ this -> template ; } $ this -> template = [ 'imageUrl' => $ this -> imageUrl , 'action' => $ this -> actionBuilder -> buildTemplateAction ( ) , ] ; return $ this -> template ; }
Builds column of image carousel template structure .
3,678
public function buildTemplateAction ( ) { return [ 'type' => ActionType :: DATETIME_PICKER , 'label' => $ this -> label , 'data' => $ this -> data , 'mode' => $ this -> mode , 'initial' => $ this -> initial , 'max' => $ this -> max , 'min' => $ this -> min , ] ; }
Builds datetime picker action structure .
3,679
public function buildTemplateAction ( ) { $ templateAction = BuildUtil :: removeNullElements ( [ 'type' => ActionType :: URI , 'label' => $ this -> label , 'uri' => $ this -> uri , ] ) ; if ( $ this -> altUri ) { $ templateAction [ 'altUri' ] = $ this -> altUri -> build ( ) ; } return $ templateAction ; }
Builds URI action structure .
3,680
public static function validateSignature ( $ body , $ channelSecret , $ signature ) { if ( ! isset ( $ signature ) ) { throw new InvalidSignatureException ( 'Signature must not be empty' ) ; } return hash_equals ( base64_encode ( hash_hmac ( 'sha256' , $ body , $ channelSecret , true ) ) , $ signature ) ; }
Validate request with signature .
3,681
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: ICON , 'url' => $ this -> url , 'margin' => $ this -> margin , 'size' => $ this -> size , 'aspectRatio' => $ this -> aspectRatio , ] ) ; ...
Builds icon component structure .
3,682
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: SPACER , 'size' => $ this -> size , ] ) ; return $ this -> component ; }
Builds spacer component structure .
3,683
public static function get ( ) { return FlexMessageBuilder :: builder ( ) -> setAltText ( 'Shopping' ) -> setContents ( new CarouselContainerBuilder ( [ self :: createItemBubble ( 111 ) , self :: createItemBubble ( 112 ) , self :: createMoreBubble ( ) ] ) ) ; }
Create sample shopping flex message
3,684
public function buildQuickReply ( ) { if ( ! empty ( $ this -> quickReply ) ) { return $ this -> quickReply ; } $ items = [ ] ; foreach ( $ this -> buttonBuilders as $ buttonBuilder ) { $ items [ ] = $ buttonBuilder -> buildQuickReplyButton ( ) ; } $ this -> quickReply = [ 'items' => $ items ] ; return $ this -> quickR...
Builds button of quick reply structure .
3,685
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ contents = array_map ( function ( $ componentBuilder ) { return $ componentBuilder -> build ( ) ; } , $ this -> componentBuilders ) ; $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: B...
Builds box component structure .
3,686
public static function get ( ) { return FlexMessageBuilder :: builder ( ) -> setAltText ( 'Restaurant' ) -> setContents ( BubbleContainerBuilder :: builder ( ) -> setHero ( self :: createHeroBlock ( ) ) -> setBody ( self :: createBodyBlock ( ) ) -> setFooter ( self :: createFooterBlock ( ) ) ) ; }
Create sample restaurant flex message
3,687
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ actions = [ ] ; foreach ( $ this -> imagemapActionBuilders as $ builder ) { $ actions [ ] = $ builder -> buildImagemapAction ( ) ; } $ imagemapMessage = [ 'type' => MessageType :: IMAGEMAP , 'baseUrl' => $ this -> b...
Builds imagemap message strucutre .
3,688
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ templateMessage = [ 'type' => MessageType :: TEMPLATE , 'altText' => $ this -> altText , 'template' => $ this -> templateBuilder -> buildTemplate ( ) , ] ; if ( $ this -> quickReply ) { $ templateMessage [ 'quickRep...
Builds template message structure .
3,689
public function buildMessage ( ) { if ( isset ( $ this -> message ) ) { return $ this -> message ; } $ this -> message = [ BuildUtil :: removeNullElements ( [ 'type' => MessageType :: FLEX , 'altText' => $ this -> altText , 'contents' => $ this -> containerBuilder -> build ( ) , 'quickReply' => BuildUtil :: build ( $ t...
Builds flex message structure .
3,690
public function build ( ) { if ( isset ( $ this -> component ) ) { return $ this -> component ; } $ this -> component = BuildUtil :: removeNullElements ( [ 'type' => ComponentType :: BUTTON , 'action' => $ this -> actionBuilder -> buildTemplateAction ( ) , 'flex' => $ this -> flex , 'margin' => $ this -> margin , 'heig...
Builds button component structure .
3,691
public function buildMessage ( ) { if ( ! empty ( $ this -> message ) ) { return $ this -> message ; } $ video = [ 'type' => MessageType :: VIDEO , 'originalContentUrl' => $ this -> originalContentUrl , 'previewImageUrl' => $ this -> previewImageUrl , ] ; if ( $ this -> quickReply ) { $ video [ 'quickReply' ] = $ this ...
Builds video message structure .
3,692
public function buildTemplateAction ( ) { $ action = [ 'type' => ActionType :: POSTBACK , 'label' => $ this -> label , 'data' => $ this -> data , ] ; if ( isset ( $ this -> displayText ) ) { $ action [ 'displayText' ] = $ this -> displayText ; } return $ action ; }
Builds postback action structure .
3,693
public function build ( ) { if ( ! empty ( $ this -> container ) ) { return $ this -> container ; } $ contents = array_map ( function ( $ containerBuilder ) { return $ containerBuilder -> build ( ) ; } , $ this -> containerBuilders ) ; $ this -> container = [ 'type' => ContainerType :: CAROUSEL , 'contents' => $ conten...
Builds carousel container structure .
3,694
public static function create ( array $ associativeArray ) : Subscription { if ( array_key_exists ( 'keys' , $ associativeArray ) && is_array ( $ associativeArray [ 'keys' ] ) ) { return new self ( $ associativeArray [ 'endpoint' ] , $ associativeArray [ 'keys' ] [ 'p256dh' ] ?? null , $ associativeArray [ 'keys' ] [ '...
Subscription factory .
3,695
public static function getVapidHeaders ( string $ audience , string $ subject , string $ publicKey , string $ privateKey , string $ contentEncoding , ? int $ expiration = null ) { $ expirationLimit = time ( ) + 43200 ; if ( null === $ expiration || $ expiration > $ expirationLimit ) { $ expiration = $ expirationLimit ;...
This method takes the required VAPID parameters and returns the required header to be added to a Web Push Protocol Request .
3,696
public static function createVapidKeys ( ) : array { $ curve = NistCurve :: curve256 ( ) ; $ privateKey = $ curve -> createPrivateKey ( ) ; $ publicKey = $ curve -> createPublicKey ( $ privateKey ) ; $ binaryPublicKey = hex2bin ( Utils :: serializePublicKey ( $ publicKey ) ) ; if ( ! $ binaryPublicKey ) { throw new \ E...
This method creates VAPID keys in case you would not be able to have a Linux bash . DO NOT create keys at each initialization! Save those keys and reuse them .
3,697
public function flush ( ? int $ batchSize = null ) : \ Generator { if ( null === $ this -> notifications || empty ( $ this -> notifications ) ) { yield from [ ] ; return ; } if ( null === $ batchSize ) { $ batchSize = $ this -> defaultOptions [ 'batchSize' ] ; } $ batches = array_chunk ( $ this -> notifications , $ bat...
Flush notifications . Triggers the requests .
3,698
protected function createRelationshipFunction ( & $ stub , $ relationshipName , $ relationshipType , $ argsString ) { $ tabIndent = ' ' ; $ code = "public function " . $ relationshipName . "()\n" . $ tabIndent . "{\n" . $ tabIndent . $ tabIndent . "return \$this->" . $ relationshipType . "(" . $ argsString . ");" . ...
Create the code for a model relationship
3,699
protected function processJSONForeignKeys ( $ file ) { $ json = File :: get ( $ file ) ; $ fields = json_decode ( $ json ) ; if ( ! property_exists ( $ fields , 'foreign_keys' ) ) { return '' ; } $ foreignKeysString = '' ; foreach ( $ fields -> foreign_keys as $ foreign_key ) { $ foreignKeysString .= $ foreign_key -> c...
Process the JSON Foreign keys .