idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
14,300
public function deleteAction ( Request $ request , $ id ) { $ mediaManager = $ this -> get ( 'opifer.media.media_manager' ) ; $ media = $ mediaManager -> getRepository ( ) -> find ( $ id ) ; $ dispatcher = $ this -> get ( 'event_dispatcher' ) ; $ event = new MediaResponseEvent ( $ media , $ request ) ; $ dispatcher -> dispatch ( OpiferMediaEvents :: MEDIA_CONTROLLER_DELETE , $ event ) ; if ( null !== $ event -> getResponse ( ) ) { return $ event -> getResponse ( ) ; } $ mediaManager -> remove ( $ media ) ; return $ this -> redirectToRoute ( 'opifer_media_media_index' ) ; }
Deletes a media item .
14,301
public function getSortedValues ( $ order = 'asc' ) { $ values = $ this -> values -> toArray ( ) ; usort ( $ values , function ( $ a , $ b ) use ( $ order ) { $ left = $ a -> getAttribute ( ) -> getSort ( ) ; $ right = $ b -> getAttribute ( ) -> getSort ( ) ; if ( $ order == 'desc' ) { return ( $ left < $ right ) ? 1 : - 1 ; } return ( $ left > $ right ) ? 1 : - 1 ; } ) ; return $ values ; }
Get Sorted Values
14,302
public function getNamedValues ( $ order = 'asc' ) { $ values = $ this -> getSortedValues ( $ order ) ; $ valueArray = [ ] ; foreach ( $ values as $ value ) { $ valueArray [ $ value -> getAttribute ( ) -> getName ( ) ] = $ value ; } return $ valueArray ; }
Get Named Values
14,303
public function has ( $ value ) { if ( ! is_string ( $ value ) && ! is_array ( $ value ) ) { throw new \ InvalidArgumentException ( 'The ValueSet\'s "has" method requires the argument to be of type string or array' ) ; } if ( is_string ( $ value ) ) { return $ this -> __isset ( $ value ) ; } elseif ( is_array ( $ value ) ) { foreach ( $ value as $ name ) { if ( ! $ this -> __isset ( $ value ) ) { return false ; } } return true ; } }
Checks if a certain value exists on the valueset
14,304
public function getValueByAttributeId ( $ attributeId ) { foreach ( $ this -> values as $ valueObject ) { if ( $ valueObject -> getAttribute ( ) -> getId ( ) == $ attributeId ) { return $ valueObject ; } } return null ; }
Get a value by it s attribute ID
14,305
public function tocAction ( $ owner , $ ownerId ) { $ provider = $ this -> get ( 'opifer.content.block_provider_pool' ) -> getProvider ( $ owner ) ; $ object = $ provider -> getBlockOwner ( $ ownerId ) ; $ environment = $ this -> get ( 'opifer.content.block_environment' ) ; $ environment -> setDraft ( true ) -> setObject ( $ object ) ; $ environment -> setBlockMode ( 'manage' ) ; $ twigAnalyzer = $ this -> get ( 'opifer.content.twig_analyzer' ) ; $ parameters = [ 'environment' => $ environment , 'analyzer' => $ twigAnalyzer , 'object' => $ environment -> getObject ( ) , ] ; return $ this -> render ( 'OpiferContentBundle:Content:toc.html.twig' , $ parameters ) ; }
Table of Contents tree
14,306
public function findDue ( ) { $ active = $ this -> createQueryBuilder ( 'c' ) -> where ( 'c.state <> :canceled' ) -> andWhere ( 'c.state <> :running OR (c.state = :running AND c.startedAt < :hourAgo)' ) -> orderBy ( 'c.priority' , 'DESC' ) -> setParameters ( [ 'canceled' => Cron :: STATE_CANCELED , 'running' => Cron :: STATE_RUNNING , 'hourAgo' => new \ DateTime ( '-67 minutes' ) , ] ) -> getQuery ( ) -> getResult ( ) ; $ due = [ ] ; foreach ( $ active as $ cron ) { if ( $ cron -> isDue ( ) ) { $ due [ ] = $ cron ; } } return new ArrayCollection ( $ due ) ; }
Find all cronjobs which are due .
14,307
public function getFormAction ( $ id ) { $ form = $ this -> get ( 'opifer.form.form_manager' ) -> getRepository ( ) -> find ( $ id ) ; if ( ! $ form ) { throw $ this -> createNotFoundException ( 'The form could not be found' ) ; } $ post = $ this -> get ( 'opifer.eav.eav_manager' ) -> initializeEntity ( $ form -> getSchema ( ) ) ; $ postForm = $ this -> createForm ( PostType :: class , $ post , [ 'form_id' => $ id ] ) ; $ definition = $ this -> get ( 'liform' ) -> transform ( $ postForm ) ; $ csrf = $ this -> get ( 'security.csrf.token_manager' ) ; $ token = $ csrf -> refreshToken ( $ form -> getName ( ) ) ; $ fields = $ definition [ 'properties' ] [ 'valueset' ] [ 'properties' ] [ 'namedvalues' ] [ 'properties' ] ; $ fields [ '_token' ] = [ 'widget' => 'hidden' , 'value' => $ token -> getValue ( ) ] ; return new JsonResponse ( $ fields ) ; }
Get a definition of the given form
14,308
public function postFormPostAction ( Request $ request , $ id ) { $ form = $ this -> get ( 'opifer.form.form_manager' ) -> getRepository ( ) -> find ( $ id ) ; if ( ! $ form ) { throw $ this -> createNotFoundException ( 'The form could not be found' ) ; } $ data = json_decode ( $ request -> getContent ( ) , true ) ; $ token = $ data [ '_token' ] ; if ( $ this -> isCsrfTokenValid ( $ form -> getName ( ) , $ token ) ) { throw new InvalidCsrfTokenException ( ) ; } unset ( $ data [ '_token' ] ) ; $ data = [ 'valueset' => [ 'namedvalues' => $ data ] ] ; $ post = $ this -> get ( 'opifer.eav.eav_manager' ) -> initializeEntity ( $ form -> getSchema ( ) ) ; $ post -> setForm ( $ form ) ; $ postForm = $ this -> createForm ( PostType :: class , $ post , [ 'form_id' => $ id , 'csrf_protection' => false ] ) ; $ postForm -> submit ( $ data ) ; if ( $ postForm -> isSubmitted ( ) && $ postForm -> isValid ( ) ) { $ this -> get ( 'opifer.form.post_manager' ) -> save ( $ post ) ; return new JsonResponse ( [ 'message' => 'Success' ] , 201 ) ; } return new JsonResponse ( [ 'errors' => ( string ) $ postForm -> getErrors ( ) ] , 400 ) ; }
Handle the creation of a form post
14,309
protected function setRegisteredClaim ( $ name , $ value , $ replicate ) { $ this -> set ( $ name , $ value ) ; if ( $ replicate ) { $ this -> headers [ $ name ] = $ this -> claims [ $ name ] ; } return $ this ; }
Configures a registed claim
14,310
public function setHeader ( $ name , $ value ) { if ( $ this -> signature ) { throw new \ BadMethodCallException ( 'You must unsign before make changes' ) ; } $ this -> headers [ ( string ) $ name ] = $ this -> claimFactory -> create ( $ name , $ value ) ; return $ this ; }
Configures a header item
14,311
public function set ( $ name , $ value ) { if ( $ this -> signature ) { throw new \ BadMethodCallException ( 'You must unsign before make changes' ) ; } $ this -> claims [ ( string ) $ name ] = $ this -> claimFactory -> create ( $ name , $ value ) ; return $ this ; }
Configures a claim item
14,312
public function sign ( Signer $ signer , $ key ) { $ signer -> modifyHeader ( $ this -> headers ) ; $ this -> signature = $ signer -> sign ( $ this -> getToken ( ) -> getPayload ( ) , $ key ) ; return $ this ; }
Signs the data
14,313
public function getToken ( ) { $ payload = array ( $ this -> serializer -> toBase64URL ( $ this -> serializer -> toJSON ( $ this -> headers ) ) , $ this -> serializer -> toBase64URL ( $ this -> serializer -> toJSON ( $ this -> claims ) ) ) ; if ( $ this -> signature !== null ) { $ payload [ ] = $ this -> serializer -> toBase64URL ( $ this -> signature ) ; } return new Token ( $ this -> headers , $ this -> claims , $ this -> signature , $ payload ) ; }
Returns the resultant token
14,314
public function initializeEntity ( SchemaInterface $ schema ) { $ valueSet = $ this -> createValueSet ( ) ; $ valueSet -> setSchema ( $ schema ) ; $ this -> replaceEmptyValues ( $ valueSet ) ; $ entity = $ schema -> getObjectClass ( ) ; $ entity = new $ entity ( ) ; if ( ! $ entity instanceof EntityInterface ) { throw new \ Exception ( sprintf ( 'The entity specified in schema "%d" schema must implement Opifer\EavBundle\Model\EntityInterface.' , $ schema -> getId ( ) ) ) ; } $ entity -> setValueSet ( $ valueSet ) ; $ entity -> setSchema ( $ schema ) ; return $ entity ; }
Initializes an entity from a schema to work properly with this bundle .
14,315
public function replaceEmptyValues ( ValueSetInterface $ valueSet ) { $ persistedAttributes = array ( ) ; foreach ( $ valueSet -> getValues ( ) as $ value ) { $ persistedAttributes [ ] = $ value -> getAttribute ( ) ; } $ newValues = array ( ) ; $ missingAttributes = array_diff ( $ valueSet -> getAttributes ( ) -> toArray ( ) , $ persistedAttributes ) ; foreach ( $ missingAttributes as $ attribute ) { $ provider = $ this -> providerPool -> getValue ( $ attribute -> getValueType ( ) ) ; $ valueClass = $ provider -> getEntity ( ) ; $ value = new $ valueClass ( ) ; $ valueSet -> addValue ( $ value ) ; $ value -> setValueSet ( $ valueSet ) ; $ value -> setAttribute ( $ attribute ) ; $ newValues [ ] = $ value ; } return $ newValues ; }
Creates empty entities for non - persisted attributes .
14,316
public function hashEquals ( $ expected , $ generated ) { $ expectedLength = strlen ( $ expected ) ; if ( $ expectedLength !== strlen ( $ generated ) ) { return false ; } $ res = 0 ; for ( $ i = 0 ; $ i < $ expectedLength ; ++ $ i ) { $ res |= ord ( $ expected [ $ i ] ) ^ ord ( $ generated [ $ i ] ) ; } return $ res === 0 ; }
PHP < 5 . 6 timing attack safe hash comparison
14,317
protected function make ( $ filenames , $ template = 'base.php.twig' , array $ options = array ( ) ) { foreach ( ( array ) $ filenames as $ filename ) { if ( ! $ this -> getOption ( 'force' ) && $ this -> fs -> exists ( $ filename ) ) { throw new \ RuntimeException ( sprintf ( 'Cannot duplicate %s' , $ filename ) ) ; } $ reflection = new \ ReflectionClass ( get_class ( $ this ) ) ; if ( $ reflection -> getShortName ( ) === 'Migration' ) { $ this -> twig -> addFunction ( new \ Twig_SimpleFunction ( 'argument' , function ( $ field = "" ) { return array_combine ( array ( 'name' , 'type' ) , explode ( ':' , $ field ) ) ; } ) ) ; foreach ( $ this -> getArgument ( 'options' ) as $ option ) { list ( $ key , $ value ) = explode ( ':' , $ option ) ; $ options [ $ key ] = $ value ; } } $ output = $ this -> twig -> loadTemplate ( $ template ) -> render ( $ options ) ; $ this -> fs -> dumpFile ( $ filename , $ output ) ; } return true ; }
Generate files based on templates .
14,318
public function createDirectory ( $ dirPath ) { if ( ! $ this -> fs -> exists ( $ dirPath ) ) { $ this -> fs -> mkdir ( $ dirPath ) ; } }
Create a directory if doesn t exists .
14,319
public function getProvider ( LifecycleEventArgs $ args ) { $ provider = $ args -> getObject ( ) -> getProvider ( ) ; if ( ! $ provider ) { throw new \ Exception ( 'Please set a provider on the entity before persisting any media' ) ; } return $ this -> container -> get ( 'opifer.media.provider.pool' ) -> getProvider ( $ provider ) ; }
Get the provider pool .
14,320
public function saveThumbnail ( MediaInterface $ media , $ url ) { $ thumb = $ this -> mediaManager -> createMedia ( ) ; $ thumb -> setStatus ( Media :: STATUS_HASPARENT ) -> setName ( $ media -> getName ( ) . '_thumb' ) -> setProvider ( 'image' ) ; $ filename = '/tmp/' . basename ( $ url ) ; $ filesystem = new Filesystem ( ) ; $ filesystem -> dumpFile ( $ filename , file_get_contents ( $ url ) ) ; $ thumb -> temp = $ filename ; $ thumb -> setFile ( new UploadedFile ( $ filename , basename ( $ url ) ) ) ; $ this -> mediaManager -> save ( $ thumb ) ; return $ thumb ; }
Save the thumbnail .
14,321
public function postFormSubmit ( FormSubmitEvent $ event ) { $ post = $ event -> getPost ( ) ; $ mailinglists = $ email = null ; foreach ( $ post -> getValueSet ( ) -> getValues ( ) as $ value ) { if ( $ value instanceof MailingListSubscribeValue && $ value -> getValue ( ) == true ) { $ parameters = $ value -> getAttribute ( ) -> getParameters ( ) ; if ( isset ( $ parameters [ 'mailingLists' ] ) ) { $ mailinglists = $ this -> mailingListManager -> getRepository ( ) -> findByIds ( $ parameters [ 'mailingLists' ] ) ; } } elseif ( $ value instanceof EmailValue ) { $ email = $ value -> getValue ( ) ; } } if ( $ email && $ mailinglists ) { foreach ( $ mailinglists as $ mailinglist ) { $ subscription = new Subscription ( ) ; $ subscription -> setEmail ( $ email ) ; $ subscription -> setMailingList ( $ mailinglist ) ; $ this -> subscriptionManager -> save ( $ subscription ) ; } } }
This method is called right after the post is stored in the database during the Form submit .
14,322
public function initDefaultMentions ( ) : Ballot { $ this -> mentions = [ new Mention ( "Excellent" ) , new Mention ( "Good" ) , new Mention ( "Pretty good" ) , new Mention ( "Fair" ) , new Mention ( "Insufficient" ) , new Mention ( "To Reject" ) ] ; return $ this ; }
Set mentions width default values
14,323
public function hasSharedParent ( ) { $ parent = $ this -> getParent ( ) ; if ( $ parent != null && ( $ parent -> isShared ( ) || $ parent -> hasSharedParent ( ) ) ) { return true ; } return false ; }
Checks if one of the current blocks parents is a shared block .
14,324
public function replaceLinks ( $ string ) { preg_match_all ( '/(\[content_url\](.*?)\[\/content_url\]|\[content_url\](.*?)\[\\\\\/content_url\])/' , $ string , $ matches ) ; if ( ! count ( $ matches ) ) { return $ string ; } if ( ! empty ( $ matches [ 3 ] [ 0 ] ) ) { $ matches [ 1 ] = $ matches [ 3 ] ; } elseif ( ! empty ( $ matches [ 2 ] [ 0 ] ) ) { $ matches [ 1 ] = $ matches [ 2 ] ; } $ contents = $ this -> contentManager -> getRepository ( ) -> findByIds ( $ matches [ 1 ] ) ; $ array = [ ] ; foreach ( $ contents as $ content ) { $ array [ $ content -> getId ( ) ] = $ content ; } foreach ( $ matches [ 0 ] as $ key => $ match ) { if ( isset ( $ array [ $ matches [ 1 ] [ $ key ] ] ) ) { $ content = $ array [ $ matches [ 1 ] [ $ key ] ] ; $ url = $ this -> router -> generate ( '_content' , [ 'slug' => $ content -> getSlug ( ) ] ) ; } else { $ url = $ this -> router -> generate ( '_content' , [ 'slug' => '404' ] ) ; } $ string = str_replace ( $ match , $ url , $ string ) ; } return $ string ; }
Replaces all links that matches the pattern with content urls .
14,325
public function transform ( $ original ) { if ( ! $ original ) { return $ original ; } $ string = substr ( $ original , 1 ) ; $ split = explode ( '-' , $ string ) ; return [ 'side' => $ split [ 0 ] , 'size' => $ split [ 1 ] , ] ; }
Splits the string into the side - and size values
14,326
public function getService ( LifecycleEventArgs $ args ) { $ service = $ args -> getObject ( ) ; if ( ! $ service ) { throw new \ Exception ( 'Please set a provider on the entity before persisting any media' ) ; } return $ this -> getBlockManager ( ) -> getService ( $ service ) ; }
Get the service
14,327
public function createAction ( Request $ request , $ siteId = null , $ type = 0 , $ layoutId = null ) { $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; if ( $ type ) { $ contentType = $ this -> get ( 'opifer.content.content_type_manager' ) -> getRepository ( ) -> find ( $ type ) ; $ content = $ this -> get ( 'opifer.eav.eav_manager' ) -> initializeEntity ( $ contentType -> getSchema ( ) ) ; $ content -> setContentType ( $ contentType ) ; } else { $ content = $ manager -> initialize ( ) ; } if ( $ siteId ) { $ site = $ this -> getDoctrine ( ) -> getRepository ( Site :: class ) -> find ( $ siteId ) ; $ content -> setSite ( $ site ) ; if ( $ site -> getDefaultLocale ( ) ) { $ content -> setLocale ( $ site -> getDefaultLocale ( ) ) ; } } $ form = $ this -> createForm ( ContentType :: class , $ content ) ; $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { if ( $ layoutId ) { $ duplicatedContent = $ this -> duplicateAction ( $ layoutId , $ content ) ; return $ this -> redirectToRoute ( 'opifer_content_contenteditor_design' , [ 'owner' => 'content' , 'ownerId' => $ duplicatedContent -> getId ( ) , ] ) ; } if ( null === $ content -> getPublishAt ( ) ) { $ content -> setPublishAt ( new \ DateTime ( ) ) ; } $ manager -> save ( $ content ) ; return $ this -> redirectToRoute ( 'opifer_content_contenteditor_design' , [ 'owner' => 'content' , 'ownerId' => $ content -> getId ( ) , 'site_id' => $ siteId ] ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_content.content_new_view' ) , [ 'form' => $ form -> createView ( ) , ] ) ; }
Create a new content item .
14,328
public function editAction ( Request $ request , $ id ) { $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; $ em = $ manager -> getEntityManager ( ) ; $ content = $ manager -> getRepository ( ) -> find ( $ id ) ; $ content = $ manager -> createMissingValueSet ( $ content ) ; if ( $ content -> getTranslationGroup ( ) !== null ) { $ contentTranslations = $ content -> getTranslationGroup ( ) -> getContents ( ) -> filter ( function ( $ contentTranslation ) use ( $ content ) { return $ contentTranslation -> getId ( ) !== $ content -> getId ( ) ; } ) ; $ content -> setContentTranslations ( $ contentTranslations ) ; } $ form = $ this -> createForm ( ContentType :: class , $ content ) ; $ originalContentItems = new ArrayCollection ( ) ; foreach ( $ content -> getContentTranslations ( ) as $ contentItem ) { $ originalContentItems -> add ( $ contentItem ) ; } $ form -> handleRequest ( $ request ) ; if ( $ form -> isValid ( ) ) { if ( null === $ content -> getPublishAt ( ) ) { $ content -> setPublishAt ( $ content -> getCreatedAt ( ) ) ; } if ( $ content -> getTranslationGroup ( ) === null ) { $ translationGroup = new TranslationGroup ( ) ; $ content -> setTranslationGroup ( $ translationGroup ) ; } $ contentTranslationIds = [ $ content -> getId ( ) ] ; foreach ( $ content -> getContentTranslations ( ) as $ contentTranslation ) { if ( $ contentTranslation -> getTranslationGroup ( ) === null ) { $ contentTranslation -> setTranslationGroup ( $ content -> getTranslationGroup ( ) ) ; $ em -> persist ( $ contentTranslation ) ; } $ contentTranslationIds [ ] = $ contentTranslation -> getId ( ) ; } $ queryBuilder = $ manager -> getRepository ( ) -> createQueryBuilder ( 'c' ) ; $ queryBuilder -> update ( ) -> set ( 'c.translationGroup' , 'NULL' ) -> where ( $ queryBuilder -> expr ( ) -> eq ( 'c.translationGroup' , $ content -> getTranslationGroup ( ) -> getId ( ) ) ) -> where ( $ queryBuilder -> expr ( ) -> notIn ( 'c.id' , $ contentTranslationIds ) ) -> getQuery ( ) -> execute ( ) ; $ em -> persist ( $ content ) ; $ em -> flush ( ) ; return $ this -> redirectToRoute ( 'opifer_content_content_index' ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_content.content_edit_view' ) , [ 'content' => $ content , 'form' => $ form -> createView ( ) , ] ) ; }
Edit the details of Content .
14,329
public function onPostSerialize ( ObjectEvent $ event ) { if ( ! $ event -> getObject ( ) instanceof MediaInterface ) { return ; } $ media = $ event -> getObject ( ) ; $ provider = $ this -> getProvider ( $ media ) ; if ( $ provider -> getName ( ) == 'image' ) { $ images = $ this -> getImages ( $ media , [ 'medialibrary' ] ) ; $ event -> getVisitor ( ) -> addData ( 'images' , $ images ) ; } $ event -> getVisitor ( ) -> addData ( 'original' , $ provider -> getUrl ( $ media ) ) ; }
Listens to the post_serialize event and generates urls to the different image formats .
14,330
public function getImages ( MediaInterface $ media , array $ filters ) { $ key = $ media -> getImagesCacheKey ( ) ; if ( ! $ images = $ this -> cache -> fetch ( $ key ) ) { $ provider = $ this -> getProvider ( $ media ) ; $ reference = $ provider -> getThumb ( $ media ) ; $ images = [ ] ; foreach ( $ filters as $ filter ) { if ( $ media -> getContentType ( ) == 'image/svg+xml' ) { $ images [ $ filter ] = $ provider -> getUrl ( $ media ) ; } else { $ images [ $ filter ] = $ this -> cacheManager -> getBrowserPath ( $ reference , $ filter ) ; } } $ this -> cache -> save ( $ key , $ images , 0 ) ; } return $ images ; }
Gets the cached images if any . If the cache is not present it generates images for all filters .
14,331
protected function getAttributes ( ContentInterface $ owner ) { $ attributes = $ owner -> getValueSet ( ) -> getAttributes ( ) ; $ choices = [ ] ; foreach ( $ attributes as $ attribute ) { if ( ! in_array ( $ attribute -> getValueType ( ) , [ 'select' , 'radio' , 'checklist' ] ) ) { continue ; } $ choices [ $ attribute -> getDisplayName ( ) ] = $ attribute -> getName ( ) ; } return $ choices ; }
Get the selectable attributes
14,332
public function viewAction ( $ id ) { $ post = $ this -> get ( 'opifer.form.post_manager' ) -> getRepository ( ) -> find ( $ id ) ; if ( ! $ post ) { return $ this -> createNotFoundException ( ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_form.post_view_view' ) , [ 'post' => $ post , ] ) ; }
View a form post .
14,333
public function notificationAction ( $ id ) { $ post = $ this -> get ( 'opifer.form.post_manager' ) -> getRepository ( ) -> find ( $ id ) ; if ( ! $ post ) { return $ this -> createNotFoundException ( ) ; } $ form = $ post -> getForm ( ) ; $ mailer = $ this -> get ( 'opifer.form.mailer' ) ; $ mailer -> sendNotificationMail ( $ form , $ post ) ; $ this -> addFlash ( 'success' , 'Notification mail sent successfully' ) ; return $ this -> redirectToRoute ( 'opifer_form_post_index' , [ 'formId' => $ form -> getId ( ) ] ) ; }
Re - sends a notification email for the given form post
14,334
public function keyValues ( $ form = null ) { if ( null === $ this -> configs ) { $ this -> loadConfigs ( ) ; } $ keys = ( $ form ) ? call_user_func ( [ $ form , 'getFields' ] ) : [ ] ; $ array = [ ] ; foreach ( $ this -> configs as $ key => $ config ) { if ( $ form && ! in_array ( $ key , $ keys ) ) { continue ; } $ array [ $ key ] = $ config -> getValue ( ) ; } return $ array ; }
Returns a key - value array of the settings .
14,335
public function loadConfigs ( ) { $ configs = [ ] ; foreach ( $ this -> getRepository ( ) -> findAll ( ) as $ config ) { $ configs [ $ config -> getName ( ) ] = $ config ; } $ this -> configs = $ configs ; return $ configs ; }
Retrieve the configs and converts them for later use .
14,336
public function indexAction ( ) { $ forms = $ this -> get ( 'opifer.form.form_manager' ) -> getRepository ( ) -> findAllWithPosts ( ) ; return $ this -> render ( $ this -> getParameter ( 'opifer_form.form_index_view' ) , [ 'forms' => $ forms , ] ) ; }
Form index view .
14,337
public function createAction ( Request $ request ) { $ formManager = $ this -> get ( 'opifer.form.form_manager' ) ; $ form = $ formManager -> create ( ) ; $ formType = $ this -> createForm ( FormType :: class , $ form ) ; $ formType -> handleRequest ( $ request ) ; if ( $ formType -> isSubmitted ( ) && $ formType -> isValid ( ) ) { foreach ( $ formType -> getData ( ) -> getSchema ( ) -> getAttributes ( ) as $ attribute ) { $ attribute -> setSchema ( $ form -> getSchema ( ) ) ; foreach ( $ attribute -> getOptions ( ) as $ option ) { $ option -> setAttribute ( $ attribute ) ; } } $ formManager -> save ( $ form ) ; $ this -> addFlash ( 'success' , 'Form has been created successfully' ) ; return $ this -> redirectToRoute ( 'opifer_form_form_edit' , [ 'id' => $ form -> getId ( ) ] ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_form.form_create_view' ) , [ 'form' => $ form , 'form_form' => $ formType -> createView ( ) , ] ) ; }
Create a form .
14,338
public function editAction ( Request $ request , $ id ) { $ formManager = $ this -> get ( 'opifer.form.form_manager' ) ; $ em = $ this -> get ( 'doctrine.orm.entity_manager' ) ; $ form = $ formManager -> getRepository ( ) -> find ( $ id ) ; if ( ! $ form ) { return $ this -> createNotFoundException ( ) ; } $ originalAttributes = new ArrayCollection ( ) ; foreach ( $ form -> getSchema ( ) -> getAttributes ( ) as $ attributes ) { $ originalAttributes -> add ( $ attributes ) ; } $ formType = $ this -> createForm ( FormType :: class , $ form ) ; $ formType -> handleRequest ( $ request ) ; if ( $ formType -> isSubmitted ( ) && $ formType -> isValid ( ) ) { foreach ( $ originalAttributes as $ attribute ) { if ( false === $ form -> getSchema ( ) -> getAttributes ( ) -> contains ( $ attribute ) ) { $ em -> remove ( $ attribute ) ; } } foreach ( $ formType -> getData ( ) -> getSchema ( ) -> getAttributes ( ) as $ attribute ) { $ attribute -> setSchema ( $ form -> getSchema ( ) ) ; foreach ( $ attribute -> getOptions ( ) as $ option ) { $ option -> setAttribute ( $ attribute ) ; } } $ formManager -> save ( $ form ) ; $ this -> addFlash ( 'success' , 'Event has been updated successfully' ) ; return $ this -> redirectToRoute ( 'opifer_form_form_edit' , [ 'id' => $ form -> getId ( ) ] ) ; } return $ this -> render ( $ this -> getParameter ( 'opifer_form.form_edit_view' ) , [ 'form' => $ form , 'form_form' => $ formType -> createView ( ) , ] ) ; }
Edit a form .
14,339
public function homeAction ( Request $ request ) { $ manager = $ this -> get ( 'opifer.content.content_manager' ) ; $ host = $ request -> getHost ( ) ; $ em = $ this -> getDoctrine ( ) -> getManager ( ) ; $ siteCount = $ em -> getRepository ( Site :: class ) -> createQueryBuilder ( 's' ) -> select ( 'count(s.id)' ) -> getQuery ( ) -> getSingleScalarResult ( ) ; $ domain = $ em -> getRepository ( Domain :: class ) -> findOneByDomain ( $ host ) ; if ( $ siteCount && $ domain -> getSite ( ) -> getDefaultLocale ( ) ) { $ request -> setLocale ( $ domain -> getSite ( ) -> getDefaultLocale ( ) -> getLocale ( ) ) ; } if ( ! $ domain && $ siteCount > 1 ) { return $ this -> render ( 'OpiferContentBundle:Content:domain_not_found.html.twig' ) ; } $ content = $ manager -> getRepository ( ) -> findActiveBySlug ( 'index' , $ host ) ; return $ this -> forward ( 'OpiferContentBundle:Frontend/Content:view' , [ 'content' => $ content ] ) ; }
Render the home page .
14,340
public function parse ( $ jwt ) { $ data = $ this -> splitJwt ( $ jwt ) ; $ header = $ this -> parseHeader ( $ data [ 0 ] ) ; $ claims = $ this -> parseClaims ( $ data [ 1 ] ) ; $ signature = $ this -> parseSignature ( $ header , $ data [ 2 ] ) ; foreach ( $ claims as $ name => $ value ) { if ( isset ( $ header [ $ name ] ) ) { $ header [ $ name ] = $ value ; } } if ( $ signature === null ) { unset ( $ data [ 2 ] ) ; } return new Token ( $ header , $ claims , $ signature , $ data ) ; }
Parses the JWT and returns a token
14,341
protected function splitJwt ( $ jwt ) { if ( ! is_string ( $ jwt ) ) { throw new \ InvalidArgumentException ( 'The JWT string must have two dots' ) ; } $ data = explode ( '.' , $ jwt ) ; if ( count ( $ data ) != 3 ) { throw new \ InvalidArgumentException ( 'The JWT string must have two dots' ) ; } return $ data ; }
Splits the JWT string into an array
14,342
protected function parseHeader ( $ data ) { $ header = ( array ) $ this -> deserializer -> fromJSON ( $ this -> deserializer -> fromBase64URL ( $ data ) ) ; if ( isset ( $ header [ 'enc' ] ) ) { throw new \ InvalidArgumentException ( 'Encryption is not supported yet' ) ; } return $ header ; }
Parses the header from a string
14,343
protected function parseClaims ( $ data ) { $ claims = ( array ) $ this -> deserializer -> fromJSON ( $ this -> deserializer -> fromBase64URL ( $ data ) ) ; foreach ( $ claims as $ name => & $ value ) { $ value = $ this -> claimFactory -> create ( $ name , $ value ) ; } return $ claims ; }
Parses the claim set from a string
14,344
protected function parseSignature ( array $ header , $ data ) { if ( $ data == '' || ! isset ( $ header [ 'alg' ] ) || $ header [ 'alg' ] == 'none' ) { return null ; } $ hash = $ this -> deserializer -> fromBase64URL ( $ data ) ; return new Signature ( $ hash ) ; }
Returns the signature from given data
14,345
public function getBaseSlug ( ) { $ slug = $ this -> slug ; if ( substr ( $ slug , - 6 ) == '/index' ) { $ slug = rtrim ( $ slug , 'index' ) ; } return $ slug ; }
Get slug without index appended .
14,346
public function getBreadCrumbs ( ) { $ crumbs = [ ] ; if ( null !== $ this -> parent ) { $ crumbs = $ this -> getParent ( ) -> getBreadCrumbs ( ) ; } $ crumbs [ $ this -> slug ] = $ this -> getShortTitle ( ) ; return $ crumbs ; }
Get breadcrumbs .
14,347
public function getParents ( $ includeSelf = true ) { $ parents = [ ] ; if ( null !== $ this -> parent ) { $ parents = $ this -> getParent ( ) -> getParents ( ) ; } if ( $ includeSelf ) { $ parents [ ] = $ this ; } return $ parents ; }
Get all parents of the current content item
14,348
public function getCoverImage ( ) { if ( $ this -> getValueSet ( ) !== null ) { foreach ( $ this -> getValueSet ( ) -> getValues ( ) as $ value ) { if ( $ value instanceof MediaValue && false !== $ media = $ value -> getMedias ( ) -> first ( ) ) { return $ media -> getReference ( ) ; } } } foreach ( $ this -> getBlocks ( ) as $ block ) { $ reflect = new \ ReflectionClass ( $ block ) ; if ( $ reflect -> hasProperty ( 'media' ) && $ block -> getMedia ( ) ) { return $ block -> getMedia ( ) -> getReference ( ) ; } } return false ; }
Finds first available image for listing purposes .
14,349
public static function getCustomFieldOption ( JiraClient $ client , $ id ) { $ path = "/customFieldOption/{$id}" ; try { $ data = $ client -> callGet ( $ path ) -> getData ( ) ; $ data [ 'id' ] = $ id ; return new CustomFieldOption ( $ client , $ data ) ; } catch ( Exception $ e ) { throw new JiraException ( "Failed to get custom field option" , $ e ) ; } }
Returns a full representation of the Custom Field Option that has the given id .
14,350
public function registerBundles ( ) { $ bundles = [ new \ Symfony \ Bundle \ FrameworkBundle \ FrameworkBundle ( ) , new \ Symfony \ Bundle \ SecurityBundle \ SecurityBundle ( ) , new \ Symfony \ Bundle \ TwigBundle \ TwigBundle ( ) , new \ Symfony \ Bundle \ MonologBundle \ MonologBundle ( ) , new \ Symfony \ Bundle \ SwiftmailerBundle \ SwiftmailerBundle ( ) , new \ Doctrine \ Bundle \ DoctrineBundle \ DoctrineBundle ( ) , new \ Sensio \ Bundle \ FrameworkExtraBundle \ SensioFrameworkExtraBundle ( ) , new \ APY \ DataGridBundle \ APYDataGridBundle ( ) , new \ Bazinga \ Bundle \ JsTranslationBundle \ BazingaJsTranslationBundle ( ) , new \ Braincrafted \ Bundle \ BootstrapBundle \ BraincraftedBootstrapBundle ( ) , new \ Doctrine \ Bundle \ MigrationsBundle \ DoctrineMigrationsBundle ( ) , new \ FOS \ JsRoutingBundle \ FOSJsRoutingBundle ( ) , new \ FOS \ RestBundle \ FOSRestBundle ( ) , new \ FOS \ UserBundle \ FOSUserBundle ( ) , new \ JMS \ SerializerBundle \ JMSSerializerBundle ( ) , new \ Knp \ Bundle \ GaufretteBundle \ KnpGaufretteBundle ( ) , new \ Lexik \ Bundle \ JWTAuthenticationBundle \ LexikJWTAuthenticationBundle ( ) , new \ Lexik \ Bundle \ TranslationBundle \ LexikTranslationBundle ( ) , new \ Liip \ ImagineBundle \ LiipImagineBundle ( ) , new \ Limenius \ LiformBundle \ LimeniusLiformBundle ( ) , new \ Nelmio \ ApiDocBundle \ NelmioApiDocBundle ( ) , new \ Nelmio \ CorsBundle \ NelmioCorsBundle ( ) , new \ Scheb \ TwoFactorBundle \ SchebTwoFactorBundle ( ) , new \ Symfony \ Cmf \ Bundle \ RoutingBundle \ CmfRoutingBundle ( ) , new \ Opifer \ CmsBundle \ OpiferCmsBundle ( ) , new \ Opifer \ ContentBundle \ OpiferContentBundle ( ) , new \ Opifer \ EavBundle \ OpiferEavBundle ( ) , new \ Opifer \ FormBundle \ OpiferFormBundle ( ) , new \ Opifer \ FormBlockBundle \ OpiferFormBlockBundle ( ) , new \ Opifer \ MediaBundle \ OpiferMediaBundle ( ) , new \ Opifer \ RedirectBundle \ OpiferRedirectBundle ( ) , new \ Opifer \ ReviewBundle \ OpiferReviewBundle ( ) , new \ Opifer \ MailingListBundle \ OpiferMailingListBundle ( ) , new \ Opifer \ Revisions \ OpiferRevisionsBundle ( ) , new \ Opifer \ BootstrapBlockBundle \ OpiferBootstrapBlockBundle ( ) , ] ; if ( in_array ( $ this -> getEnvironment ( ) , [ 'dev' , 'test' ] ) ) { $ bundles [ ] = new \ Symfony \ Bundle \ DebugBundle \ DebugBundle ( ) ; $ bundles [ ] = new \ Symfony \ Bundle \ WebProfilerBundle \ WebProfilerBundle ( ) ; $ bundles [ ] = new \ Sensio \ Bundle \ DistributionBundle \ SensioDistributionBundle ( ) ; $ bundles [ ] = new \ Sensio \ Bundle \ GeneratorBundle \ SensioGeneratorBundle ( ) ; } return $ bundles ; }
Register bundles .
14,351
public function createForm ( FormInterface $ form , PostInterface $ post ) { return $ this -> formFactory -> create ( PostType :: class , $ post , [ 'form_id' => $ form -> getId ( ) ] ) ; }
Create a Symfony Form instance
14,352
public function toOptionArray ( ) { $ return = [ ] ; $ paymentMethodCodes = $ this -> _installmentsHelper -> getAllInstallmentPaymentMethodCodes ( ) ; foreach ( $ paymentMethodCodes as $ paymentMethodCode ) { $ return [ ] = [ 'value' => $ paymentMethodCode , 'label' => ucfirst ( str_replace ( '_' , ' ' , $ paymentMethodCode ) ) ] ; } return $ return ; }
Returns payment methods available for installment calculation The methods must be declared ...
14,353
public function appendTiff ( $ appendFile = "" ) { if ( $ appendFile == '' ) throw new Exception ( 'No file name specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/tiff/' . $ this -> getFileName ( ) . '/appendTiff?appendFile=' . $ appendFile ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Status == 'OK' ) { $ folder = new Folder ( ) ; $ outputStream = $ folder -> getFile ( $ this -> getFileName ( ) ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else { return false ; } }
Appends second tiff image to the original .
14,354
public function resizeImage ( $ inputPath , $ newWidth , $ newHeight , $ outputFormat ) { if ( $ inputPath == '' ) throw new Exception ( 'Base file not specified' ) ; if ( $ newWidth == '' ) throw new Exception ( 'New image width not specified' ) ; if ( $ newHeight == '' ) throw new Exception ( 'New image height not specified' ) ; if ( $ outputFormat == '' ) throw new Exception ( 'Format not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/resize?newWidth=' . $ newWidth . '&newHeight=' . $ newHeight . '&format=' . $ outputFormat ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { if ( $ outputFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ outputFormat ; } $ outputFilename = Utils :: getFileName ( $ inputPath ) . '.' . $ saveFormat ; Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outputFilename ) ; return $ outputFilename ; } else return $ v_output ; }
Resize Image without Storage .
14,355
public function cropImage ( $ x , $ y , $ width , $ height , $ outputFormat , $ outPath ) { if ( $ this -> getFileName ( ) == '' ) throw new Exception ( 'Base file not specified' ) ; if ( $ x == '' ) throw new Exception ( 'X position not specified' ) ; if ( $ y == '' ) throw new Exception ( 'Y position not specified' ) ; if ( $ width == '' ) throw new Exception ( 'Width not specified' ) ; if ( $ height == '' ) throw new Exception ( 'Height not specified' ) ; if ( $ outputFormat == '' ) throw new Exception ( 'Format not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/crop?x=' . $ x . '&y=' . $ y . '&width=' . $ width . '&height=' . $ height . '&format=' . $ outputFormat . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { if ( $ outputFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ outputFormat ; } Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outPath ) ; return $ outPath ; } else return $ v_output ; }
Crop Image with Format Change .
14,356
public function rotateImage ( $ method , $ outputFormat , $ outPath ) { if ( $ method == '' ) throw new Exception ( 'RotateFlip method not specified' ) ; if ( $ outputFormat == '' ) throw new Exception ( 'Format not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/rotateflip?method=' . $ method . '&format=' . $ outputFormat . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { if ( $ outputFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ outputFormat ; } Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outPath ) ; return $ outPath ; } else return $ v_output ; }
RotateFlip Image on Storage .
14,357
public function updateImage ( $ rotateFlipMethod , $ newWidth , $ newHeight , $ xPosition , $ yPosition , $ rectWidth , $ rectHeight , $ saveFormat , $ outPath ) { if ( $ rotateFlipMethod == '' ) throw new Exception ( 'Rotate Flip Method not specified' ) ; if ( $ newWidth == '' ) throw new Exception ( 'New width not specified' ) ; if ( $ newHeight == '' ) throw new Exception ( 'New Height not specified' ) ; if ( $ xPosition == '' ) throw new Exception ( 'X position not specified' ) ; if ( $ yPosition == '' ) throw new Exception ( 'Y position not specified' ) ; if ( $ rectWidth == '' ) throw new Exception ( 'Rectangle width not specified' ) ; if ( $ rectHeight == '' ) throw new Exception ( 'Rectangle Height not specified' ) ; if ( $ saveFormat == '' ) throw new Exception ( 'Format not specified' ) ; if ( $ outPath == '' ) throw new Exception ( 'Output file name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/updateimage?rotateFlipMethod=' . $ rotateFlipMethod . '&newWidth=' . $ newWidth . '&newHeight=' . $ newHeight . '&x=' . $ xPosition . '&y=' . $ yPosition . '&rectWidth=' . $ rectWidth . '&rectHeight=' . $ rectHeight . '&format=' . $ saveFormat . '&outPath=' . $ outPath ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ responseStream , $ outputPath ) ; return $ outputPath ; } else return false ; }
Perform Several Operations on Image
14,358
public function getActionsByResource ( $ resource ) { if ( ! isset ( $ this -> resources [ $ resource ] ) ) { return null ; } $ actions = array ( ) ; foreach ( $ this -> resources [ $ resource ] as $ action => $ path ) { $ actions [ ] = $ action ; } return $ actions ; }
Retrieve actions of a resource
14,359
public function getMethodByAction ( $ action ) { foreach ( $ this -> methods as $ method => $ actions ) { if ( in_array ( $ action , $ actions ) ) { return $ method ; } } return 'get' ; }
Retrieve the corresponding method to use
14,360
public function isMultiPartAction ( $ resource , $ action ) { return isset ( $ this -> multiPartActions [ $ resource ] ) && in_array ( $ action , $ this -> multiPartActions [ $ resource ] ) ; }
Determine if using mulit - part to upload file
14,361
private function getRequestPath ( $ resource , $ action , & $ params ) { if ( ! isset ( $ this -> resources [ $ resource ] ) || ! isset ( $ this -> resources [ $ resource ] [ $ action ] ) ) { throw new \ UnexpectedValueException ( 'Resource path not found' ) ; } $ path = $ this -> resources [ $ resource ] [ $ action ] ; $ matchCount = preg_match_all ( "/:(\w*)/" , $ path , $ variables ) ; if ( $ matchCount ) { foreach ( $ variables [ 0 ] as $ index => $ placeholder ) { if ( ! isset ( $ params [ $ variables [ 1 ] [ $ index ] ] ) ) { throw new \ InvalidArgumentException ( 'Missing parameter: ' . $ variables [ 1 ] [ $ index ] ) ; } $ path = str_replace ( $ placeholder , $ params [ $ variables [ 1 ] [ $ index ] ] , $ path ) ; unset ( $ params [ $ variables [ 1 ] [ $ index ] ] ) ; } } return $ path ; }
Retrieve request path and replace variables with values
14,362
private function callApi ( $ method , $ path , $ params , $ isMultiPart ) { $ ch = curl_init ( ) ; curl_setopt_array ( $ ch , $ this -> curlSettings ) ; $ url = $ this -> endpoint . $ path ; $ url .= $ method == 'get' ? $ this -> getAuthQueryStringWithParams ( $ params ) : $ this -> getAuthQueryString ( ) ; curl_setopt ( $ ch , CURLOPT_URL , $ url ) ; $ requestHeaders = $ this -> httpHeaders ; if ( ! $ isMultiPart ) { $ requestHeaders [ ] = "Content-Type: application/json" ; } curl_setopt ( $ ch , CURLOPT_HTTPHEADER , $ requestHeaders ) ; switch ( $ method ) { case 'post' : curl_setopt ( $ ch , CURLOPT_POST , 1 ) ; if ( $ isMultiPart ) { if ( version_compare ( PHP_VERSION , '5.5.0' ) === - 1 ) { $ params [ 'file' ] = '@' . $ params [ 'file' ] ; } else { curl_setopt ( $ ch , CURLOPT_SAFE_UPLOAD , true ) ; $ params [ 'file' ] = new \ CURLFile ( $ params [ 'file' ] ) ; } $ postBody = $ params ; } else { $ postBody = json_encode ( $ params ) ; } curl_setopt ( $ ch , CURLOPT_POSTFIELDS , $ postBody ) ; break ; case 'put' : curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , "PUT" ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ params ) ) ; break ; case 'delete' : curl_setopt ( $ ch , CURLOPT_CUSTOMREQUEST , "DELETE" ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ params ) ) ; break ; } $ response = curl_exec ( $ ch ) ; if ( $ response === false ) { throw new \ UnexpectedValueException ( curl_error ( $ ch ) ) ; } curl_close ( $ ch ) ; return $ response ; }
Initial request to Onesky API
14,363
public function getConfigData ( $ field , $ storeId = null ) { if ( null === $ storeId ) { $ storeId = $ this -> _storeManager -> getStore ( null ) ; } $ path = 'installments/' . $ field ; return $ this -> _scopeConfig -> getValue ( $ path , ScopeInterface :: SCOPE_STORE , $ storeId ) ; }
Returns Cielo Payment Method System Config
14,364
public function getAllInstallmentPaymentMethodCodes ( ) { $ return = [ ] ; $ paymentMethods = ( array ) $ this -> _scopeConfig -> getValue ( 'installments/payment_methods' ) ; foreach ( $ paymentMethods as $ code => $ null ) { $ return [ ] = $ code ; } return $ return ; }
Returns all installment ready payment methods codes
14,365
protected function _getInstallmentsHelperFromPaymentMethod ( $ methodCode ) { $ helperClassName = $ this -> _scopeConfig -> getValue ( 'installments/payment_methods/' . $ methodCode . '/installments_helper' ) ; $ helper = $ this -> _helperFactory -> get ( $ helperClassName ) ; if ( false === $ helper instanceof \ Magento \ Framework \ App \ Helper \ AbstractHelper ) { throw new \ LogicException ( $ helperClassName . ' doesn\'t extend Magento\Framework\App\Helper\AbstractHelper' ) ; } return $ helper ; }
Get Installments Helper from Payment Method
14,366
public function convertLocalFile ( $ inputPath , $ outputFormat ) { if ( $ inputPath == '' ) throw new Exception ( 'Input file not specified' ) ; if ( $ outputFormat == '' ) throw new Exception ( 'Format not specified' ) ; $ strURI = Product :: $ baseProductUri . '/imaging/' . $ this -> getFileName ( ) . '/saveAs?format=' . $ outputFormat ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputPath , 'xml' , 'POST' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { if ( $ outputFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ outputFormat ; } $ outputFilename = Utils :: getFileName ( $ inputPath ) . '.' . $ saveFormat ; Utils :: saveFile ( $ responseStream , AsposeApp :: $ outPutLocation . $ outputFilename ) ; return $ outputFilename ; } else return $ v_output ; }
Convert Image Format .
14,367
protected function bindRepositories ( ) { $ bindings = [ AttributeRepositoryContract :: class => AttributeRepository :: class , AttributeValueRepositoryContract :: class => AttributeValueRepository :: class , ProductRepositoryContract :: class => ProductRepository :: class , ProductTypeRepositoryContract :: class => ProductTypeRepository :: class , ] ; foreach ( $ bindings as $ contract => $ implementation ) { $ this -> app -> bind ( $ contract , $ implementation ) ; } }
Binds the repository abstracts to the actual implementations .
14,368
public function collect ( Quote $ quote , ShippingAssignmentInterface $ shippingAssignment , Total $ total ) { parent :: collect ( $ quote , $ shippingAssignment , $ total ) ; $ baseInterest = ( float ) $ quote -> getBaseGabrielqsInstallmentsInterestAmount ( ) ; $ interest = ( float ) $ quote -> getGabrielqsInstallmentsInterestAmount ( ) ; $ total -> addTotalAmount ( 'gabrielqs_installments_interest_amount' , $ interest ) ; $ total -> addBaseTotalAmount ( 'gabrielqs_installments_interest_amount' , $ baseInterest ) ; $ total -> setBaseGrandTotal ( $ total -> getBaseGrandTotal ( ) + $ baseInterest ) ; $ total -> setGrandTotal ( $ total -> getGrandTotal ( ) + $ interest ) ; return $ this ; }
Collect grand total address amount
14,369
public function checkPermission ( $ method , $ context ) { if ( ! is_string ( $ method ) ) { throw new \ TypeError ( 'The method parameter must be a string.' ) ; } if ( ! $ method ) { throw new \ InvalidArgumentException ( 'The method parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return strcasecmp ( $ currentRequest -> getMethod ( ) , $ method ) == 0 ; }
Checks if the current request uses an allowed method
14,370
public function checkPermission ( $ ip , $ context ) { if ( ! is_string ( $ ip ) ) { throw new \ TypeError ( 'The ip parameter must be a string.' ) ; } if ( ! $ ip ) { throw new \ InvalidArgumentException ( 'The ip parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return IpUtils :: checkIp ( $ currentRequest -> getClientIp ( ) , $ ip ) ; }
Checks if the current request comes from an approved ip address
14,371
public function initTotals ( ) { if ( $ value = $ this -> _getInterestAmount ( ) ) { $ installmentInterest = new DataObject ( [ 'code' => 'gabrielqs_installments_interest_amount' , 'strong' => false , 'value' => $ value , 'label' => __ ( 'Interest' ) , 'class' => __ ( 'Interest' ) , ] ) ; $ this -> getParentBlock ( ) -> addTotal ( $ installmentInterest , 'gabrielqs_installments_interest_amount' ) ; } return $ this ; }
Initialize all order totals relates with tax
14,372
public function checkPermission ( $ host , $ context ) { if ( ! is_string ( $ host ) ) { throw new \ TypeError ( 'The host parameter must be a string.' ) ; } if ( ! $ host ) { throw new \ InvalidArgumentException ( 'The host parameter cannot be empty.' ) ; } $ currentRequest = $ this -> requestStack -> getCurrentRequest ( ) ; if ( ! $ currentRequest ) { return false ; } return ! ! preg_match ( '{' . $ host . '}i' , $ currentRequest -> getHost ( ) ) ; }
Checks if the current request is sent to an approved host
14,373
public function loadConfig ( ) { $ path = $ this -> getConfigPath ( ) ; if ( ! is_dir ( $ path ) ) { return [ ] ; } $ configs = Cache :: remember ( "moduleConfig::{$path}" , Carbon :: now ( ) -> addMinutes ( 10 ) , function ( ) use ( $ path ) { $ configs = [ ] ; foreach ( new \ DirectoryIterator ( $ path ) as $ file ) { if ( $ file -> isDot ( ) or strpos ( $ file -> getFilename ( ) , '.php' ) === false ) { continue ; } $ key = $ file -> getBasename ( '.php' ) ; $ configs [ $ key ] = array_merge_recursive ( require $ file -> getPathname ( ) , app ( 'config' ) -> get ( $ key , [ ] ) ) ; } return $ configs ; } ) ; return $ configs ; }
Register a config file namespace .
14,374
public function fileExists ( $ fileName , $ storageName = '' ) { if ( $ fileName == '' ) { AsposeApp :: getLogger ( ) -> error ( Exception :: MSG_NO_FILENAME ) ; throw new Exception ( Exception :: MSG_NO_FILENAME ) ; } $ strURI = $ this -> strURIExist . $ fileName ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = json_decode ( Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ) ; if ( ! $ responseStream -> FileExist -> IsExist ) { return FALSE ; } return TRUE ; }
Checks if a file exists .
14,375
public function deleteFile ( $ fileName , $ storageName = '' ) { if ( $ fileName == '' ) { AsposeApp :: getLogger ( ) -> error ( Exception :: MSG_NO_FILENAME ) ; throw new Exception ( Exception :: MSG_NO_FILENAME ) ; } $ strURI = $ this -> strURIFile . $ fileName ; if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = json_decode ( Utils :: processCommand ( $ signedURI , 'DELETE' , '' , '' ) ) ; if ( $ responseStream -> Code != 200 ) { return FALSE ; } return TRUE ; }
Deletes a file from remote storage .
14,376
public function createFolder ( $ strFolder , $ storageName = '' ) { $ strURIRequest = $ this -> strURIFolder . $ strFolder ; if ( $ storageName != '' ) { $ strURIRequest .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURIRequest ) ; $ responseStream = json_decode ( Utils :: processCommand ( $ signedURI , 'PUT' , '' , '' ) ) ; if ( $ responseStream -> Code != 200 ) { return FALSE ; } return TRUE ; }
Creates a new folder under the specified folder on Aspose storage . If no path specified creates a folder under the root folder .
14,377
public function deleteFolder ( $ folderName , $ recursive = false ) { if ( $ folderName == '' ) throw new Exception ( 'No folder name specified' ) ; $ strURI = $ this -> strURIFolder . $ folderName ; if ( $ recursive ) { $ strURI = $ strURI . "?recursive=true" ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = json_decode ( Utils :: processCommand ( $ signedURI , 'DELETE' , '' , '' ) ) ; if ( $ responseStream -> Code != 200 ) { return FALSE ; } return TRUE ; }
Deletes a folder from remote storage .
14,378
public function getFilesList ( $ strFolder , $ storageName = '' ) { $ strURI = $ this -> strURIFolder ; if ( ! $ strFolder == '' ) { $ strURI .= $ strFolder ; } if ( $ storageName != '' ) { $ strURI .= '?storage=' . $ storageName ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> Files ; }
Retrives the list of files and folders under the specified folder . Use empty string to specify root folder .
14,379
public function convertByUrl ( $ url = '' , $ format = '' , $ outputFilename = '' ) { if ( $ url == '' ) throw new Exception ( 'Url not specified' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/convert?url=' . $ url . '&format=' . $ format ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'PUT' , '' , '' ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { if ( $ this -> saveFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ this -> saveFormat ; } $ outputPath = AsposeApp :: $ outPutLocation . Utils :: getFileName ( $ outputFilename ) . '.' . $ format ; Utils :: saveFile ( $ responseStream , $ outputPath ) ; return $ outputPath ; } else { return $ v_output ; } }
Convert a document by url to SaveFormat .
14,380
public function convertLocalFile ( $ inputFile = '' , $ outputFilename = '' , $ outputFormat = '' ) { if ( $ inputFile == '' ) throw new Exception ( 'No file name specified' ) ; if ( $ outputFormat == '' ) throw new Exception ( 'output format not specified' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/convert?format=' . $ outputFormat ; if ( ! file_exists ( $ inputFile ) ) { throw new Exception ( 'input file doesnt exist.' ) ; } $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: uploadFileBinary ( $ signedURI , $ inputFile , 'xml' ) ; $ v_output = Utils :: validateOutput ( $ responseStream , $ outputFormat ) ; if ( $ v_output === '' ) { if ( $ outputFormat == 'html' ) { $ saveFormat = 'zip' ; } else { $ saveFormat = $ outputFormat ; } if ( $ outputFilename == '' ) { $ outputFilename = Utils :: getFileName ( $ inputFile ) . '.' . $ saveFormat ; } $ outputPath = AsposeApp :: $ outPutLocation . $ outputFilename ; Utils :: saveFile ( $ responseStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Convert PDF to different file format without using Aspose cloud storage .
14,381
public static function compare ( Rule $ a , Rule $ b , bool $ checkTag = false ) : int { return Symbol :: compare ( $ a -> subject , $ b -> subject ) ? : Symbol :: compareList ( $ a -> definition , $ b -> definition ) ? : ( $ b -> eof - $ a -> eof ) ? : ( $ checkTag ? self :: compareTag ( $ a -> tag , $ b -> tag ) : 0 ) ; }
Compare two rules
14,382
public function checkFlag ( array $ context ) : bool { if ( ! isset ( $ context [ 'user' ] ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The context parameter must contain a "user" key to be able to evaluate the %s flag.' , $ this -> getName ( ) ) ) ; } $ user = $ context [ 'user' ] ; if ( is_string ( $ user ) ) { return false ; } if ( ! ( $ user instanceof UserInterface ) ) { throw new \ InvalidArgumentException ( sprintf ( 'The user class must implement Ordermind\LogicalAuthorizationBundle\Interfaces\UserInterface to be able to evaluate the %s flag.' , $ this -> getName ( ) ) ) ; } $ access = $ user -> getBypassAccess ( ) ; if ( ! is_bool ( $ access ) ) { throw new \ UnexpectedValueException ( sprintf ( 'The method getBypassAccess() on the user object must return a boolean. Returned type is %s.' , gettype ( $ access ) ) ) ; } return $ access ; }
Checks if access can be bypassed in a given context .
14,383
public function getMaximumInstallment ( ) { if ( $ this -> _maximumInstallment === null ) { $ grandTotal = $ this -> getCartGrandTotal ( ) ; $ this -> _maximumInstallment = $ this -> _installmentsHelper -> getMaximumInstallment ( $ grandTotal ) ; } return $ this -> _maximumInstallment ; }
Returns maximum instalment for the currently active shopping cart
14,384
public function read ( string $ filename ) : array { $ lines = [ 'total' => 0 , 'read' => 0 ] ; $ file = new \ SplFileObject ( $ filename ) ; while ( ! $ file -> eof ( ) ) { $ line = $ file -> fgets ( ) ; if ( $ this -> isLine ( $ line ) && \ strlen ( $ line ) > 1 ) { $ line = trim ( preg_replace ( '/\s+/' , ' ' , $ line ) ) ; $ this -> _lines [ ] = $ line ; $ lines [ 'read' ] ++ ; } $ lines [ 'total' ] ++ ; } return $ lines ; }
Read configuration file line by line
14,385
public function parse ( ) : ConfigInterface { $ config = new Config ( ) ; array_map ( function ( $ line ) use ( $ config ) { if ( preg_match ( '/^(\S+)\ (.*)/' , $ line , $ matches ) ) { switch ( $ matches [ 1 ] ) { case 'push' : $ config -> addPush ( $ matches [ 2 ] ) ; break ; case 'ca' : case 'cert' : case 'key' : case 'dh' : case 'tls-auth' : $ config -> addCert ( $ matches [ 1 ] , $ matches [ 2 ] ) ; break ; default : $ config -> add ( $ matches [ 1 ] , $ matches [ 2 ] ) ; break ; } } } , $ this -> _lines ) ; return $ config ; }
Parse readed lines
14,386
public function getPageCount ( ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/pages' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: ProcessCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; return count ( $ json -> Pages -> List ) ; }
Gets the page count of the specified PDF document .
14,387
public function appendDocument ( $ basePdf , $ newPdf , $ startPage = 0 , $ endPage = 0 , $ sourceFolder = '' ) { if ( $ basePdf == '' ) throw new Exception ( 'Base file not specified' ) ; if ( $ newPdf == '' ) throw new Exception ( 'File to merge is not specified' ) ; if ( $ sourceFolder == '' ) $ strURI = Product :: $ baseProductUri . '/pdf/' . $ basePdf . '/appendDocument?appendFile=' . $ newPdf . ( $ startPage > 0 ? '&startPage=' . $ startPage : '' ) . ( $ endPage > 0 ? '&endPage=' . $ endPage : '' ) ; else $ strURI = Product :: $ baseProductUri . '/pdf/' . $ basePdf . '/appendDocument?appendFile=' . $ sourceFolder . '/' . $ newPdf . ( $ startPage > 0 ? '&startPage=' . $ startPage : '' ) . ( $ endPage > 0 ? '&endPage=' . $ endPage : '' ) . '&folder=' . $ sourceFolder ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) { $ folder = new Folder ( ) ; $ path = "" ; if ( $ sourceFolder == "" ) { $ path = $ basePdf ; } else { $ path = $ sourceFolder . '/' . $ basePdf ; } $ outputStream = $ folder -> GetFile ( $ path ) ; $ outputPath = AsposeApp :: $ outPutLocation . $ basePdf ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; } else { return false ; } }
Merges two PDF documents .
14,388
public function mergeDocuments ( array $ sourceFiles = array ( ) ) { $ mergedFileName = $ this -> getFileName ( ) ; if ( $ mergedFileName == '' ) throw new Exception ( 'Output file not specified' ) ; if ( empty ( $ sourceFiles ) ) throw new Exception ( 'File to merge are not specified' ) ; if ( count ( $ sourceFiles ) < 2 ) throw new Exception ( 'Two or more files are requred to merge' ) ; $ documentsList = array ( 'List' => $ sourceFiles ) ; $ json = json_encode ( $ documentsList ) ; $ strURI = Product :: $ baseProductUri . '/pdf/' . $ mergedFileName . '/merge' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = json_decode ( Utils :: processCommand ( $ signedURI , 'PUT' , 'json' , $ json ) ) ; if ( $ responseStream -> Code == 200 ) return true ; else return false ; }
Merges tow or more PDF documents .
14,389
public function getFormFieldCount ( ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/fields' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: ProcessCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; return count ( $ json -> Fields -> List ) ; }
Gets the FormField count of the specified PDF document .
14,390
public function getFormField ( $ fieldName ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/fields/' . $ fieldName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: ProcessCommand ( $ signedURI , 'GET' , '' ) ; $ json = json_decode ( $ responseStream ) ; return $ json -> Field ; }
Gets a particular form field .
14,391
public function updateFormFields ( array $ fieldArray , $ documentFolder = '' ) { if ( count ( $ fieldArray ) === 0 ) throw new Exception ( 'Field array cannot be empty' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/fields?folder=' . $ documentFolder ; $ signedURI = Utils :: sign ( $ strURI ) ; $ postData = json_encode ( array ( 'List' => $ fieldArray ) ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'PUT' , 'JSON' , $ postData ) ; $ json = json_decode ( $ responseStream ) ; $ v_output = Utils :: validateOutput ( $ responseStream ) ; if ( $ v_output === '' ) { $ folder = new Folder ( ) ; if ( $ documentFolder ) { $ outputStream = $ folder -> getFile ( $ documentFolder . '/' . $ this -> getFileName ( ) ) ; } else { $ outputStream = $ folder -> getFile ( $ this -> getFileName ( ) ) ; } $ outputPath = AsposeApp :: $ outPutLocation . $ this -> getFileName ( ) ; Utils :: saveFile ( $ outputStream , $ outputPath ) ; return $ outputPath ; } else return $ v_output ; }
Update Form Fields in a PDF Document .
14,392
public function updateFormField ( $ fieldName , $ fieldType , $ fieldValue ) { if ( $ fieldName == '' ) throw new Exception ( 'Field name not specified' ) ; if ( $ fieldType == '' ) throw new Exception ( 'Field type not specified' ) ; if ( $ fieldValue == '' ) throw new Exception ( 'Field value not specified' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/fields/' . $ fieldName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ postData = json_encode ( array ( "Name" => $ fieldName , "Type" => $ fieldType , "Values" => array ( $ fieldValue ) ) ) ; $ responseStream = Utils :: ProcessCommand ( $ signedURI , 'PUT' , 'JSON' , $ postData ) ; $ json = json_decode ( $ responseStream ) ; if ( $ json -> Code == 200 ) return $ json -> Field ; else return false ; }
Update a Form Field in a PDF Document .
14,393
public function getDocumentProperties ( ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/documentProperties' ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ response_arr = json_decode ( $ responseStream ) ; return $ response_arr -> DocumentProperties -> List ; }
Get all the properties of the specified document .
14,394
public function getDocumentProperty ( $ propertyName = '' ) { if ( $ propertyName == '' ) throw new Exception ( 'Property name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/documentProperties/' . $ propertyName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ response_arr = json_decode ( $ responseStream ) ; return $ response_arr -> DocumentProperty ; }
Get specified properity of the document .
14,395
public function setDocumentProperty ( $ propertyName = '' , $ propertyValue = '' ) { if ( $ propertyName == '' ) throw new Exception ( 'Property name not specified' ) ; $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/documentProperties/' . $ propertyName ; $ putArray [ 'Value' ] = $ propertyValue ; $ json = json_encode ( $ putArray ) ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'PUT' , 'json' , $ json ) ; $ response_arr = json_decode ( $ responseStream ) ; return $ response_arr -> DocumentProperty ; }
Set specified properity of the document .
14,396
public function splitPages ( $ from , $ to ) { $ strURI = Product :: $ baseProductUri . '/pdf/' . $ this -> getFileName ( ) . '/split?from=' . $ from . '&to=' . $ to ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'POST' , '' , '' ) ; $ json = json_decode ( $ responseStream ) ; $ dispatcher = AsposeApp :: getEventDispatcher ( ) ; $ pageNumber = 1 ; foreach ( $ json -> Result -> Documents as $ splitPage ) { $ splitFileName = basename ( $ splitPage -> Href ) ; $ strURI = Product :: $ baseProductUri . '/storage/file/' . $ splitFileName ; $ signedURI = Utils :: sign ( $ strURI ) ; $ responseStream = Utils :: processCommand ( $ signedURI , 'GET' , '' , '' ) ; $ fileName = $ this -> getFileName ( ) . '_' . $ pageNumber . '.pdf' ; $ outputFile = AsposeApp :: $ outPutLocation . $ fileName ; Utils :: saveFile ( $ responseStream , $ outputFile ) ; echo $ outputFile . '<br />' ; $ event = new SplitPageEvent ( $ outputFile , $ pageNumber ) ; $ dispatcher -> dispatch ( SplitPageEvent :: PAGE_IS_SPLIT , $ event ) ; $ pageNumber ++ ; } }
Split page into documents as specified in the range .
14,397
public function setClient ( $ client ) { if ( $ client instanceof Client && $ this -> client != $ client ) { $ this -> configureDefaults ( $ client -> getMessageDefaults ( ) , true ) ; } $ this -> client = $ client ; return $ this ; }
Set the BearyChat Client instance .
14,398
public function setChannel ( $ channel ) { $ this -> removeTarget ( ) ; if ( $ channel ) { $ this -> channel = ( string ) $ channel ; } return $ this ; }
Set the channel which the message should be sent to .
14,399
public function setUser ( $ user ) { $ this -> removeTarget ( ) ; if ( $ user ) { $ this -> user = ( string ) $ user ; } return $ this ; }
Set the user which the message should be sent to .