aboutsummaryrefslogtreecommitdiff
path: root/src/phar-stub.php
diff options
context:
space:
mode:
authorChristian Weiske <cweiske@cweiske.de>2014-03-20 17:03:06 +0100
committerChristian Weiske <cweiske@cweiske.de>2014-03-20 17:03:06 +0100
commit6032c11d7a88651d85154ffe835a26b3f569c893 (patch)
treeb3cb83cb8d7dbcfa23891b84e3f0447c31e743c8 /src/phar-stub.php
parent62842c0ba16bb1dc67435dea7b4d75af7773eacb (diff)
downloadbdrem-6032c11d7a88651d85154ffe835a26b3f569c893.tar.gz
bdrem-6032c11d7a88651d85154ffe835a26b3f569c893.zip
add docblocks to all files, classes, methods and variables
Diffstat (limited to 'src/phar-stub.php')
-rw-r--r--src/phar-stub.php22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/phar-stub.php b/src/phar-stub.php
index 58ee78e..64c463e 100644
--- a/src/phar-stub.php
+++ b/src/phar-stub.php
@@ -1,4 +1,16 @@
<?php
+/**
+ * Phar stub file for bdrem. Handles startup of the .phar file.
+ *
+ * PHP version 5
+ *
+ * @category Tools
+ * @package Bdrem
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @copyright 2014 Christian Weiske
+ * @license http://www.gnu.org/licenses/agpl.html GNU AGPL v3
+ * @link http://cweiske.de/bdrem.htm
+ */
if (!in_array('phar', stream_get_wrappers()) || !class_exists('Phar', false)) {
echo "Phar extension not avaiable\n";
exit(255);
@@ -7,6 +19,14 @@ if (!in_array('phar', stream_get_wrappers()) || !class_exists('Phar', false)) {
$web = 'www/index.php';
$cli = 'bin/phar-bdrem.php';
+/**
+ * Rewrite the HTTP request path to an internal file.
+ * Maps "" and "/" to "www/index.php".
+ *
+ * @param string $path Path from the browser, relative to the .phar
+ *
+ * @return string Internal path.
+ */
function rewritePath($path)
{
if ($path == '' || $path == '/') {
@@ -21,6 +41,6 @@ set_include_path(
. PATH_SEPARATOR . 'phar://' . __FILE__ . '/lib/'
);
Phar::webPhar(null, $web, null, array(), 'rewritePath');
-include 'phar://' . __FILE__ . '/' . $cli;
+require 'phar://' . __FILE__ . '/' . $cli;
__HALT_COMPILER();
?>