Browse Source

remove things that are built to stockpile

gjerokrsteski 11 years ago
parent
commit
70dd7c07e0

+ 1 - 9
php-pimf/pimf-framework/autoload.core.php

@@ -20,8 +20,7 @@ spl_autoload_register(
         'Pimf\\Cache\\Storages\\Wincache'    => '/Pimf/Cache/Storages/Wincache.php',
         'Pimf\\Cache\\Storages\\Wincache'    => '/Pimf/Cache/Storages/Wincache.php',
         'Pimf\\Cache\\Storages\\Pdo'         => '/Pimf/Cache/Storages/Pdo.php',
         'Pimf\\Cache\\Storages\\Pdo'         => '/Pimf/Cache/Storages/Pdo.php',
         'Pimf\\Cli'                          => '/Pimf/Cli.php',
         'Pimf\\Cli'                          => '/Pimf/Cli.php',
-        'Pimf\\Cli\\Color'                   => '/Pimf/Cli/Color.php',
-        'Pimf\\Cli\\Std'                      => '/Pimf/Cli/Std.php',
+        'Pimf\\Cli\\Std'                     => '/Pimf/Cli/Std.php',
         'Pimf\\Contracts\\Arrayable'         => '/Pimf/Contracts/Arrayable.php',
         'Pimf\\Contracts\\Arrayable'         => '/Pimf/Contracts/Arrayable.php',
         'Pimf\\Contracts\\Cleanable'         => '/Pimf/Contracts/Cleanable.php',
         'Pimf\\Contracts\\Cleanable'         => '/Pimf/Contracts/Cleanable.php',
         'Pimf\\Contracts\\Jsonable'          => '/Pimf/Contracts/Jsonable.php',
         'Pimf\\Contracts\\Jsonable'          => '/Pimf/Contracts/Jsonable.php',
@@ -72,9 +71,6 @@ spl_autoload_register(
         'Pimf\\Session\\Storages\\Pdo'       => '/Pimf/Session/Storages/Pdo.php',
         'Pimf\\Session\\Storages\\Pdo'       => '/Pimf/Session/Storages/Pdo.php',
         'Pimf\\Uri'                          => '/Pimf/Uri.php',
         'Pimf\\Uri'                          => '/Pimf/Uri.php',
         'Pimf\\Url'                          => '/Pimf/Url.php',
         'Pimf\\Url'                          => '/Pimf/Url.php',
-        'Pimf\\Util\\Cache'                  => '/Pimf/Util/Cache.php',
-        'Pimf\\Util\\Crypter'                => '/Pimf/Util/Crypter.php',
-        'Pimf\\Util\\Csv'                    => '/Pimf/Util/Csv.php',
         'Pimf\\Util\\Dom'                    => '/Pimf/Util/Dom.php',
         'Pimf\\Util\\Dom'                    => '/Pimf/Util/Dom.php',
         'Pimf\\Util\\File'                   => '/Pimf/Util/File.php',
         'Pimf\\Util\\File'                   => '/Pimf/Util/File.php',
         'Pimf\\Util\\Header'                 => '/Pimf/Util/Header.php',
         'Pimf\\Util\\Header'                 => '/Pimf/Util/Header.php',
@@ -83,9 +79,6 @@ spl_autoload_register(
         'Pimf\\Util\\Identifier'             => '/Pimf/Util/Identifier.php',
         'Pimf\\Util\\Identifier'             => '/Pimf/Util/Identifier.php',
         'Pimf\\Util\\IdentityMap'            => '/Pimf/Util/IdentityMap.php',
         'Pimf\\Util\\IdentityMap'            => '/Pimf/Util/IdentityMap.php',
         'Pimf\\Util\\Json'                   => '/Pimf/Util/Json.php',
         'Pimf\\Util\\Json'                   => '/Pimf/Util/Json.php',
-        'Pimf\\Util\\Ldap'                   => '/Pimf/Util/Ldap.php',
-        'Pimf\\Util\\Ldap\\User'             => '/Pimf/Util/Ldap/User.php',
-        'Pimf\\Util\\LineByLine'             => '/Pimf/Util/LineByLine.php',
         'Pimf\\Util\\Message'                => '/Pimf/Util/Message.php',
         'Pimf\\Util\\Message'                => '/Pimf/Util/Message.php',
         'Pimf\\Util\\Serializer'             => '/Pimf/Util/Serializer.php',
         'Pimf\\Util\\Serializer'             => '/Pimf/Util/Serializer.php',
         'Pimf\\Util\\String'                 => '/Pimf/Util/String.php',
         'Pimf\\Util\\String'                 => '/Pimf/Util/String.php',
@@ -95,7 +88,6 @@ spl_autoload_register(
         'Pimf\\Util\\Uuid'                   => '/Pimf/Util/Uuid.php',
         'Pimf\\Util\\Uuid'                   => '/Pimf/Util/Uuid.php',
         'Pimf\\Util\\Validator'              => '/Pimf/Util/Validator.php',
         'Pimf\\Util\\Validator'              => '/Pimf/Util/Validator.php',
         'Pimf\\Util\\Validator\\Factory'     => '/Pimf/Util/Validator/Factory.php',
         'Pimf\\Util\\Validator\\Factory'     => '/Pimf/Util/Validator/Factory.php',
-        'Pimf\\Util\\Value'                  => '/Pimf/Util/Value.php',
         'Pimf\\Util\\Xml'                    => '/Pimf/Util/Xml.php',
         'Pimf\\Util\\Xml'                    => '/Pimf/Util/Xml.php',
         'Pimf\\View'                         => '/Pimf/View.php',
         'Pimf\\View'                         => '/Pimf/View.php',
         'Pimf\\View\\Haanga'                 => '/Pimf/View/Haanga.php',
         'Pimf\\View\\Haanga'                 => '/Pimf/View/Haanga.php',

+ 1 - 1
php-pimf/pimf-framework/core/Pimf/Cache/Storages/Apc.php

@@ -79,7 +79,7 @@ class Apc extends Storage
    * @param  string $key
    * @param  string $key
    * @param  mixed  $value
    * @param  mixed  $value
    *
    *
-   * @return boolean|null
+   * @return boolean
    */
    */
   public function forever($key, $value)
   public function forever($key, $value)
   {
   {

+ 5 - 13
php-pimf/pimf-framework/core/Pimf/Cli.php

@@ -8,7 +8,6 @@
 
 
 namespace Pimf;
 namespace Pimf;
 
 
-use Pimf\Cli\Color;
 use Pimf\Util\String;
 use Pimf\Util\String;
 
 
 /**
 /**
@@ -30,13 +29,9 @@ final class Cli
    */
    */
   public static function absorb($appClr = null, $coreClr = null, $root = null)
   public static function absorb($appClr = null, $coreClr = null, $root = null)
   {
   {
-    echo Color::paint(
-      PHP_EOL . 'PIMF v' . \Pimf\Application::VERSION . ' PHP Command Line Interface by Gjero Krsteski' . PHP_EOL
-    );
+    echo PHP_EOL . 'PIMF v' . \Pimf\Application::VERSION . ' PHP Command Line Interface by Gjero Krsteski' . PHP_EOL;
 
 
-    echo Color::paint(
-      '+------------------------------------------------------+' . PHP_EOL
-    );
+    echo '+------------------------------------------------------+' . PHP_EOL;
 
 
     self::reflect(self::collect($appClr, $coreClr, $root));
     self::reflect(self::collect($appClr, $coreClr, $root));
   }
   }
@@ -56,20 +51,17 @@ final class Cli
           $methods    = $reflection->getMethods();
           $methods    = $reflection->getMethods();
           $controller = explode('_', $class);
           $controller = explode('_', $class);
 
 
-          echo Color::paint('controller: ' . strtolower(end($controller)) . '' . PHP_EOL);
+          echo 'controller: ' . strtolower(end($controller)) . '' . PHP_EOL;
 
 
           array_map(
           array_map(
             function ($method) {
             function ($method) {
               if (false !== $command = strstr($method->getName(), 'CliAction', true)) {
               if (false !== $command = strstr($method->getName(), 'CliAction', true)) {
-                echo Color::paint(PHP_EOL . ' action: ' . $command . ' ' . PHP_EOL);
+                echo PHP_EOL . ' action: ' . $command . ' ' . PHP_EOL;
               }
               }
             }, $methods
             }, $methods
           );
           );
 
 
-          echo Color::paint(
-            PHP_EOL . '+------------------------------------------------------+' . PHP_EOL
-          );
-
+          echo PHP_EOL . '+------------------------------------------------------+' . PHP_EOL;
         }
         }
 
 
       }, $classes
       }, $classes

+ 3 - 5
php-pimf/pimf-framework/core/Pimf/Cli/Std.php

@@ -16,8 +16,6 @@ namespace Pimf\Cli;
  */
  */
 class Std
 class Std
 {
 {
-  const READ = 'php://stdin';
-
   /**
   /**
    * @var resource
    * @var resource
    */
    */
@@ -26,7 +24,7 @@ class Std
   /**
   /**
    * @param string $stream
    * @param string $stream
    */
    */
-  public function __construct($stream = self::READ)
+  public function __construct($stream = 'php://stdin')
   {
   {
     $this->handle = fopen($stream, 'r');
     $this->handle = fopen($stream, 'r');
   }
   }
@@ -78,7 +76,7 @@ class Std
 
 
     while (true) {
     while (true) {
 
 
-      echo Color::paint("Please enter a " . $prompt . ":\n");
+      echo "Please enter a " . $prompt . ":\n";
 
 
       $value = $this->value();
       $value = $this->value();
 
 
@@ -86,7 +84,7 @@ class Std
         break;
         break;
       }
       }
 
 
-      echo Color::paint("Value format for " . $prompt . " is invalid!\n", 'red');
+      echo "[ Value format for " . $prompt . " is invalid! ]\n";
     }
     }
 
 
     return $value;
     return $value;

+ 2 - 7
php-pimf/pimf-framework/core/Pimf/Controller/Base.php

@@ -58,14 +58,9 @@ abstract class Base
 
 
     } else {
     } else {
 
 
-      $requestMethod = ucfirst(Registry::get('env')->REQUEST_METHOD);
       $suffix        = 'Action';
       $suffix        = 'Action';
-
-      if (!method_exists($this->request, $bag = 'from' . $requestMethod)) {
-        throw new Bomb("not supported request method=" . $requestMethod);
-      }
-
-      $action = $this->request->{$bag}()->get('action', 'index');
+      $bag           = 'from' . ucfirst(strtolower($this->response->getMethod()));
+      $action        = $this->request->{$bag}()->get('action', 'index');
 
 
       if ($conf['app']['routeable'] === true) {
       if ($conf['app']['routeable'] === true) {
 
 

+ 17 - 13
php-pimf/pimf-framework/core/Pimf/Controller/Core.php

@@ -8,7 +8,7 @@
 
 
 namespace Pimf\Controller;
 namespace Pimf\Controller;
 
 
-use Pimf\Registry, Pimf\Util\String, Pimf\Cli\Color, Pimf\Cli\Std, Pimf\Pdo\Factory, \Pimf\Controller\Exception as Bomb, Pimf\Util\File;
+use Pimf\Registry, Pimf\Util\String, Pimf\Cli\Std, Pimf\Pdo\Factory, \Pimf\Controller\Exception as Bomb, Pimf\Util\File;
 
 
 /**
 /**
  * @package Controller
  * @package Controller
@@ -35,35 +35,39 @@ class Core extends Base
     $conf = Registry::get('conf');
     $conf = Registry::get('conf');
     $app  = 'app/' . $conf['app']['name'] . '/';
     $app  = 'app/' . $conf['app']['name'] . '/';
 
 
-    $assets = array(BASE_PATH . $app . '_session/', BASE_PATH . $app . '_cache/', BASE_PATH . $app . '_database/',
-                    BASE_PATH . $app . '_templates/',);
+    $assets = array(
+      BASE_PATH . $app . '_session/',
+      BASE_PATH . $app . '_cache/',
+      BASE_PATH . $app . '_database/',
+      BASE_PATH . $app . '_templates/',
+    );
 
 
-    echo Color::paint('Check app assets' . PHP_EOL);
+    echo 'Check app assets' . PHP_EOL;
 
 
     foreach ($assets as $asset) {
     foreach ($assets as $asset) {
 
 
       if (!is_dir($asset)) {
       if (!is_dir($asset)) {
-        echo Color::paint("Please create '$asset' directory! " . PHP_EOL, 'red');
+        echo "[ Please create '$asset' directory! ]" . PHP_EOL;
       }
       }
 
 
       if (!is_writable($asset)) {
       if (!is_writable($asset)) {
-        echo Color::paint("Please make '$asset' writable! " . PHP_EOL, 'red');
+        echo "[ Please make '$asset' writable! ]" . PHP_EOL;
       }
       }
     }
     }
 
 
-    echo Color::paint('Secure root directory' . PHP_EOL);
+    echo 'Secure root directory' . PHP_EOL;
     chmod(BASE_PATH, 0755);
     chmod(BASE_PATH, 0755);
 
 
-    echo Color::paint('Secure .htaccess' . PHP_EOL);
+    echo 'Secure .htaccess' . PHP_EOL;
     chmod(BASE_PATH . '.htaccess', 0644);
     chmod(BASE_PATH . '.htaccess', 0644);
 
 
-    echo Color::paint('Secure index.php' . PHP_EOL);
+    echo 'Secure index.php' . PHP_EOL;
     chmod(BASE_PATH . 'index.php', 0644);
     chmod(BASE_PATH . 'index.php', 0644);
 
 
-    echo Color::paint('Secure autoload.core.php' . PHP_EOL);
+    echo 'Secure autoload.core.php' . PHP_EOL;
     chmod(BASE_PATH . 'pimf-framework/autoload.core.php', 0644);
     chmod(BASE_PATH . 'pimf-framework/autoload.core.php', 0644);
 
 
-    echo Color::paint('Create logging files' . PHP_EOL);
+    echo 'Create logging files' . PHP_EOL;
     $handle = fopen($file = $conf['bootstrap']['local_temp_directory'] . 'pimf-logs.txt', "at+");
     $handle = fopen($file = $conf['bootstrap']['local_temp_directory'] . 'pimf-logs.txt', "at+");
     fclose($handle);
     fclose($handle);
     chmod($file, 0777);
     chmod($file, 0777);
@@ -79,7 +83,7 @@ class Core extends Base
 
 
   public function create_session_tableCliAction()
   public function create_session_tableCliAction()
   {
   {
-    $std = new Std();
+    $std  = new Std();
     $type = $std->read('database type [mysql|sqlite]', '(mysql|sqlite)');
     $type = $std->read('database type [mysql|sqlite]', '(mysql|sqlite)');
 
 
     var_dump(
     var_dump(
@@ -89,7 +93,7 @@ class Core extends Base
 
 
   public function create_cache_tableCliAction()
   public function create_cache_tableCliAction()
   {
   {
-    $std = new Std();
+    $std  = new Std();
     $type = $std->read('database type [mysql|sqlite]', '(mysql|sqlite)');
     $type = $std->read('database type [mysql|sqlite]', '(mysql|sqlite)');
 
 
     var_dump(
     var_dump(

+ 1 - 1
php-pimf/pimf-framework/core/Pimf/EntityManager.php

@@ -49,7 +49,7 @@ class EntityManager extends Base
     }
     }
 
 
     if (!class_exists($entity)) {
     if (!class_exists($entity)) {
-      throw new \BadMethodCallException('entity "' . $entity . '" found at the data-mapper repository');
+      throw new \BadMethodCallException('entity "' . $entity . '" not found at the data-mapper repository');
     }
     }
 
 
     $model = new $entity($this->pdo);
     $model = new $entity($this->pdo);

+ 16 - 8
php-pimf/pimf-framework/core/Pimf/Response.php

@@ -56,11 +56,19 @@ class Response
     Header::clear();
     Header::clear();
   }
   }
 
 
+  /**
+   * @return string
+   */
+  public function getMethod()
+  {
+    return $this->method;
+  }
+
   public function asJSON()
   public function asJSON()
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeJson();
+    Header::asJSON();
 
 
     return $this;
     return $this;
   }
   }
@@ -69,7 +77,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeTextHTML();
+    Header::asTextHTML();
 
 
     return $this;
     return $this;
   }
   }
@@ -78,7 +86,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypePdf();
+    Header::asPDF();
 
 
     return $this;
     return $this;
   }
   }
@@ -87,7 +95,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeCsv();
+    Header::asCSV();
 
 
     return $this;
     return $this;
   }
   }
@@ -96,7 +104,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeTextPlain();
+    Header::asTextPlain();
 
 
     return $this;
     return $this;
   }
   }
@@ -105,7 +113,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeZip();
+    Header::asZIP();
 
 
     return $this;
     return $this;
   }
   }
@@ -114,7 +122,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeXZip();
+    Header::asXZIP();
 
 
     return $this;
     return $this;
   }
   }
@@ -123,7 +131,7 @@ class Response
   {
   {
     $this->preventMultipleTypes();
     $this->preventMultipleTypes();
     self::$typed = __FUNCTION__;
     self::$typed = __FUNCTION__;
-    Header::contentTypeMSWord();
+    Header::asMSWord();
 
 
     return $this;
     return $this;
   }
   }

+ 9 - 9
php-pimf/pimf-framework/core/Pimf/Util/Header/ContentType.php

@@ -15,47 +15,47 @@ namespace Pimf\Util\Header;
  */
  */
 abstract class ContentType extends ResponseStatus
 abstract class ContentType extends ResponseStatus
 {
 {
-  public static function contentTypeJson()
+  public static function asJSON()
   {
   {
     self::type('application/json; charset=utf-8');
     self::type('application/json; charset=utf-8');
   }
   }
 
 
-  public static function contentTypePdf()
+  public static function asPDF()
   {
   {
     self::type('application/pdf');
     self::type('application/pdf');
   }
   }
 
 
-  public static function contentTypeCsv()
+  public static function asCSV()
   {
   {
     self::type('text/csv');
     self::type('text/csv');
   }
   }
 
 
-  public static function contentTypeTextPlain()
+  public static function asTextPlain()
   {
   {
     self::type('text/plain');
     self::type('text/plain');
   }
   }
 
 
-  public static function contentTypeTextHTML()
+  public static function asTextHTML()
   {
   {
     self::type('text/html');
     self::type('text/html');
   }
   }
 
 
-  public static function contentTypeZip()
+  public static function asZIP()
   {
   {
     self::type('application/zip');
     self::type('application/zip');
   }
   }
 
 
-  public static function contentTypeXZip()
+  public static function asXZIP()
   {
   {
     self::type('application/x-zip');
     self::type('application/x-zip');
   }
   }
 
 
-  public static function contentTypeMSWord()
+  public static function asMSWord()
   {
   {
     self::type('application/msword');
     self::type('application/msword');
   }
   }
 
 
-  public static function contentTypeOctetStream()
+  public static function asOctetStream()
   {
   {
     self::type('application/octet-stream');
     self::type('application/octet-stream');
   }
   }

+ 1 - 1
php-pimf/pimf-framework/core/Pimf/Util/Header/ResponseStatus.php

@@ -82,7 +82,7 @@ abstract class ResponseStatus
     self::send(302, 'Found');
     self::send(302, 'Found');
   }
   }
 
 
-  public function sendNotModified()
+  public static function sendNotModified()
   {
   {
     self::send(304, 'Not Modified');
     self::send(304, 'Not Modified');
   }
   }

+ 2 - 3
php-pimf/pimf-framework/core/Pimf/Util/Uploaded/Factory.php

@@ -81,7 +81,7 @@ abstract class Factory
    *
    *
    * @return array
    * @return array
    */
    */
-  protected static function heal($data)
+  public static function heal($data)
   {
   {
     if (!is_array($data)) {
     if (!is_array($data)) {
       return $data;
       return $data;
@@ -114,5 +114,4 @@ abstract class Factory
 
 
     return $files;
     return $files;
   }
   }
-}
- 
+}

+ 1 - 1
php-pimf/pimf-framework/core/Pimf/Util/Validator.php

@@ -237,7 +237,7 @@ class Validator
    * @param string $field
    * @param string $field
    * @param string $format Find formats here http://www.php.net/manual/en/function.date.php
    * @param string $format Find formats here http://www.php.net/manual/en/function.date.php
    *
    *
-   * @return boolean|null
+   * @return boolean
    */
    */
   public function date($field, $format)
   public function date($field, $format)
   {
   {