PayU integration by Krzysztof Gzocha
  • Namespace
  • Class

Namespaces

  • Team3
    • PayU
      • Annotation
      • Communication
        • CurlRequestBuilder
        • HttpStatusParser
        • Notification
        • Process
          • NotificationProcess
          • ResponseDeserializer
        • Request
          • Model
        • Response
          • Model
        • Sender
      • Configuration
        • Credentials
      • Order
        • Autocomplete
          • Strategy
        • Model
          • Buyer
          • Money
          • Products
          • ShippingMethods
          • Traits
        • Transformer
          • UserOrder
            • Strategy
              • Product
              • ShippingMethod
      • PropertyExtractor
        • Reader
      • Serializer
      • SignatureCalculator
        • Encoder
          • Algorithms
          • Strategy
        • ParametersSorter
        • Validator
      • ValidatorBuilder

Classes

  • Team3\PayU\ValidatorBuilder\ValidatorBuilder

Interfaces

  • Team3\PayU\ValidatorBuilder\ValidatorBuilderInterface
 1 <?php
 2 /**
 3  * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 4  */
 5 namespace Team3\PayU\Order\Model\Products;
 6 
 7 use Symfony\Component\Validator\Constraints as Assert;
 8 
 9 class ProductCollection implements ProductCollectionInterface
10 {
11     /**
12      * @var ProductInterface[]
13      * @Assert\Count(min="1")
14      */
15     protected $products;
16 
17     /**
18      * @param ProductInterface[] $products
19      */
20     public function __construct(array $products = [])
21     {
22         $this->products = $products;
23     }
24 
25     /**
26      * Return true if given object is filled
27      *
28      * @return bool
29      */
30     public function isFilled()
31     {
32         return 0 < count($this->products);
33     }
34 
35     /**
36      * @param ProductInterface $product
37      *
38      * @return $this
39      */
40     public function addProduct(ProductInterface $product)
41     {
42         $this->products[] = $product;
43 
44         return $this;
45     }
46 
47     /**
48      * @inheritdoc
49      */
50     public function getProducts()
51     {
52         return $this->products;
53     }
54 
55     /**
56      * @param array $products
57      *
58      * @return ProductCollection
59      */
60     public function setProducts(array $products)
61     {
62         $this->products = array_values($products);
63 
64         return $this;
65     }
66 
67     /**
68      * @inheritdoc
69      */
70     public function count()
71     {
72         return count($this->getProducts());
73     }
74 
75     /**
76      * @inheritdoc
77      */
78     public function getIterator()
79     {
80         return new \ArrayIterator($this->getProducts());
81     }
82 }
83 
PayU integration by Krzysztof Gzocha API documentation generated by ApiGen