idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
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 -> ...
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 :...
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...
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 ) -> setObje...
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 ::...
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 -> getSc...
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 ) ; $ ...
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 -> ...
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 ...
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 ( ) -> toArr...
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 ==...
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 ) ) ; }...
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 ( ...
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 Filesys...
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 -> getAttri...
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 ( ! emp...
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 ->...
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 -> getTranslat...
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 , [ 'medialibrar...
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 $ filte...
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...
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 -> sendNotification...
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 ; } $ a...
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 -> is...
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 ( ) ; } $ originalAt...
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)' ) -> ...
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 [ $ nam...
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...
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...
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 \...
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 ( '_' , ' ' , $ paymentMetho...
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 =...
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 sp...
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' )...
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' ) ; $ strUR...
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 sp...
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 ] ...
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...
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 \ Magen...
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?forma...
Convert Image Format .
14,367
protected function bindRepositories ( ) { $ bindings = [ AttributeRepositoryContract :: class => AttributeRepository :: class , AttributeValueRepositoryContract :: class => AttributeValueRepository :: class , ProductRepositoryContract :: class => ProductRepository :: class , ProductTypeRepositoryContract :: class => Pr...
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 -> getGabrielqsInstallment...
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 -> getCur...
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...
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 ( ) -...
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 -> getCurrentReques...
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 ) ...
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=' ...
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=' ....
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 ( $ sign...
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 ) ; $ responseSt...
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 ...
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 :: pro...
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?for...
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 ...
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+/' , ' ' , $ li...
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' : c...
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 -> ...
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 :: ...
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 ) ...
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 -> Fie...
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...
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 ...
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' ) ; $ str...
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 ) ;...
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 ) ; $ response...
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' ] = $ pro...
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 ( $ resp...
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 .