Completed
Push — master ( c92ae0...dc7863 )
by Robin
03:57
created

System::getNetPath()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4286
cc 2
eloc 4
nc 2
nop 0
1
<?php
2
/**
3
 * Copyright (c) 2014 Robin Appelman <[email protected]>
4
 * This file is licensed under the Licensed under the MIT license:
5
 * http://opensource.org/licenses/MIT
6
 */
7
8
namespace Icewind\SMB;
9
10
class System {
11
	private $smbclient;
12
13
	private $net;
14
15
	public static function getFD($num) {
16
		$folders = [
17
			'/proc/self/fd/',
18
			'/proc/curproc/'
19
		];
20
		foreach ($folders as $folder) {
21
			if (file_exists($folder . $num)) {
22
				return $folder . $num;
23
			}
24
		}
25
		return '/dev/fd/' . $num;
26
	}
27
28
	public function getSmbclientPath() {
29
		if (!$this->smbclient) {
30
			$this->smbclient = trim(`which smbclient`);
31
		}
32
		return $this->smbclient;
33
	}
34
35
	public function getNetPath() {
36
		if (!$this->net) {
37
			$this->net = trim(`which net`);
38
		}
39
		return $this->net;
40
	}
41
}
42