Security update for permissions_by_term
[yaffs-website] / vendor / instaclick / php-webdriver / lib / WebDriver / Window.php
1 <?php
2 /**
3  * Copyright 2011-2017 Anthon Pang. All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * @package WebDriver
18  *
19  * @author Anthon Pang <apang@softwaredevelopment.ca>
20  * @author Fabrizio Branca <mail@fabrizio-branca.de>
21  */
22
23 namespace WebDriver;
24
25 /**
26  * WebDriver\Window class
27  *
28  * @package WebDriver
29  *
30  * @method array getSize() Get size of the window.
31  * @method void postSize($json) Change the size of the window.
32  * @method array getPosition() Get position of the window.
33  * @method void postPosition($json) Change position of the window.
34  * @method void maximize() Maximize the window if not already maximized.
35  */
36 final class Window extends AbstractWebDriver
37 {
38     /**
39      * Window handle
40      *
41      * @var string
42      */
43     private $windowHandle;
44
45     /**
46      * {@inheritdoc}
47      */
48     protected function methods()
49     {
50         return array(
51             'size' => array('GET', 'POST'),
52             'position' => array('GET', 'POST'),
53             'maximize' => array('POST'),
54         );
55     }
56
57     /**
58      * {@inheritdoc}
59      */
60     protected function obsoleteMethods()
61     {
62         return array(
63             'restore' => array('POST'),
64         );
65     }
66
67     /**
68      * Get window handle
69      *
70      * @return string
71      */
72     public function getHandle()
73     {
74         return $this->windowHandle;
75     }
76
77     /**
78      * Constructor
79      *
80      * @param string $url          URL
81      * @param string $windowHandle Window handle
82      */
83     public function __construct($url, $windowHandle)
84     {
85         $this->windowHandle = $windowHandle;
86
87         parent::__construct($url . '/' . $windowHandle);
88     }
89 }