1<?php 2 3namespace Facebook\WebDriver\Interactions\Touch; 4 5use Facebook\WebDriver\Interactions\Internal\WebDriverCoordinates; 6use Facebook\WebDriver\Internal\WebDriverLocatable; 7 8/** 9 * Base class for all touch-related actions. 10 */ 11abstract class WebDriverTouchAction 12{ 13 /** 14 * @var WebDriverTouchScreen 15 */ 16 protected $touchScreen; 17 /** 18 * @var WebDriverLocatable 19 */ 20 protected $locationProvider; 21 22 /** 23 * @param WebDriverTouchScreen $touch_screen 24 * @param WebDriverLocatable $location_provider 25 */ 26 public function __construct( 27 WebDriverTouchScreen $touch_screen, 28 WebDriverLocatable $location_provider = null 29 ) { 30 $this->touchScreen = $touch_screen; 31 $this->locationProvider = $location_provider; 32 } 33 34 /** 35 * @return null|WebDriverCoordinates 36 */ 37 protected function getActionLocation() 38 { 39 return $this->locationProvider !== null 40 ? $this->locationProvider->getCoordinates() : null; 41 } 42} 43