Code Duplication    Length = 18-19 lines in 2 locations

src/Plugin/WebBrowser.php 2 locations

@@ 76-94 (lines=19) @@
73
     * @param $url
74
     * @return bool
75
     */
76
	public static function location($self, $url = null) {
77
		// TODO if ! $url return actual location ???
78
		$xhr = isset($self->document->xhr)
79
			? $self->document->xhr
80
			: null;
81
		$xhr = PhpQuery::ajax(array(
82
			'url' => $url,
83
		), $xhr);
84
		$return = false;
85
		if ($xhr->getLastResponse()->isSuccessful()) {
86
			$return = \PhpQuery\Plugin\UtilWebBrowser::browserReceive($xhr);
87
			if (isset($self->document->WebBrowserCallback))
88
				PhpQuery::callbackRun(
89
					$self->document->WebBrowserCallback,
90
					array($return)
91
				);
92
		}
93
		return $return;
94
	}
95
        
96
        
97
        public static function download($self, $url = null) {
@@ 97-114 (lines=18) @@
94
	}
95
        
96
        
97
        public static function download($self, $url = null) {
98
            $xhr = isset($self->document->xhr)
99
			? $self->document->xhr
100
			: null;
101
		$xhr = PhpQuery::ajax(array(
102
			'url' => $url,
103
		), $xhr);
104
		$return = false;
105
		if ($xhr->getLastResponse()->isSuccessful()) {
106
			$return = \PhpQuery\Plugin\UtilWebBrowser::browserDownload($xhr);
107
			if (isset($self->document->WebBrowserCallback))
108
				PhpQuery::callbackRun(
109
					$self->document->WebBrowserCallback,
110
					array($return)
111
				);
112
		}
113
		return $return;
114
        }
115
}
116
class UtilWebBrowser {
117
    /**