Mark V
1: <?php
2: namespace MOC\V\Core\SecureKernel\Component\Bridge\Repository\SFTP;
3:
4: use MOC\V\Core\SecureKernel\Component\Bridge\Repository\SFTP;
5:
6: /**
7: * Class Directory
8: *
9: * @package MOC\V\Core\SecureKernel\Component\Bridge\Repository\SFTP
10: */
11: class Directory
12: {
13:
14: /** @var string $Name */
15: private $Name = '';
16: /** @var string $Permission */
17: private $Permission = '';
18: /** @var string $Mode */
19: private $Mode = '';
20: /** @var int $LastAccess */
21: private $LastAccess = 0;
22: /** @var int $LastChange */
23: private $LastChange = 0;
24:
25: /** @var null|SFTP $Connection */
26: private $Connection = null;
27:
28: /**
29: * @param SFTP $Connection
30: * @param array $Attributes
31: */
32: public function __construct(SFTP $Connection, $Attributes)
33: {
34:
35: $this->Name = $Attributes['filename'];
36: $this->Permission = substr(decoct($Attributes['permissions']), -4);
37: $this->Mode = substr(decoct($Attributes['mode']), -4);
38: $this->LastAccess = $Attributes['atime'];
39: $this->LastChange = $Attributes['mtime'];
40: $this->Connection = $Connection;
41: }
42:
43: /**
44: * @return string
45: */
46: public function getPermission()
47: {
48:
49: return $this->Permission;
50: }
51:
52: /**
53: * @return string
54: */
55: public function getMode()
56: {
57:
58: return $this->Mode;
59: }
60:
61: /**
62: * @return int
63: */
64: public function getLastAccess()
65: {
66:
67: return $this->LastAccess;
68: }
69:
70: /**
71: * @return int
72: */
73: public function getLastChange()
74: {
75:
76: return $this->LastChange;
77: }
78:
79: /**
80: * @return SFTP\Directory[]|SFTP\File[]
81: */
82: public function listDirectory()
83: {
84:
85: return $this->Connection->listDirectory($this->getName());
86: }
87:
88: /**
89: * @return string
90: */
91: public function getName()
92: {
93:
94: return $this->Name;
95: }
96: }
97: