1616// ------------------------------------------------------------------------
1717
1818/**
19- * Class PathCollectorTrait
19+ * Class FilePathCollectorTrait
2020 *
2121 * @package O2System\Spl\Traits\Collectors
2222 */
2323trait FilePathCollectorTrait
2424{
2525 /**
26- * Sub Path
26+ * FilePathCollectorTrait::$fileDirName
2727 *
2828 * @type string|null
2929 */
3030 protected $ fileDirName = null ;
3131
32- // ------------------------------------------------------------------------
33-
3432 /**
33+ * FilePathCollectorTrait::$filePaths
34+ *
3535 * List of Paths
3636 *
3737 * @type array
3838 */
3939 protected $ filePaths = [];
4040
41+ // ------------------------------------------------------------------------
42+
43+ /**
44+ * FilePathCollectorTrait::setFileDirName
45+ *
46+ * @param $fileDirName
47+ *
48+ * @return static
49+ */
4150 public function setFileDirName ($ fileDirName )
4251 {
4352 $ this ->fileDirName = $ fileDirName ;
@@ -47,24 +56,45 @@ public function setFileDirName($fileDirName)
4756
4857 // ------------------------------------------------------------------------
4958
59+ /**
60+ * FilePathCollectorTrait::removeFilePath
61+ *
62+ * @param string $filePath
63+ *
64+ * @return static
65+ */
5066 public function removeFilePath ($ filePath )
5167 {
5268 if (false !== ($ key = array_search ($ filePath , $ this ->filePaths ))) {
53- unset($ this ->filePaths [ $ key ]);
69+ unset($ this ->filePaths [$ key ]);
5470 }
5571
5672 return $ this ;
5773 }
5874
5975 // ------------------------------------------------------------------------
6076
77+ /**
78+ * FilePathCollectorTrait::getFilePaths
79+ *
80+ * @param bool $reverse
81+ *
82+ * @return array
83+ */
6184 public function getFilePaths ($ reverse = false )
6285 {
6386 return ($ reverse === true ? array_reverse ($ this ->filePaths ) : $ this ->filePaths );
6487 }
6588
6689 // ------------------------------------------------------------------------
6790
91+ /**
92+ * FilePathCollectorTrait::setFilePaths
93+ *
94+ * @param array $filePaths
95+ *
96+ * @return static
97+ */
6898 public function setFilePaths (array $ filePaths )
6999 {
70100 $ this ->filePaths = [];
@@ -75,6 +105,13 @@ public function setFilePaths(array $filePaths)
75105
76106 // ------------------------------------------------------------------------
77107
108+ /**
109+ * FilePathCollectorTrait::addFilePaths
110+ *
111+ * @param array $filePaths
112+ *
113+ * @return static
114+ */
78115 public function addFilePaths (array $ filePaths )
79116 {
80117 foreach ($ filePaths as $ filePath ) {
@@ -86,6 +123,14 @@ public function addFilePaths(array $filePaths)
86123
87124 // ------------------------------------------------------------------------
88125
126+ /**
127+ * FilePathCollectorTrait::addFilePath
128+ *
129+ * @param string $filePath
130+ * @param string|int|null $offset
131+ *
132+ * @return static
133+ */
89134 public function addFilePath ($ filePath , $ offset = null )
90135 {
91136 $ filePath = rtrim (
@@ -105,12 +150,20 @@ public function addFilePath($filePath, $offset = null)
105150 }
106151
107152 // ------------------------------------------------------------------------
108-
153+
154+ /**
155+ * FilePathCollectorTrait::pushFilePath
156+ *
157+ * @param string $filePath
158+ * @param string|int|null $offset
159+ *
160+ * @return static
161+ */
109162 public function pushFilePath ($ filePath , $ offset = null )
110163 {
111- if (is_dir ($ filePath ) AND ! in_array ($ filePath , $ this ->filePaths )) {
164+ if (is_dir ($ filePath ) AND !in_array ($ filePath , $ this ->filePaths )) {
112165 if (isset ($ offset )) {
113- $ this ->filePaths [ $ offset ] = $ filePath ;
166+ $ this ->filePaths [$ offset ] = $ filePath ;
114167 } else {
115168 $ this ->filePaths [] = $ filePath ;
116169 }
0 commit comments