Completed
Push — develop ( 2c8389...1b732a )
by Mikaël
35:25
created

addToSearchExpression()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 9
rs 9.6666
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Ews\StructType;
4
5
use \WsdlToPhp\PackageBase\AbstractStructBase;
6
7
/**
8
 * This class stands for MultipleOperandBooleanExpressionType StructType
9
 * @package Ews
10
 * @subpackage Structs
11
 * @author WsdlToPhp <[email protected]>
12
 */
13
abstract class EwsMultipleOperandBooleanExpressionType extends EwsSearchExpressionType
14
{
15
    /**
16
     * The SearchExpression
17
     * Meta informations extracted from the WSDL
18
     * - maxOccurs: unbounded
19
     * - minOccurs: 1
20
     * - ref: t:SearchExpression
21
     * @var \Ews\StructType\EwsSearchExpressionType[]
22
     */
23
    public $SearchExpression;
24
    /**
25
     * Constructor method for MultipleOperandBooleanExpressionType
26
     * @uses EwsMultipleOperandBooleanExpressionType::setSearchExpression()
27
     * @param \Ews\StructType\EwsSearchExpressionType[] $searchExpression
28
     */
29
    public function __construct(array $searchExpression = array())
30
    {
31
        $this
32
            ->setSearchExpression($searchExpression);
33
    }
34
    /**
35
     * Get SearchExpression value
36
     * @return \Ews\StructType\EwsSearchExpressionType[]
37
     */
38
    public function getSearchExpression()
39
    {
40
        return $this->SearchExpression;
41
    }
42
    /**
43
     * Set SearchExpression value
44
     * @throws \InvalidArgumentException
45
     * @param \Ews\StructType\EwsSearchExpressionType[] $searchExpression
46
     * @return \Ews\StructType\EwsMultipleOperandBooleanExpressionType
47
     */
48
    public function setSearchExpression(array $searchExpression = array())
49
    {
50
        foreach ($searchExpression as $multipleOperandBooleanExpressionTypeSearchExpressionItem) {
51
            // validation for constraint: itemType
52
            if (!$multipleOperandBooleanExpressionTypeSearchExpressionItem instanceof \Ews\StructType\EwsSearchExpressionType) {
53
                throw new \InvalidArgumentException(sprintf('The SearchExpression property can only contain items of \Ews\StructType\EwsSearchExpressionType, "%s" given', is_object($multipleOperandBooleanExpressionTypeSearchExpressionItem) ? get_class($multipleOperandBooleanExpressionTypeSearchExpressionItem) : gettype($multipleOperandBooleanExpressionTypeSearchExpressionItem)), __LINE__);
54
            }
55
        }
56
        $this->SearchExpression = $searchExpression;
57
        return $this;
58
    }
59
    /**
60
     * Add item to SearchExpression value
61
     * @throws \InvalidArgumentException
62
     * @param \Ews\StructType\EwsSearchExpressionType $item
63
     * @return \Ews\StructType\EwsMultipleOperandBooleanExpressionType
64
     */
65
    public function addToSearchExpression(\Ews\StructType\EwsSearchExpressionType $item)
66
    {
67
        // validation for constraint: itemType
68
        if (!$item instanceof \Ews\StructType\EwsSearchExpressionType) {
69
            throw new \InvalidArgumentException(sprintf('The SearchExpression property can only contain items of \Ews\StructType\EwsSearchExpressionType, "%s" given', is_object($item) ? get_class($item) : gettype($item)), __LINE__);
70
        }
71
        $this->SearchExpression[] = $item;
72
        return $this;
73
    }
74
    /**
75
     * Method called when an object has been exported with var_export() functions
76
     * It allows to return an object instantiated with the values
77
     * @see AbstractStructBase::__set_state()
78
     * @uses AbstractStructBase::__set_state()
79
     * @param array $array the exported values
80
     * @return \Ews\StructType\EwsMultipleOperandBooleanExpressionType
81
     */
82
    public static function __set_state(array $array)
83
    {
84
        return parent::__set_state($array);
85
    }
86
    /**
87
     * Method returning the class name
88
     * @return string __CLASS__
89
     */
90
    public function __toString()
91
    {
92
        return __CLASS__;
93
    }
94
}
95