66abstract class AbstractCodexRepository implements CodexRepositoryInterface
77{
88 /**
9+ * The config implementation.
10+ *
911 * @var Config
1012 */
1113 protected $ config ;
1214
1315 /**
16+ * The filesystem implementation.
17+ *
1418 * @var Filesystem
1519 */
1620 protected $ files ;
1721
18- public function __construct (Config $ config , Filesyste $ files )
22+ /**
23+ * Storage path.
24+ *
25+ * @var string
26+ */
27+ protected $ storagePath ;
28+
29+ /**
30+ * Create a new AbstractCodexRepository instance.
31+ *
32+ * @param Config $config
33+ * @param Filesystem $files
34+ * @return void
35+ */
36+ public function __construct (Config $ config , Filesystem $ files )
1937 {
2038 $ this ->config = $ config ;
2139 $ this ->files = $ files ;
40+
41+ $ this ->storagePath = $ this ->config ->get ('codex.storage_path ' );
2242 }
2343
44+ /**
45+ * Get the default manual.
46+ *
47+ * @return mixed
48+ */
2449 public function getDefaultManual ()
2550 {
2651 $ manuals = $ this ->getManuals ();
@@ -38,6 +63,12 @@ public function getDefaultManual()
3863 }
3964 }
4065
66+ /**
67+ * Get the default version for the given manual.
68+ *
69+ * @param string $manual
70+ * @return string
71+ */
4172 public function getDefaultVersion ($ manual )
4273 {
4374 $ versions = $ this ->getVersions ($ manual );
@@ -55,21 +86,21 @@ public function getDefaultVersion($manual)
5586 }
5687
5788 /**
58- * Get all manuals from documentation directory.
59- *
60- * @return array
61- */
89+ * Get all manuals from documentation directory.
90+ *
91+ * @return array
92+ */
6293 public function getManuals ()
6394 {
6495 return $ this ->getDirectories ($ this ->storagePath );
6596 }
6697
6798 /**
68- * Get all versions for the given manual.
69- *
70- * @param string $manual
71- * @return array
72- */
99+ * Get all versions for the given manual.
100+ *
101+ * @param string $manual
102+ * @return array
103+ */
73104 public function getVersions ($ manual )
74105 {
75106 $ manualDir = $ this ->storagePath .'/ ' .$ manual ;
@@ -78,11 +109,11 @@ public function getVersions($manual)
78109 }
79110
80111 /**
81- * Return an array of folders within the supplied path.
82- *
83- * @param string $path
84- * @return array
85- */
112+ * Return an array of folders within the supplied path.
113+ *
114+ * @param string $path
115+ * @return array
116+ */
86117 public function getDirectories ($ path )
87118 {
88119 if ( ! $ this ->files ->exists ($ path )) {
@@ -106,12 +137,12 @@ public function getDirectories($path)
106137 }
107138
108139 /**
109- * Return the first line of the supplied page. This will (or rather should)
110- * always be an <h1> tag.
111- *
112- * @param string $page
113- * @return string
114- */
140+ * Return the first line of the supplied page. This will (or rather should)
141+ * always be an <h1> tag.
142+ *
143+ * @param string $page
144+ * @return string
145+ */
115146 protected function getPageTitle ($ page )
116147 {
117148 $ file = fopen ($ page , 'r ' );
@@ -123,13 +154,13 @@ protected function getPageTitle($page)
123154 }
124155
125156 /**
126- * Gets the given documentation page modification time.
127- *
128- * @param string $manual
129- * @param string $version
130- * @param string $page
131- * @return mixed
132- */
157+ * Gets the given documentation page modification time.
158+ *
159+ * @param string $manual
160+ * @param string $version
161+ * @param string $page
162+ * @return mixed
163+ */
133164 public function getUpdatedTimestamp ($ manual , $ version , $ page )
134165 {
135166 $ page = $ this ->storagePath .'/ ' .$ manual .'/ ' .$ version .'/ ' .$ page .'.md ' ;
0 commit comments