1<?php
2
3namespace Facebook\WebDriver\Interactions\Internal;
4
5use Facebook\WebDriver\Exception\UnsupportedOperationException;
6use Facebook\WebDriver\WebDriverPoint;
7
8/**
9 * Interface representing basic mouse operations.
10 */
11class WebDriverCoordinates
12{
13    /**
14     * @var null
15     */
16    private $onScreen;
17    /**
18     * @var callable
19     */
20    private $inViewPort;
21    /**
22     * @var callable
23     */
24    private $onPage;
25    /**
26     * @var string
27     */
28    private $auxiliary;
29
30    /**
31     * @param null $on_screen
32     * @param callable $in_view_port
33     * @param callable $on_page
34     * @param string $auxiliary
35     */
36    public function __construct($on_screen, callable $in_view_port, callable $on_page, $auxiliary)
37    {
38        $this->onScreen = $on_screen;
39        $this->inViewPort = $in_view_port;
40        $this->onPage = $on_page;
41        $this->auxiliary = $auxiliary;
42    }
43
44    /**
45     * @throws UnsupportedOperationException
46     * @return WebDriverPoint
47     */
48    public function onScreen()
49    {
50        throw new UnsupportedOperationException(
51            'onScreen is planned but not yet supported by Selenium'
52        );
53    }
54
55    /**
56     * @return WebDriverPoint
57     */
58    public function inViewPort()
59    {
60        return call_user_func($this->inViewPort);
61    }
62
63    /**
64     * @return WebDriverPoint
65     */
66    public function onPage()
67    {
68        return call_user_func($this->onPage);
69    }
70
71    /**
72     * @return string The attached object id.
73     */
74    public function getAuxiliary()
75    {
76        return $this->auxiliary;
77    }
78}
79