Context PHP Class Code Examples

This page contains top rated real world PHP examples of class Context extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: html.helper.php Project: RNKushwaha022/orange-php
0
 function __construct(Context $context = null)
 {
     if (!$context) {
         $context = new Context('helper', 'phaxsi');
     }
     $this->module = $context->getModule();
 }
Example #2
Show file File: Template.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Framework\Model\Context $context
  * @param \Magento\Framework\View\DesignInterface $design
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Store\Model\App\Emulation $appEmulation
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\Filesystem $filesystem
  * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
  * @param \Magento\Email\Model\Template\Config $emailConfig
  * @param \Magento\Email\Model\TemplateFactory $templateFactory The template directive requires an email
  *        template model, not newsletter model, as templates overridden in backend are loaded from email table.
  * @param \Magento\Framework\Filter\FilterManager $filterManager
  * @param \Magento\Framework\Url|\Magento\Framework\UrlInterface $urlModel
  * @param \Magento\Framework\App\RequestInterface $request
  * @param \Magento\Newsletter\Model\Template\FilterFactory $filterFactory ,
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\Model\Context $context, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Registry $registry, \Magento\Store\Model\App\Emulation $appEmulation, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\Filesystem $filesystem, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Email\Model\Template\Config $emailConfig, \Magento\Email\Model\TemplateFactory $templateFactory, \Magento\Framework\Filter\FilterManager $filterManager, \Magento\Framework\UrlInterface $urlModel, \Magento\Framework\App\RequestInterface $request, \Magento\Newsletter\Model\Template\FilterFactory $filterFactory, array $data = [])
 {
     parent::__construct($context, $design, $registry, $appEmulation, $storeManager, $assetRepo, $filesystem, $scopeConfig, $emailConfig, $templateFactory, $filterManager, $urlModel, $data);
     $this->_storeManager = $storeManager;
     $this->_request = $request;
     $this->_filterFactory = $filterFactory;
 }
Example #3
Show file File: View.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\ProductAlert\Helper\Data $helper
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\Data\Helper\PostHelper $coreHelper
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\ProductAlert\Helper\Data $helper, \Magento\Framework\Registry $registry, \Magento\Framework\Data\Helper\PostHelper $coreHelper, array $data = [])
 {
     parent::__construct($context, $data);
     $this->_registry = $registry;
     $this->_helper = $helper;
     $this->coreHelper = $coreHelper;
 }
Example #4
Show file File: AbstractStockqty.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\CatalogInventory\Api\StockStateInterface $stockState
  * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\CatalogInventory\Api\StockStateInterface $stockState, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, array $data = [])
 {
     $this->_coreRegistry = $registry;
     $this->stockState = $stockState;
     $this->stockRegistry = $stockRegistry;
     parent::__construct($context, $data);
 }
Example #5
Show file File: MaxTest.php Project: papeventures/Ruler
0
 /**
  * @dataProvider maxData
  */
 public function testMax($a, $result)
 {
     $var = new Variable('a', $a);
     $context = new Context();
     $op = new Operator\Max($var);
     $this->assertEquals($result, $op->prepareValue($context)->getValue());
 }
Example #6
Show file File: Items.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Multishipping\Model\Checkout\Type\Multishipping $multishipping, \Magento\Checkout\Model\Session $checkoutSession, array $data = [])
 {
     $this->_multishipping = $multishipping;
     $this->_checkoutSession = $checkoutSession;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
Example #7
Show file File: Buttons.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Http\Context $httpContext, array $data = [])
 {
     $this->_coreRegistry = $registry;
     $this->httpContext = $httpContext;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
Example #8
Show file File: Navigation.php Project: pradeep-wagento/magento2
0
 /**
  * @param Template\Context $context
  * @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
  * @param \Magento\Catalog\Model\Layer\FilterList $filterList
  * @param \Magento\Catalog\Model\Layer\AvailabilityFlagInterface $visibilityFlag
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\Layer\Resolver $layerResolver, \Magento\Catalog\Model\Layer\FilterList $filterList, \Magento\Catalog\Model\Layer\AvailabilityFlagInterface $visibilityFlag, array $data = [])
 {
     $this->_catalogLayer = $layerResolver->get();
     $this->filterList = $filterList;
     $this->visibilityFlag = $visibilityFlag;
     parent::__construct($context, $data);
 }
Example #9
Show file File: Grid.php Project: OlgaBurtyka/m2
0
 /**
  * [__construct description].
  *
  * @param \Magento\Backend\Block\Template\Context     $context            [description]
  * @param \Magento\Backend\Helper\Data                $backendHelper      [description]
  * @param \Magento\Framework\Data\Collection          $dataCollection     [description]
  * @param \Magestore\Bannerslider\Helper\Data         $bannersliderHelper [description]
  * @param array                                       $data               [description]
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Backend\Helper\Data $backendHelper, \Magento\Framework\Data\CollectionFactory $collectionFactory, \Magento\Framework\DataObjectFactory $objectFactory, \Magestore\Bannerslider\Helper\Data $bannersliderHelper, array $data = [])
 {
     $this->_bannersliderHelper = $bannersliderHelper;
     $this->_collectionFactory = $collectionFactory;
     $this->_objectFactory = $objectFactory;
     parent::__construct($context, $backendHelper, $data);
 }
Example #10
Show file File: Button.php Project: shabbirvividads/magento2
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Wishlist\Helper\Data $wishlistData
  * @param \Magento\Wishlist\Model\Config $wishlistConfig
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Wishlist\Helper\Data $wishlistData, \Magento\Wishlist\Model\Config $wishlistConfig, array $data = [])
 {
     $this->_wishlistData = $wishlistData;
     $this->_wishlistConfig = $wishlistConfig;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
Example #11
Show file File: AbstractEmail.php Project: shabbirvividads/magento2
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode, PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Helper\Image $imageHelper, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->priceCurrency = $priceCurrency;
     $this->_maliciousCode = $maliciousCode;
     parent::__construct($context, $data);
 }
Example #12
Show file File: Board.php Project: KasaiDot/FoolSlide2
0
 public function __construct(\Foolz\Foolframe\Model\Context $context)
 {
     parent::__construct($context);
     $this->dc = $context->getService('doctrine');
     $this->profiler = $context->getService('profiler');
     $this->comment_factory = $context->getService('foolslide.comment_factory');
 }
Example #13
Show file File: Rule.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Backend\App\Action\Context $context
  * @param \Magento\Framework\Registry $coreRegistry
  * @param \Magento\Tax\Api\TaxRuleRepositoryInterface $ruleService
  * @param \Magento\Tax\Api\Data\TaxRuleInterfaceFactory $taxRuleDataObjectFactory
  */
 public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Registry $coreRegistry, \Magento\Tax\Api\TaxRuleRepositoryInterface $ruleService, \Magento\Tax\Api\Data\TaxRuleInterfaceFactory $taxRuleDataObjectFactory)
 {
     $this->_coreRegistry = $coreRegistry;
     $this->ruleService = $ruleService;
     $this->taxRuleDataObjectFactory = $taxRuleDataObjectFactory;
     parent::__construct($context);
 }
Example #14
Show file File: Summary.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Backend\Block\Template\Context $context
  * @param \Magento\Review\Model\ResourceModel\Rating\Option\Vote\CollectionFactory $votesFactory
  * @param \Magento\Review\Model\RatingFactory $ratingFactory
  * @param \Magento\Framework\Registry $registry
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Template\Context $context, \Magento\Review\Model\ResourceModel\Rating\Option\Vote\CollectionFactory $votesFactory, \Magento\Review\Model\RatingFactory $ratingFactory, \Magento\Framework\Registry $registry, array $data = [])
 {
     $this->_votesFactory = $votesFactory;
     $this->_ratingFactory = $ratingFactory;
     $this->_coreRegistry = $registry;
     parent::__construct($context, $data);
 }
Example #15
Show file File: FqsenResolver.php Project: timpressive/art-auction
0
 public function resolve($fqsen, Context $context = null)
 {
     if ($context === null) {
         $context = new Context('');
     }
     if ($this->isFqsen($fqsen)) {
         return new Fqsen($fqsen);
     }
     return $this->resolvePartialStructuralElementName($fqsen, $context);
 }
Example #16
Show file File: Config.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Context $context
  * @param RequireJsConfig $config
  * @param \Magento\Framework\View\Page\Config $pageConfig
  * @param \Magento\Translation\Model\FileManager $fileManager
  * @param Inline $inline
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Context $context, \Magento\Framework\View\Page\Config $pageConfig, \Magento\Translation\Model\FileManager $fileManager, Inline $inline, array $data = [])
 {
     parent::__construct($context, $data);
     $this->pageConfig = $pageConfig;
     $this->fileManager = $fileManager;
     $this->inline = $inline;
 }
Example #17
Show file File: Edit.php Project: tingyeeh/magento2
0
 /**
  * Constructor
  *
  * @param \Magento\Backend\Block\Widget\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param GroupRepositoryInterface $groupRepository
  * @param GroupManagementInterface $groupManagement
  * @param array $data
  */
 public function __construct(\Magento\Backend\Block\Widget\Context $context, \Magento\Framework\Registry $registry, GroupRepositoryInterface $groupRepository, GroupManagementInterface $groupManagement, array $data = [])
 {
     $this->coreRegistry = $registry;
     $this->groupRepository = $groupRepository;
     $this->groupManagement = $groupManagement;
     parent::__construct($context, $data);
 }
Example #18
Show file File: AbstractEmail.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode, PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Block\Product\ImageBuilder $imageBuilder, array $data = [])
 {
     $this->imageBuilder = $imageBuilder;
     $this->priceCurrency = $priceCurrency;
     $this->_maliciousCode = $maliciousCode;
     parent::__construct($context, $data);
 }
Example #19
Show file File: Backend.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\App\Helper\Context $context
  * @param \Magento\Directory\Helper\Data $directoryHelper
  * @param \Magento\Config\Model\Config $backendConfig
  * @param \Magento\Config\Model\Config\ScopeDefiner $scopeDefiner
  */
 public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Directory\Helper\Data $directoryHelper, \Magento\Config\Model\Config $backendConfig, \Magento\Config\Model\Config\ScopeDefiner $scopeDefiner)
 {
     parent::__construct($context);
     $this->directoryHelper = $directoryHelper;
     $this->backendConfig = $backendConfig;
     $this->scopeDefiner = $scopeDefiner;
 }
Example #20
Show file File: Link.php Project: kidaa30/magento2-platformsh
0
 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Wishlist\Helper\Data $wishlistHelper
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param \Magento\Framework\Url\EncoderInterface $urlEncoder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, \Magento\Framework\Url\EncoderInterface $urlEncoder, array $data = [])
 {
     parent::__construct($context, $data);
     $this->wishlistHelper = $wishlistHelper;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->urlEncoder = $urlEncoder;
 }
Example #21
Show file File: Output.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Framework\App\Helper\Context $context
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param Data $catalogData
  * @param \Magento\Framework\Escaper $escaper
  */
 public function __construct(\Magento\Framework\App\Helper\Context $context, \Magento\Eav\Model\Config $eavConfig, Data $catalogData, \Magento\Framework\Escaper $escaper)
 {
     $this->_eavConfig = $eavConfig;
     $this->_catalogData = $catalogData;
     $this->_escaper = $escaper;
     parent::__construct($context);
 }
Example #22
Show file File: BaseController.php Project: BGCX067/fajr-svn-to-git
0
 /**
  * Invoke an action given its name
  *
  * This function checks if public non-abstract non-static runAction method
  * exists in this object and calls it in such a case with request and response
  * parameters
  *
  * @param Trace $trace trace object
  * @param string $action action name
  * @param Context $context fajr context
  */
 public function invokeAction(Trace $trace, $action, Context $context)
 {
     Preconditions::checkIsString($action);
     Preconditions::checkMatchesPattern('@^[A-Z][a-zA-Z]*$@', $action, '$action must start with capital letter and ' . 'contain only letters.');
     $methodName = 'run' . $action;
     if (!method_exists($this, $methodName)) {
         throw new Exception('Action method ' . $methodName . ' does not exist');
     }
     $method = new ReflectionMethod($this, $methodName);
     if (!$method->isPublic()) {
         throw new Exception('Action method ' . $methodName . ' is not public');
     }
     if ($method->isAbstract()) {
         throw new Exception('Action method ' . $methodName . ' is abstract');
     }
     if ($method->isStatic()) {
         throw new Exception('Action method ' . $methodName . ' is static');
     }
     if ($method->isConstructor()) {
         throw new Exception('Action method ' . $methodName . ' is constructor');
     }
     if ($method->isDestructor()) {
         throw new Exception('Action method ' . $methodName . ' is destructor');
     }
     $method->invoke($this, $trace, $context);
 }
Example #23
Show file File: Statistics.php Project: shabbirvividads/magento2
0
 /**
  * @param \Magento\Backend\App\Action\Context $context
  * @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
  * @param \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory
  * @param [] $reportTypes
  */
 public function __construct(\Magento\Backend\App\Action\Context $context, \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter, \Magento\Backend\Model\View\Result\RedirectFactory $resultRedirectFactory, array $reportTypes)
 {
     $this->_dateFilter = $dateFilter;
     $this->reportTypes = $reportTypes;
     $this->resultRedirectFactory = $resultRedirectFactory;
     parent::__construct($context);
 }
Example #24
Show file File: ExportHandler.php Project: ramunasd/platform
0
 /**
  * @param ItemReaderInterface $reader
  * @param ExportProcessor     $processor
  * @param ItemWriterInterface $writer
  * @param array               $contextParameters
  * @param int                 $batchSize
  * @param string              $format
  *
  * @return StreamedResponse
  */
 public function handle(ItemReaderInterface $reader, ExportProcessor $processor, ItemWriterInterface $writer, array $contextParameters, $batchSize, $format)
 {
     if (!isset($contextParameters['gridName'])) {
         throw new InvalidArgumentException('Parameter "gridName" must be provided.');
     }
     $context = new Context($contextParameters);
     $executor = new StepExecutor();
     $executor->setBatchSize($batchSize);
     $executor->setReader($reader)->setProcessor($processor)->setWriter($writer);
     foreach ([$executor->getReader(), $executor->getProcessor(), $executor->getWriter()] as $element) {
         if ($element instanceof ContextAwareInterface) {
             $element->setImportExportContext($context);
         }
     }
     $contentType = $this->guesser->guessByFileExtension($format);
     if (!$contentType) {
         $contentType = 'application/octet-stream';
     }
     // prepare response
     $response = new StreamedResponse($this->exportCallback($context, $executor));
     $response->headers->set('Content-Type', $contentType);
     $response->headers->set('Content-Transfer-Encoding', 'binary');
     $outputFileName = sprintf('datagrid_%s_%s.%s', str_replace('-', '_', $contextParameters['gridName']), date('Y_m_d_H_i_s'), $format);
     $response->headers->set('Content-Disposition', $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $outputFileName));
     return $response;
 }
Example #25
Show file File: TypedDataResolverTest.php Project: isramv/camp-gdl
0
 /**
  * Asserts that a context for the given property path can be derived.
  *
  * @param \Drupal\Core\Entity\ContentEntityInterface $entity
  *   The entity to test with.
  * @param $property_path
  *   The property path to look for.
  * @param $expected_data_type
  *   The expected data type.
  *
  * @return \Drupal\Core\Plugin\Context\ContextInterface
  *   The context with a value.
  */
 protected function assertPropertyPath(ContentEntityInterface $entity, $property_path, $expected_data_type)
 {
     $typed_data_entity = $entity->getTypedData();
     $context_definition = new ContextDefinition($typed_data_entity->getDataDefinition()->getDataType());
     $context_with_value = new Context($context_definition, $typed_data_entity);
     $context_without_value = new Context($context_definition);
     // Test the context without value.
     $property_context = $this->typedDataResolver->getContextFromProperty($property_path, $context_without_value);
     $this->assertEquals($expected_data_type, $property_context->getContextDefinition()->getDataType());
     // Test the context with value.
     $property_context = $this->typedDataResolver->getContextFromProperty($property_path, $context_with_value);
     $this->assertEquals($expected_data_type, $property_context->getContextDefinition()->getDataType());
     // Return the context with value so it can be asserted.
     return $property_context;
 }
Example #26
Show file File: strategy.php Project: luisOO/design-patterns
0
 public static function main()
 {
     $strategyA = new ConcreteStrategyA();
     $context = new Context($strategyA);
     $context->contextInterface();
     $strategyB = new ConcreteStrategyB();
     $context = new Context($strategyB);
     $context->contextInterface();
     $strategyC = new ConcreteStrategyC();
     $context = new Context($strategyC);
     $context->contextInterface();
 }
Example #27
Show file File: Status.php Project: pradeep-wagento/magento2
0
 /**
  * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
  * @param \Magento\Store\Model\StoreManagerInterface $storeManager
  * @param \Magento\Store\Model\WebsiteFactory $websiteFactory
  * @param \Magento\Eav\Model\Config $eavConfig
  * @param string $connectionName
  */
 public function __construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Store\Model\WebsiteFactory $websiteFactory, \Magento\Eav\Model\Config $eavConfig, $connectionName = null)
 {
     parent::__construct($context, $connectionName);
     $this->_storeManager = $storeManager;
     $this->_websiteFactory = $websiteFactory;
     $this->eavConfig = $eavConfig;
 }
Frequently Used Methods