From 1cb6bc3424616d8380530548886acfb9c2207449 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 20 Aug 2015 08:28:55 +0300 Subject: [PATCH 01/48] Fixed #473 issue --- templates/project/cli/services.php | 2 +- templates/project/micro/services.php | 4 ++-- templates/project/modules/services.php | 8 ++++---- templates/project/simple/services.php | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/project/cli/services.php b/templates/project/cli/services.php index f0dfc0cfd..e0a1c0d2d 100644 --- a/templates/project/cli/services.php +++ b/templates/project/cli/services.php @@ -6,6 +6,6 @@ * @var \Phalcon\Di\FactoryDefault\Cli $di */ -$di->set('config', function () use ($config) { +$di->setShared('config', function () use ($config) { return $config; }); diff --git a/templates/project/micro/services.php b/templates/project/micro/services.php index bfbeb897b..1097a0577 100644 --- a/templates/project/micro/services.php +++ b/templates/project/micro/services.php @@ -24,7 +24,7 @@ /** * The URL component is used to generate all kind of urls in the application */ -$di->set('url', function () use ($config) { +$di->setShared('url', function () use ($config) { $url = new UrlResolver(); $url->setBaseUri($config->application->baseUri); return $url; @@ -33,6 +33,6 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); diff --git a/templates/project/modules/services.php b/templates/project/modules/services.php index 9e9407e39..cc5f24a31 100644 --- a/templates/project/modules/services.php +++ b/templates/project/modules/services.php @@ -22,7 +22,7 @@ /** * Registering a router */ -$di->set('router', function () { +$di->setShared('router', function () { $router = new Router(); $router->setDefaultModule('frontend'); @@ -34,7 +34,7 @@ /** * The URL component is used to generate all kinds of URLs in the application */ -$di->set('url', function () { +$di->setShared('url', function () { $url = new UrlResolver(); $url->setBaseUri('/@@name@@/'); @@ -71,14 +71,14 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); /** * If the configuration specify the use of metadata adapter use it or use memory otherwise */ -$di->set('modelsMetadata', function () { +$di->setShared('modelsMetadata', function () { return new MetaDataAdapter(); }); diff --git a/templates/project/simple/services.php b/templates/project/simple/services.php index 4ee1c200b..f554ded9d 100644 --- a/templates/project/simple/services.php +++ b/templates/project/simple/services.php @@ -21,12 +21,12 @@ /** * The URL component is used to generate all kind of urls in the application */ -$di->set('url', function () use ($config) { +$di->setShared('url', function () use ($config) { $url = new UrlResolver(); $url->setBaseUri($config->application->baseUri); return $url; -}, true); +}); /** * Setting up the view component @@ -58,14 +58,14 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); /** * If the configuration specify the use of metadata adapter use it or use memory otherwise */ -$di->set('modelsMetadata', function () { +$di->setShared('modelsMetadata', function () { return new MetaDataAdapter(); }); From 615200d8e29989a6ae75fd92ba957f59f96400f2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 20:40:19 +0300 Subject: [PATCH 02/48] Fixed #475 issue --- scripts/Phalcon/Builder/Model.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/Phalcon/Builder/Model.php b/scripts/Phalcon/Builder/Model.php index b27f3b5fd..43bc139ba 100644 --- a/scripts/Phalcon/Builder/Model.php +++ b/scripts/Phalcon/Builder/Model.php @@ -196,20 +196,22 @@ public function build() $db = new $adapterName($configArray); $initialize = array(); + if ($this->options->contains('schema')) { $schema = $this->options->get('schema'); if ($schema != $config->database->dbname) { - $initialize[] = $this->snippet->getThisMethod('setSchema', $schema); + $initialize['schema'] = $this->snippet->getThisMethod('setSchema', $schema); } + } elseif ($adapter == 'Postgresql') { $schema = 'public'; - $initialize[] = $initialize[] = $this->snippet->getThisMethod('setSchema', $schema); + $initialize['schema'] = $this->snippet->getThisMethod('setSchema', $schema); } else { $schema = $config->database->dbname; } $table = $this->options->get('name'); - if ($this->options->get('fileName') != $this->options->get('name')) { + if ($this->options->get('fileName') != $table && !isset($initialize['schema'])) { $initialize[] = $this->snippet->getThisMethod('setSource', '\'' . $table . '\''); } From c549f45367b6884b2b38106be844c21d9747efef Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 20 Aug 2015 08:28:55 +0300 Subject: [PATCH 03/48] Fixed #473 issue --- templates/project/cli/services.php | 2 +- templates/project/micro/services.php | 4 ++-- templates/project/modules/services.php | 8 ++++---- templates/project/simple/services.php | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/templates/project/cli/services.php b/templates/project/cli/services.php index f0dfc0cfd..e0a1c0d2d 100644 --- a/templates/project/cli/services.php +++ b/templates/project/cli/services.php @@ -6,6 +6,6 @@ * @var \Phalcon\Di\FactoryDefault\Cli $di */ -$di->set('config', function () use ($config) { +$di->setShared('config', function () use ($config) { return $config; }); diff --git a/templates/project/micro/services.php b/templates/project/micro/services.php index bfbeb897b..1097a0577 100644 --- a/templates/project/micro/services.php +++ b/templates/project/micro/services.php @@ -24,7 +24,7 @@ /** * The URL component is used to generate all kind of urls in the application */ -$di->set('url', function () use ($config) { +$di->setShared('url', function () use ($config) { $url = new UrlResolver(); $url->setBaseUri($config->application->baseUri); return $url; @@ -33,6 +33,6 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); diff --git a/templates/project/modules/services.php b/templates/project/modules/services.php index 9e9407e39..cc5f24a31 100644 --- a/templates/project/modules/services.php +++ b/templates/project/modules/services.php @@ -22,7 +22,7 @@ /** * Registering a router */ -$di->set('router', function () { +$di->setShared('router', function () { $router = new Router(); $router->setDefaultModule('frontend'); @@ -34,7 +34,7 @@ /** * The URL component is used to generate all kinds of URLs in the application */ -$di->set('url', function () { +$di->setShared('url', function () { $url = new UrlResolver(); $url->setBaseUri('/@@name@@/'); @@ -71,14 +71,14 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); /** * If the configuration specify the use of metadata adapter use it or use memory otherwise */ -$di->set('modelsMetadata', function () { +$di->setShared('modelsMetadata', function () { return new MetaDataAdapter(); }); diff --git a/templates/project/simple/services.php b/templates/project/simple/services.php index 4ee1c200b..f554ded9d 100644 --- a/templates/project/simple/services.php +++ b/templates/project/simple/services.php @@ -21,12 +21,12 @@ /** * The URL component is used to generate all kind of urls in the application */ -$di->set('url', function () use ($config) { +$di->setShared('url', function () use ($config) { $url = new UrlResolver(); $url->setBaseUri($config->application->baseUri); return $url; -}, true); +}); /** * Setting up the view component @@ -58,14 +58,14 @@ /** * Database connection is created based in the parameters defined in the configuration file */ -$di->set('db', function () use ($config) { +$di->setShared('db', function () use ($config) { return new DbAdapter($config->database->toArray()); }); /** * If the configuration specify the use of metadata adapter use it or use memory otherwise */ -$di->set('modelsMetadata', function () { +$di->setShared('modelsMetadata', function () { return new MetaDataAdapter(); }); From 2e08f4bdf4b678427ca032f355a21b0a7a454c10 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 20:48:54 +0300 Subject: [PATCH 04/48] Simplified migration code --- scripts/Phalcon/Migrations.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/Phalcon/Migrations.php b/scripts/Phalcon/Migrations.php index 9e2654ad2..dff6d3eb6 100644 --- a/scripts/Phalcon/Migrations.php +++ b/scripts/Phalcon/Migrations.php @@ -90,12 +90,12 @@ public static function generate(array $options) mkdir($migrationsDir.'/'.$version); } - if (isset($config->database)) { - ModelMigration::setup($config->database); - } else { + if (!isset($config->database)) { throw new \Exception("Cannot load database configuration"); } + ModelMigration::setup($config->database); + ModelMigration::setSkipAutoIncrement($options['no-ai']); ModelMigration::setMigrationPath($migrationsDir.'/'.$version); if ($tableName == 'all') { @@ -166,10 +166,10 @@ public static function run(array $options) if (count($versions) == 0) { throw new ModelException('Migrations were not found at '.$migrationsDir); - } else { - if ($version === null) { - $version = VersionItem::maximum($versions); - } + } + + if ($version === null) { + $version = VersionItem::maximum($versions); } if (is_file($path.'.phalcon')) { @@ -184,12 +184,12 @@ public static function run(array $options) $fromVersion = null; } - if (isset($config->database)) { - ModelMigration::setup($config->database); - } else { + if (!isset($config->database)) { throw new \Exception("Cannot load database configuration"); } + ModelMigration::setup($config->database); + ModelMigration::setMigrationPath($migrationsDir.'/'.$version . '/') ; $versionsBetween = VersionItem::between($fromVersion, $version, $versions); From 4d39b33ea23078b7438006fba9ed6ad5eeac7f8b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 20:49:30 +0300 Subject: [PATCH 05/48] Fixed Version\Item::between doc --- scripts/Phalcon/Version/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Phalcon/Version/Item.php b/scripts/Phalcon/Version/Item.php index 3077aae42..e12e3df63 100644 --- a/scripts/Phalcon/Version/Item.php +++ b/scripts/Phalcon/Version/Item.php @@ -138,7 +138,7 @@ public static function maximum($versions) * @param string $initialVersion * @param string $finalVersion * @param array $versions Item[] - * @return boolean + * @return array */ public static function between($initialVersion, $finalVersion, $versions) { From abf8e6592410b8ae5daa4b97304691cee186b671 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 21:23:30 +0300 Subject: [PATCH 06/48] Fixed #476 issue --- templates/project/micro/services.php | 9 +++++++-- templates/project/modules/services.php | 15 ++++++++++----- templates/project/simple/services.php | 9 +++++++-- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/templates/project/micro/services.php b/templates/project/micro/services.php index 1097a0577..d350a425e 100644 --- a/templates/project/micro/services.php +++ b/templates/project/micro/services.php @@ -8,7 +8,6 @@ use Phalcon\Mvc\View\Simple as View; use Phalcon\Mvc\Url as UrlResolver; use Phalcon\Di\FactoryDefault; -use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter; $di = new FactoryDefault(); @@ -34,5 +33,11 @@ * Database connection is created based in the parameters defined in the configuration file */ $di->setShared('db', function () use ($config) { - return new DbAdapter($config->database->toArray()); + $dbConfig = $config->database->toArray(); + $adapter = $dbConfig['adapter']; + unset($dbConfig['adapter']); + + $class = 'Phalcon\Db\Adapter\Pdo\\' . $adapter; + + return new $class($dbConfig); }); diff --git a/templates/project/modules/services.php b/templates/project/modules/services.php index cc5f24a31..33877fb27 100644 --- a/templates/project/modules/services.php +++ b/templates/project/modules/services.php @@ -9,7 +9,6 @@ use Phalcon\Mvc\Url as UrlResolver; use Phalcon\Di\FactoryDefault; use Phalcon\Session\Adapter\Files as SessionAdapter; -use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter; use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter; use Phalcon\Mvc\View; use Phalcon\Mvc\View\Engine\Volt as VoltEngine; @@ -72,7 +71,13 @@ * Database connection is created based in the parameters defined in the configuration file */ $di->setShared('db', function () use ($config) { - return new DbAdapter($config->database->toArray()); + $dbConfig = $config->database->toArray(); + $adapter = $dbConfig['adapter']; + unset($dbConfig['adapter']); + + $class = 'Phalcon\Db\Adapter\Pdo\\' . $adapter; + + return new $class($dbConfig); }); /** @@ -96,7 +101,7 @@ * Set the default namespace for dispatcher */ $di->setShared('dispatcher', function() use ($di) { - $dispatcher = new Phalcon\Mvc\Dispatcher(); - $dispatcher->setDefaultNamespace('@@namespace@@\Frontend\Controllers'); - return $dispatcher; + $dispatcher = new Phalcon\Mvc\Dispatcher(); + $dispatcher->setDefaultNamespace('@@namespace@@\Frontend\Controllers'); + return $dispatcher; }); diff --git a/templates/project/simple/services.php b/templates/project/simple/services.php index f554ded9d..42093ca7c 100644 --- a/templates/project/simple/services.php +++ b/templates/project/simple/services.php @@ -8,7 +8,6 @@ use Phalcon\Di\FactoryDefault; use Phalcon\Mvc\View; use Phalcon\Mvc\Url as UrlResolver; -use Phalcon\Db\Adapter\Pdo\Mysql as DbAdapter; use Phalcon\Mvc\View\Engine\Volt as VoltEngine; use Phalcon\Mvc\Model\Metadata\Memory as MetaDataAdapter; use Phalcon\Session\Adapter\Files as SessionAdapter; @@ -59,7 +58,13 @@ * Database connection is created based in the parameters defined in the configuration file */ $di->setShared('db', function () use ($config) { - return new DbAdapter($config->database->toArray()); + $dbConfig = $config->database->toArray(); + $adapter = $dbConfig['adapter']; + unset($dbConfig['adapter']); + + $class = 'Phalcon\Db\Adapter\Pdo\\' . $adapter; + + return new $class($dbConfig); }); /** From ce1e929b0aa65fcf995ab221798ee4d03092c202 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 21:48:59 +0300 Subject: [PATCH 07/48] Fixed indents --- scripts/Phalcon/Mvc/Model/Migration.php | 114 ++++++++++++------------ 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 95fc6bb66..032411865 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -181,63 +181,63 @@ public static function generate($version, $table, $exportData=null) $description = self::$_connection->describeColumns($table, $defaultSchema); foreach ($description as $field) { $fieldDefinition = array(); - switch ($field->getType()) { - case Column::TYPE_INTEGER: - $fieldDefinition[] = "'type' => Column::TYPE_INTEGER"; - $numericFields[ $field->getName() ] = true; - break; - case Column::TYPE_VARCHAR: - $fieldDefinition[] = "'type' => Column::TYPE_VARCHAR"; - break; - case Column::TYPE_CHAR: - $fieldDefinition[] = "'type' => Column::TYPE_CHAR"; - break; - case Column::TYPE_DATE: - $fieldDefinition[] = "'type' => Column::TYPE_DATE"; - break; - case Column::TYPE_DATETIME: - $fieldDefinition[] = "'type' => Column::TYPE_DATETIME"; - break; - case Column::TYPE_DECIMAL: - $fieldDefinition[] = "'type' => Column::TYPE_DECIMAL"; - $numericFields[ $field->getName() ] = true; - break; - case Column::TYPE_TEXT: - $fieldDefinition[] = "'type' => Column::TYPE_TEXT"; - break; - case Column::TYPE_BOOLEAN: - $fieldDefinition[] = "'type' => Column::TYPE_BOOLEAN"; - break; - case Column::TYPE_FLOAT: - $fieldDefinition[] = "'type' => Column::TYPE_FLOAT"; - break; - case Column::TYPE_DOUBLE: - $fieldDefinition[] = "'type' => Column::TYPE_DOUBLE"; - break; - case Column::TYPE_TINYBLOB: - $fieldDefinition[] = "'type' => Column::TYPE_TINYBLOB"; - break; - case Column::TYPE_BLOB: - $fieldDefinition[] = "'type' => Column::TYPE_BLOB"; - break; - case Column::TYPE_MEDIUMBLOB: - $fieldDefinition[] = "'type' => Column::TYPE_MEDIUMBLOB"; - break; - case Column::TYPE_LONGBLOB: - $fieldDefinition[] = "'type' => Column::TYPE_LONGBLOB"; - break; - case Column::TYPE_JSON: - $fieldDefinition[] = "'type' => Column::TYPE_JSON"; - break; - case Column::TYPE_JSONB: - $fieldDefinition[] = "'type' => Column::TYPE_JSONB"; - break; - case Column::TYPE_BIGINTEGER: - $fieldDefinition[] = "'type' => Column::TYPE_BIGINTEGER"; - break; - default: - throw new Exception('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); - } + switch ($field->getType()) { + case Column::TYPE_INTEGER: + $fieldDefinition[] = "'type' => Column::TYPE_INTEGER"; + $numericFields[ $field->getName() ] = true; + break; + case Column::TYPE_VARCHAR: + $fieldDefinition[] = "'type' => Column::TYPE_VARCHAR"; + break; + case Column::TYPE_CHAR: + $fieldDefinition[] = "'type' => Column::TYPE_CHAR"; + break; + case Column::TYPE_DATE: + $fieldDefinition[] = "'type' => Column::TYPE_DATE"; + break; + case Column::TYPE_DATETIME: + $fieldDefinition[] = "'type' => Column::TYPE_DATETIME"; + break; + case Column::TYPE_DECIMAL: + $fieldDefinition[] = "'type' => Column::TYPE_DECIMAL"; + $numericFields[ $field->getName() ] = true; + break; + case Column::TYPE_TEXT: + $fieldDefinition[] = "'type' => Column::TYPE_TEXT"; + break; + case Column::TYPE_BOOLEAN: + $fieldDefinition[] = "'type' => Column::TYPE_BOOLEAN"; + break; + case Column::TYPE_FLOAT: + $fieldDefinition[] = "'type' => Column::TYPE_FLOAT"; + break; + case Column::TYPE_DOUBLE: + $fieldDefinition[] = "'type' => Column::TYPE_DOUBLE"; + break; + case Column::TYPE_TINYBLOB: + $fieldDefinition[] = "'type' => Column::TYPE_TINYBLOB"; + break; + case Column::TYPE_BLOB: + $fieldDefinition[] = "'type' => Column::TYPE_BLOB"; + break; + case Column::TYPE_MEDIUMBLOB: + $fieldDefinition[] = "'type' => Column::TYPE_MEDIUMBLOB"; + break; + case Column::TYPE_LONGBLOB: + $fieldDefinition[] = "'type' => Column::TYPE_LONGBLOB"; + break; + case Column::TYPE_JSON: + $fieldDefinition[] = "'type' => Column::TYPE_JSON"; + break; + case Column::TYPE_JSONB: + $fieldDefinition[] = "'type' => Column::TYPE_JSONB"; + break; + case Column::TYPE_BIGINTEGER: + $fieldDefinition[] = "'type' => Column::TYPE_BIGINTEGER"; + break; + default: + throw new Exception('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); + } //if ($field->isPrimary()) { // $fieldDefinition[] = "'primary' => true"; From a12ed05daf4595cffca68b06c366bbb301c46460 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 22:03:41 +0300 Subject: [PATCH 08/48] Fixed Migration doc & exception class --- scripts/Phalcon/Mvc/Model/Migration.php | 28 ++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 032411865..1ca598ab2 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -25,7 +25,7 @@ use Phalcon\Migrations; use Phalcon\Db\Column; use Phalcon\Mvc\Model\Migration\Profiler; -use Phalcon\Mvc\Model\Exception; +use Phalcon\Db\Exception as DbException; use Phalcon\Events\Manager as EventsManager; /** @@ -41,7 +41,7 @@ class Migration { /** * Migration database connection - * @var \Phalcon\Db + * @var \Phalcon\Db\AdapterInterface */ protected static $_connection; @@ -66,20 +66,20 @@ class Migration /** * Prepares component * - * @param $database + * @param \Phalcon\Config $database Database config * - * @throws \Phalcon\Exception + * @throws \Phalcon\Db\Exception */ public static function setup($database) { if (!isset($database->adapter)) { - throw new \Phalcon\Exception('Unspecified database Adapter in your configuration!'); + throw new DbException('Unspecified database Adapter in your configuration!'); } $adapter = '\\Phalcon\\Db\\Adapter\\Pdo\\' . $database->adapter; if (!class_exists($adapter)) { - throw new \Phalcon\Exception('Invalid database Adapter!'); + throw new DbException('Invalid database Adapter!'); } $configArray = $database->toArray(); @@ -159,7 +159,7 @@ public static function generateAll($version, $exportData = null) * @param null $exportData * * @return string - * @throws Exception + * @throws \Phalcon\Db\Exception */ public static function generate($version, $table, $exportData=null) { @@ -177,8 +177,8 @@ public static function generate($version, $table, $exportData=null) } else { $defaultSchema = null; } - $description = self::$_connection->describeColumns($table, $defaultSchema); + print_r($description); foreach ($description as $field) { $fieldDefinition = array(); switch ($field->getType()) { @@ -236,7 +236,7 @@ public static function generate($version, $table, $exportData=null) $fieldDefinition[] = "'type' => Column::TYPE_BIGINTEGER"; break; default: - throw new Exception('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); + throw new DbException('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); } //if ($field->isPrimary()) { @@ -387,7 +387,7 @@ class ".$className." extends Migration\n". * @param $version * @param $filePath * - * @throws Exception + * @throws \Phalcon\Db\Exception */ public static function migrateFile($version, $filePath) { @@ -398,7 +398,7 @@ public static function migrateFile($version, $filePath) require_once $filePath; if (!class_exists($className)) { - throw new Exception('Migration class cannot be found ' . $className . ' at ' . $filePath); + throw new DbException('Migration class cannot be found ' . $className . ' at ' . $filePath); } $migration = new $className(); @@ -417,7 +417,7 @@ public static function migrateFile($version, $filePath) * @param $tableName * @param $definition * - * @throws Exception + * @throws \Phalcon\Db\Exception */ public function morphTable($tableName, $definition) { @@ -430,13 +430,13 @@ public function morphTable($tableName, $definition) $tableExists = self::$_connection->tableExists($tableName, $defaultSchema); if (isset($definition['columns'])) { if (count($definition['columns']) == 0) { - throw new Exception('Table must have at least one column'); + throw new DbException('Table must have at least one column'); } $fields = array(); foreach ($definition['columns'] as $tableColumn) { if (!is_object($tableColumn)) { - throw new Exception('Table must have at least one column'); + throw new DbException('Table must have at least one column'); } $fields[$tableColumn->getName()] = $tableColumn; } From df5d6f33ec611a2768deab324f34ad3fffa3c0b8 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 24 Aug 2015 23:46:57 +0300 Subject: [PATCH 09/48] Fixed #429 issue --- scripts/Phalcon/Mvc/Model/Migration.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 1ca598ab2..58d938c46 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -178,8 +178,9 @@ public static function generate($version, $table, $exportData=null) $defaultSchema = null; } $description = self::$_connection->describeColumns($table, $defaultSchema); - print_r($description); + foreach ($description as $field) { + /** @var \Phalcon\Db\Column $field */ $fieldDefinition = array(); switch ($field->getType()) { case Column::TYPE_INTEGER: @@ -239,6 +240,9 @@ public static function generate($version, $table, $exportData=null) throw new DbException('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); } + if (null !== ($default = $field->getDefault())) { + $fieldDefinition[] = "'default' => '$default'"; + } //if ($field->isPrimary()) { // $fieldDefinition[] = "'primary' => true"; //} @@ -421,10 +425,10 @@ public static function migrateFile($version, $filePath) */ public function morphTable($tableName, $definition) { + $defaultSchema = null; + if (isset(self::$_databaseConfig->dbname)) { $defaultSchema = self::$_databaseConfig->dbname; - } else { - $defaultSchema = null; } $tableExists = self::$_connection->tableExists($tableName, $defaultSchema); From 9ee052a19427dd4b1d97b527ff06227ee6fba67f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 26 Aug 2015 21:47:08 +0300 Subject: [PATCH 10/48] Update CONTRIBUTING.md --- CONTRIBUTING.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7d0329981..e27cefde1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,18 +1,25 @@ # Contributing to Phalcon Developer Tools -Phalcon Developer Tools is an open source project and a volunteer effort. Phalcon Developer Tools welcomes contribution from everyone. +Phalcon Developer Tools is an open source project and a volunteer effort. -Contributions to Phalcon Developer Tools should be made in the form of GitHub pull requests. *We only accept bug reports, new feature requests and pull requests in GitHub*. +We are welcome contribution from everyone. Contributions to Phalcon Developer Tools should be made in the form of GitHub [pull requests][0]. +*We only accept bug reports, new feature requests and pull requests in GitHub*. -IDE stubs must not be modified manually, if you want to improve them please submit a PR to [cphalcon](https://github.com/phalcon/cphalcon). +IDE stubs must not be modified manually, if you want to improve them please submit a PR to [cphalcon][1]. ## Getting Support -For questions regarding the usage of the framework or support requests please visit the [official forums](http://forum.phalconphp.com/). +For questions regarding the usage of the Phalcon Developer Tools or support requests please visit the [official forums][2]. ## Requesting Features -If you have a change or new feature in mind, please fill an [NFR](https://github.com/phalcon/cphalcon/wiki/New-Feature-Request---NFR). +If you have a change or new feature in mind, please fill an [NFR][3]. Thanks!
Phalcon Team + + +[0]: https://help.github.com/articles/using-pull-requests/ +[1]: https://github.com/phalcon/cphalcon +[2]: http://forum.phalconphp.com/ +[3]: https://github.com/phalcon/cphalcon/wiki/New-Feature-Request---NFR From 9b7871fdf748a5990586ac6e9625ca8310f21335 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 26 Aug 2015 21:47:53 +0300 Subject: [PATCH 11/48] Added support for Column::TYPE_TIMESTAMP for migration --- scripts/Phalcon/Mvc/Model/Migration.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 58d938c46..1360dd43a 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -199,6 +199,9 @@ public static function generate($version, $table, $exportData=null) case Column::TYPE_DATETIME: $fieldDefinition[] = "'type' => Column::TYPE_DATETIME"; break; + case 17: // If so, then Phalcon is support for Column::TYPE_TIMESTAMP constant + $fieldDefinition[] = "'type' => Column::TYPE_TIMESTAMP"; + break; case Column::TYPE_DECIMAL: $fieldDefinition[] = "'type' => Column::TYPE_DECIMAL"; $numericFields[ $field->getName() ] = true; @@ -234,8 +237,8 @@ public static function generate($version, $table, $exportData=null) $fieldDefinition[] = "'type' => Column::TYPE_JSONB"; break; case Column::TYPE_BIGINTEGER: - $fieldDefinition[] = "'type' => Column::TYPE_BIGINTEGER"; - break; + $fieldDefinition[] = "'type' => Column::TYPE_BIGINTEGER"; + break; default: throw new DbException('Unrecognized data type ' . $field->getType() . ' at column ' . $field->getName()); } From e04d581bcfaa468186aaf844ee77edd19f9c7759 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 27 Aug 2015 02:04:13 +0300 Subject: [PATCH 12/48] Fixed morph default column value --- scripts/Phalcon/Mvc/Model/Migration.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 1360dd43a..0c56e8a6d 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -180,7 +180,7 @@ public static function generate($version, $table, $exportData=null) $description = self::$_connection->describeColumns($table, $defaultSchema); foreach ($description as $field) { - /** @var \Phalcon\Db\Column $field */ + /** @var \Phalcon\Db\ColumnInterface $field */ $fieldDefinition = array(); switch ($field->getType()) { case Column::TYPE_INTEGER: @@ -445,20 +445,27 @@ public function morphTable($tableName, $definition) if (!is_object($tableColumn)) { throw new DbException('Table must have at least one column'); } + /** @var \Phalcon\Db\ColumnInterface $tableColumn */ $fields[$tableColumn->getName()] = $tableColumn; } if ($tableExists == true) { $localFields = array(); + /** @var \Phalcon\Db\ColumnInterface[] $description */ $description = self::$_connection->describeColumns($tableName, $defaultSchema); foreach ($description as $field) { $localFields[$field->getName()] = $field; } foreach ($fields as $fieldName => $tableColumn) { + /** + * @var \Phalcon\Db\ColumnInterface $tableColumn + * @var \Phalcon\Db\ColumnInterface[] $localFields + */ if (!isset($localFields[$fieldName])) { self::$_connection->addColumn($tableName, $tableColumn->getSchemaName(), $tableColumn); } else { + $changed = false; if ($localFields[$fieldName]->getType() != $tableColumn->getType()) { @@ -473,6 +480,10 @@ public function morphTable($tableName, $definition) $changed = true; } + if ($tableColumn->getDefault() != $localFields[$fieldName]->getDefault()) { + $changed = true; + } + if ($changed == true) { self::$_connection->modifyColumn($tableName, $tableColumn->getSchemaName(), $tableColumn); } From 178d5afc36b9e88a6dfad742199e338c2f641372 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 27 Aug 2015 08:57:27 +0300 Subject: [PATCH 13/48] Fixed #468 issue --- scripts/Phalcon/Generator/Snippet.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index be3f3fca0..016e0ced2 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -114,7 +114,7 @@ public function getClassDoc($className, $namespace = '') if (!empty($namespace)) { $namespace = str_replace('namespace ', '', $namespace); $namespace = str_replace(';', '', $namespace); - $namespace = str_replace(["\r", "\n"], '', $namespace); + $namespace = str_replace(array("\r", "\n"), '', $namespace); $namespace = PHP_EOL . ' * @package ' . $namespace; } From 5b52e5956681815f667032e4cbb23be85c9876be Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 27 Aug 2015 09:13:09 +0300 Subject: [PATCH 14/48] Fixed #311 issue --- templates/project/modules/services.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/project/modules/services.php b/templates/project/modules/services.php index 33877fb27..ac5efb625 100644 --- a/templates/project/modules/services.php +++ b/templates/project/modules/services.php @@ -33,9 +33,9 @@ /** * The URL component is used to generate all kinds of URLs in the application */ -$di->setShared('url', function () { +$di->setShared('url', function () use ($config) { $url = new UrlResolver(); - $url->setBaseUri('/@@name@@/'); + $url->setBaseUri($config->application->baseUri); return $url; }); From e1b721e6199c3304acdff6d791a128647d68b947 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 6 Sep 2015 23:39:51 +0300 Subject: [PATCH 15/48] Changed my email --- scripts/Phalcon/Builder/Component.php | 2 +- scripts/Phalcon/Builder/Options.php | 2 +- scripts/Phalcon/Builder/Path.php | 2 +- scripts/Phalcon/Builder/Project/Cli.php | 2 +- scripts/Phalcon/Builder/Project/Simple.php | 2 +- scripts/Phalcon/Commands/Command.php | 2 +- scripts/Phalcon/Commands/CommandsInterface.php | 2 +- scripts/Phalcon/Generator/Snippet.php | 2 +- scripts/Phalcon/Migrations.php | 2 +- scripts/Phalcon/Script.php | 2 +- scripts/Phalcon/Validation/Validator/Namespaces.php | 2 +- scripts/Phalcon/Web/Bootstrap.php | 2 +- scripts/Phalcon/Web/CodeMirror.php | 2 +- scripts/Phalcon/Web/InstallerInterface.php | 2 +- scripts/Phalcon/Web/JQuery.php | 2 +- scripts/Phalcon/Web/Tools/controllers/ControllerBase.php | 2 +- scripts/Phalcon/Web/Tools/controllers/ControllersController.php | 2 +- scripts/Phalcon/Web/Tools/controllers/ModelsController.php | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/scripts/Phalcon/Builder/Component.php b/scripts/Phalcon/Builder/Component.php index 8b5227d4c..f6314f151 100644 --- a/scripts/Phalcon/Builder/Component.php +++ b/scripts/Phalcon/Builder/Component.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Builder/Options.php b/scripts/Phalcon/Builder/Options.php index 8fa8c0883..fb9589d17 100644 --- a/scripts/Phalcon/Builder/Options.php +++ b/scripts/Phalcon/Builder/Options.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Builder/Path.php b/scripts/Phalcon/Builder/Path.php index 74529e82e..e56f83348 100644 --- a/scripts/Phalcon/Builder/Path.php +++ b/scripts/Phalcon/Builder/Path.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Builder/Project/Cli.php b/scripts/Phalcon/Builder/Project/Cli.php index 747843990..612a5e531 100644 --- a/scripts/Phalcon/Builder/Project/Cli.php +++ b/scripts/Phalcon/Builder/Project/Cli.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Builder/Project/Simple.php b/scripts/Phalcon/Builder/Project/Simple.php index b0c5ddd8c..488871613 100644 --- a/scripts/Phalcon/Builder/Project/Simple.php +++ b/scripts/Phalcon/Builder/Project/Simple.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Commands/Command.php b/scripts/Phalcon/Commands/Command.php index c95a2e5e8..8f8d7a572 100644 --- a/scripts/Phalcon/Commands/Command.php +++ b/scripts/Phalcon/Commands/Command.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Commands/CommandsInterface.php b/scripts/Phalcon/Commands/CommandsInterface.php index 39baff9eb..bd5323df8 100644 --- a/scripts/Phalcon/Commands/CommandsInterface.php +++ b/scripts/Phalcon/Commands/CommandsInterface.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index 016e0ced2..6f1a18e71 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Migrations.php b/scripts/Phalcon/Migrations.php index dff6d3eb6..e5ef8e0b0 100644 --- a/scripts/Phalcon/Migrations.php +++ b/scripts/Phalcon/Migrations.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Script.php b/scripts/Phalcon/Script.php index 98886dba2..484ea70c5 100644 --- a/scripts/Phalcon/Script.php +++ b/scripts/Phalcon/Script.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Validation/Validator/Namespaces.php b/scripts/Phalcon/Validation/Validator/Namespaces.php index 1c20d1fa6..6cb97b7d2 100644 --- a/scripts/Phalcon/Validation/Validator/Namespaces.php +++ b/scripts/Phalcon/Validation/Validator/Namespaces.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/Bootstrap.php b/scripts/Phalcon/Web/Bootstrap.php index f6a422bfd..90d422846 100644 --- a/scripts/Phalcon/Web/Bootstrap.php +++ b/scripts/Phalcon/Web/Bootstrap.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/CodeMirror.php b/scripts/Phalcon/Web/CodeMirror.php index e3b398d4a..ab181d49c 100644 --- a/scripts/Phalcon/Web/CodeMirror.php +++ b/scripts/Phalcon/Web/CodeMirror.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/InstallerInterface.php b/scripts/Phalcon/Web/InstallerInterface.php index 622d7a60d..929359c1a 100644 --- a/scripts/Phalcon/Web/InstallerInterface.php +++ b/scripts/Phalcon/Web/InstallerInterface.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/JQuery.php b/scripts/Phalcon/Web/JQuery.php index d80c745c1..457f2861e 100644 --- a/scripts/Phalcon/Web/JQuery.php +++ b/scripts/Phalcon/Web/JQuery.php @@ -13,7 +13,7 @@ | obtain it through the world-wide-web, please send an email | | to license@phalconphp.com so we can send you a copy immediately. | +------------------------------------------------------------------------+ - | Authors: Serghei Iakovlev | + | Authors: Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php b/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php index f7078d982..a3d13b786 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php +++ b/scripts/Phalcon/Web/Tools/controllers/ControllerBase.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/Tools/controllers/ControllersController.php b/scripts/Phalcon/Web/Tools/controllers/ControllersController.php index 9d195fed0..80c0c61a1 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ControllersController.php +++ b/scripts/Phalcon/Web/Tools/controllers/ControllersController.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ diff --git a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php index 28a7e0d93..f6e867668 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php +++ b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php @@ -15,7 +15,7 @@ +------------------------------------------------------------------------+ | Authors: Andres Gutierrez | | Eduar Carvajal | - | Serghei Iakovlev | + | Serghei Iakovlev | +------------------------------------------------------------------------+ */ From f63dc0747aa7e6e615e4e4e4da44e167f6715fa9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 7 Sep 2015 00:17:38 +0300 Subject: [PATCH 16/48] Added Yaml config support --- .../Phalcon/Commands/Builtin/Migration.php | 40 ++++++++++++++----- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/scripts/Phalcon/Commands/Builtin/Migration.php b/scripts/Phalcon/Commands/Builtin/Migration.php index fc169b6ba..ee7a410cd 100644 --- a/scripts/Phalcon/Commands/Builtin/Migration.php +++ b/scripts/Phalcon/Commands/Builtin/Migration.php @@ -25,8 +25,10 @@ use Phalcon\Script\Color; use Phalcon\Commands\Command; use Phalcon\Migrations; +use Phalcon\Config; use Phalcon\Config\Adapter\Ini as IniConfig; use Phalcon\Config\Adapter\Json as JsonConfig; +use Phalcon\Config\Adapter\Yaml as YamlConfig; /** * Migration Command @@ -57,30 +59,38 @@ class Migration extends Command * * @param $fileName * - * @return bool|mixed|\Phalcon\Config\Adapter\Ini|\Phalcon\Config\Adapter\Json + * @return \Phalcon\Config + * @throws \Phalcon\Builder\BuilderException */ protected static function _loadConfig($fileName) { $pathInfo = pathinfo($fileName); if (isset($pathInfo['extension'])) { - $extension = $pathInfo['extension']; + $extension = strtolower(trim($pathInfo['extension'])); if ($extension === 'php') { - return include($fileName); + $config = include($fileName); + if (is_array($config)) { + $config = new Config($config); + } + + return $config; } elseif ($extension === 'ini') { return new IniConfig($fileName); } elseif ($extension === 'json') { return new JsonConfig($fileName); + } elseif ($extension === 'json') { + return new YamlConfig($fileName); } } - return false; + throw new BuilderException("Builder can't locate the configuration file."); } /** * @param $path * - * @return mixed|\Phalcon\Config\Adapter\Ini|\Phalcon\Config\Adapter\Json + * @return \Phalcon\Config * @throws \Phalcon\Builder\BuilderException */ protected static function _getConfig($path) @@ -90,10 +100,15 @@ protected static function _getConfig($path) return new IniConfig($path . $configPath. "/config.ini"); } elseif (file_exists($path . $configPath. "/config.php")) { $config = include($path . $configPath. "/config.php"); + if (is_array($config)) { + $config = new Config($config); + } return $config; } elseif (file_exists($path . $configPath. "/config.json")) { return new JsonConfig($path . $configPath. "/config.json"); + } elseif (file_exists($path . $configPath. "/config.yaml")) { + return new YamlConfig($path . $configPath. "/config.yaml"); } } @@ -102,15 +117,21 @@ protected static function _getConfig($path) foreach ($iterator as $f) { if (preg_match('/config\.php$/i', $f->getPathName())) { $config = include($f->getPathName()); + if (is_array($config)) { + $config = new Config($config); + } return $config; - } elseif (preg_match('/config\.ini$/', $f->getPathName())) { + } elseif (preg_match('/config\.ini$/i', $f->getPathName())) { return new IniConfig($f->getPathName()); - } elseif (preg_match('/config\.json$/', $f->getPathName())) { + } elseif (preg_match('/config\.json$/i', $f->getPathName())) { return new JsonConfig($f->getPathName()); + } elseif (preg_match('/config\.yaml$/i', $f->getPathName())) { + return new YamlConfig($f->getPathName()); } } - throw new BuilderException('Builder can\'t locate the configuration file'); + + throw new BuilderException("Builder can't locate the configuration file."); } /** @@ -149,8 +170,7 @@ public function run($parameters) $originalVersion = $this->getOption('version'); if ($this->isReceivedOption('config')) { - $configPath = $path . $this->getOption('config'); - $config = $this->_loadConfig($configPath); + $config = $this->_loadConfig($path . $this->getOption('config')); } else { $config = $this->_getConfig($path); } From 3e8f22c14a98cab4c0f803bdd8bf69075b17f9ac Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 7 Sep 2015 00:32:35 +0300 Subject: [PATCH 17/48] Fixed Migration::getConfig & Migration::loadConfig declarations --- scripts/Phalcon/Commands/Builtin/Migration.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/Phalcon/Commands/Builtin/Migration.php b/scripts/Phalcon/Commands/Builtin/Migration.php index ee7a410cd..cc6021828 100644 --- a/scripts/Phalcon/Commands/Builtin/Migration.php +++ b/scripts/Phalcon/Commands/Builtin/Migration.php @@ -57,12 +57,12 @@ class Migration extends Command * Determines correct adapter by file name * and load config * - * @param $fileName + * @param string $fileName Config file name * * @return \Phalcon\Config * @throws \Phalcon\Builder\BuilderException */ - protected static function _loadConfig($fileName) + protected function loadConfig($fileName) { $pathInfo = pathinfo($fileName); @@ -88,12 +88,12 @@ protected static function _loadConfig($fileName) } /** - * @param $path + * @param string $path Config path * * @return \Phalcon\Config * @throws \Phalcon\Builder\BuilderException */ - protected static function _getConfig($path) + protected function getConfig($path) { foreach (array('app/config/', 'config/') as $configPath) { if (file_exists($path . $configPath. "config.ini")) { @@ -170,9 +170,9 @@ public function run($parameters) $originalVersion = $this->getOption('version'); if ($this->isReceivedOption('config')) { - $config = $this->_loadConfig($path . $this->getOption('config')); + $config = $this->loadConfig($path . $this->getOption('config')); } else { - $config = $this->_getConfig($path); + $config = $this->getConfig($path); } $action = $this->getOption(array('action', 1)); From 19ce2deaef6fbdec69987d2929a4e9ebcaaee604 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 7 Sep 2015 01:42:04 +0300 Subject: [PATCH 18/48] Cleanup Migration class --- scripts/Phalcon/Generator/Snippet.php | 71 +++++++++++++++++++++++++ scripts/Phalcon/Mvc/Model/Migration.php | 43 +++++++-------- 2 files changed, 90 insertions(+), 24 deletions(-) diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index 6f1a18e71..67503f8a7 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -313,6 +313,77 @@ public function columnMap() return PHP_EOL.sprintf($template, join(",\n ", $contents)).PHP_EOL; } + public function getMigrationClassData($className, $table, $tableDefinition) + { + $template = <<morphTable('%s', array( +%s +EOD; + return sprintf($template, $className, $table, $this->getMigrationDefinition('columns', $tableDefinition)); + } + + public function getMigrationDefinition($name, $definition) + { + $template = << array( + %s + ), + +EOD; + return sprintf($template, $name, join(",\n ", $definition)); + } + + public function getColumnDefinition($field, $fieldDefinition) + { + $template = <<schema)) { - $defaultSchema = self::$_databaseConfig->schema; - } elseif (isset(self::$_databaseConfig->adapter) && self::$_databaseConfig->adapter == 'Postgresql') { + if (self::$_databaseConfig->offsetExists('schema')) { + $defaultSchema = self::$_databaseConfig->get('schema'); + } elseif (self::$_databaseConfig->get('adapter') == 'Postgresql') { $defaultSchema = 'public'; - } elseif (isset(self::$_databaseConfig->dbname)) { - $defaultSchema = self::$_databaseConfig->dbname; + } elseif (self::$_databaseConfig->offsetExists('dbname')) { + $defaultSchema = self::$_databaseConfig->get('dbname'); } else { $defaultSchema = null; } + $description = self::$_connection->describeColumns($table, $defaultSchema); foreach ($description as $field) { @@ -279,7 +282,7 @@ public static function generate($version, $table, $exportData=null) } $oldColumn = $field->getName(); - $tableDefinition[] = "\t\t\t\tnew Column(\n\t\t\t\t\t'" . $field->getName() . "',\n\t\t\t\t\tarray(\n\t\t\t\t\t\t" . join(",\n\t\t\t\t\t\t", $fieldDefinition) . "\n\t\t\t\t\t)\n\t\t\t\t)"; + $tableDefinition[] = $snippet->getColumnDefinition($field->getName(), $fieldDefinition); $allFields[] = "'".$field->getName()."'"; } @@ -290,7 +293,7 @@ public static function generate($version, $table, $exportData=null) foreach ($dbIndex->getColumns() as $indexColumn) { $indexDefinition[] = "'" . $indexColumn . "'"; } - $indexesDefinition[] = "\t\t\t\tnew Index('".$indexName."', array(" . join(", ", $indexDefinition) . "))"; + $indexesDefinition[] = $snippet->getIndexDefinition($indexName, $indexDefinition); } $referencesDefinition = array(); @@ -312,7 +315,7 @@ public static function generate($version, $table, $exportData=null) $referenceDefinition[] = "'columns' => array(" . join(",", $columns) . ")"; $referenceDefinition[] = "'referencedColumns' => array(".join(",", $referencedColumns) . ")"; - $referencesDefinition[] = "\t\t\t\tnew Reference('" . $constraintName."', array(\n\t\t\t\t\t" . join(",\n\t\t\t\t\t", $referenceDefinition) . "\n\t\t\t\t))"; + $referencesDefinition[] = $snippet->getReferenceDefinition($constraintName, $referenceDefinition); } $optionsDefinition = array(); @@ -321,34 +324,26 @@ public static function generate($version, $table, $exportData=null) if (self::$_skipAI && strtoupper($optionName) == "AUTO_INCREMENT") { $optionValue = ''; } - $optionsDefinition[] = "\t\t\t\t'" . strtoupper($optionName) . "' => '" . $optionValue . "'"; + $optionsDefinition[] = "'" . strtoupper($optionName) . "' => '" . $optionValue . "'"; } $classVersion = preg_replace('/[^0-9A-Za-z]/', '', $version); $className = Text::camelize($table) . 'Migration_'.$classVersion; - $classData = "use Phalcon\\Db\\Column; -use Phalcon\\Db\\Index; -use Phalcon\\Db\\Reference; -use Phalcon\\Mvc\\Model\\Migration; - -class ".$className." extends Migration\n". -"{\n\n". - "\tpublic function up()\n". - "\t{\n\t\t\$this->morphTable(\n\t\t\t'" . $table . "',\n\t\t\tarray(" . - "\n\t\t\t'columns' => array(\n" . join(",\n", $tableDefinition) . "\n\t\t\t),"; + $classData = $snippet->getMigrationClassData($className, $table, $tableDefinition); + if (count($indexesDefinition)) { - $classData .= "\n\t\t\t'indexes' => array(\n" . join(",\n", $indexesDefinition) . "\n\t\t\t),"; + $classData .= $snippet->getMigrationDefinition('indexes', $indexesDefinition); } if (count($referencesDefinition)) { - $classData .= "\n\t\t\t'references' => array(\n".join(",\n", $referencesDefinition) . "\n\t\t\t),"; + $classData .= $snippet->getMigrationDefinition('references', $referencesDefinition); } if (count($optionsDefinition)) { - $classData .= "\n\t\t\t'options' => array(\n".join(",\n", $optionsDefinition) . "\n\t\t\t)\n"; + $classData .= $snippet->getMigrationDefinition('options', $optionsDefinition); } - $classData .= "\t\t)\n\t\t);\n\t}"; + $classData .= " )\n );\n }"; if ($exportData == 'always' || $exportData == 'oncreate') { if ($exportData == 'oncreate') { $classData .= "\n\n\tpublic function afterCreateTable() {\n"; From 4f18b3eead83ac488fb5877fb9281071f1a305b8 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 7 Sep 2015 09:10:26 +0300 Subject: [PATCH 19/48] Added missed data option for migrations --- ide/2.0.7/Phalcon/Config.php | 35 ++++++++++--------- .../Phalcon/Commands/Builtin/Migration.php | 5 +-- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ide/2.0.7/Phalcon/Config.php b/ide/2.0.7/Phalcon/Config.php index b3112b0da..e55ccf325 100644 --- a/ide/2.0.7/Phalcon/Config.php +++ b/ide/2.0.7/Phalcon/Config.php @@ -30,7 +30,7 @@ class Config implements \ArrayAccess, \Countable /** * Phalcon\Config constructor * - * @param array $arrayConfig + * @param array $arrayConfig */ public function __construct($arrayConfig = null) {} @@ -40,8 +40,8 @@ public function __construct($arrayConfig = null) {} * var_dump(isset($config['database'])); * * - * @param mixed $index - * @return bool + * @param mixed $index + * @return bool */ public function offsetExists($index) {} @@ -52,8 +52,9 @@ public function offsetExists($index) {} * echo $config->get('controllersDir', '../app/controllers/'); * * - * @param mixed $index - * @param mixed $defaultValue + * @param mixed $index + * @param mixed $defaultValue + * @return mixed */ public function get($index, $defaultValue = null) {} @@ -63,8 +64,8 @@ public function get($index, $defaultValue = null) {} * print_r($config['database']); * * - * @param mixed $index - * @return string + * @param mixed $index + * @return string */ public function offsetGet($index) {} @@ -74,8 +75,8 @@ public function offsetGet($index) {} * $config['database'] = array('type' => 'Sqlite'); * * - * @param mixed $index - * @param mixed $value + * @param mixed $index + * @param mixed $value */ public function offsetSet($index, $value) {} @@ -85,7 +86,7 @@ public function offsetSet($index, $value) {} * unset($config['database']); * * - * @param mixed $index + * @param mixed $index */ public function offsetUnset($index) {} @@ -96,8 +97,8 @@ public function offsetUnset($index) {} * $globalConfig->merge($config2); * * - * @param mixed $config - * @return Config + * @param mixed $config + * @return Config */ public function merge(Config $config) {} @@ -107,7 +108,7 @@ public function merge(Config $config) {} * print_r($config->toArray()); * * - * @return array + * @return array */ public function toArray() {} @@ -121,22 +122,22 @@ public function toArray() {} * print $config->count(); * * - * @return int + * @return int */ public function count() {} /** * Restores the state of a Phalcon\Config object * - * @param array $data - * @return Config + * @param array $data + * @return Config */ public static function __set_state($data) {} /** * Helper method for merge configs (forwarding nested config instance) * - * @param Config $config + * @param Config $config * @param Config $instance = null * @return Config config */ diff --git a/scripts/Phalcon/Commands/Builtin/Migration.php b/scripts/Phalcon/Commands/Builtin/Migration.php index cc6021828..43bceebb1 100644 --- a/scripts/Phalcon/Commands/Builtin/Migration.php +++ b/scripts/Phalcon/Commands/Builtin/Migration.php @@ -43,14 +43,15 @@ class Migration extends Command { protected $_possibleParameters = array( - 'action=s' => "Generates a Migration [generate|run]", + 'action=s' => "Generates a Migration [generate|run].", 'config=s' => "Configuration file.", 'migrations=s' => "Migrations directory.", 'directory=s' => "Directory where the project was created.", 'table=s' => "Table to migrate. Default: all.", 'version=s' => "Version to migrate.", 'force' => "Forces to overwrite existing migrations.", - 'no-auto-increment' => "Disable auto increment (Generating only)", + 'no-auto-increment' => "Disable auto increment (Generating only).", + 'data=s' => "Export data [always|oncreate] (Import data when run migration).", ); /** From c6308c861e7024151a9d0ffd17cc2137035a9ad1 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 8 Sep 2015 02:11:27 +0300 Subject: [PATCH 20/48] Add feature to rollback a migration --- scripts/Phalcon/Generator/Snippet.php | 77 +++++++- scripts/Phalcon/Migrations.php | 94 +++++----- scripts/Phalcon/Mvc/Model/Migration.php | 240 +++++++++++++++++++----- scripts/Phalcon/Version/Item.php | 22 ++- 4 files changed, 326 insertions(+), 107 deletions(-) diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index 67503f8a7..9d897b6d1 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -313,7 +313,7 @@ public function columnMap() return PHP_EOL.sprintf($template, join(",\n ", $contents)).PHP_EOL; } - public function getMigrationClassData($className, $table, $tableDefinition) + public function getMigrationMorph($className, $table, $tableDefinition) { $template = <<morphTable('%s', array( %s @@ -336,6 +336,77 @@ public function up() return sprintf($template, $className, $table, $this->getMigrationDefinition('columns', $tableDefinition)); } + public function getMigrationUp() + { + $template = <<batchInsert('%s', array( + %s + ) + ); +EOD; + return sprintf($template, $table, join(",\n ", $allFields)); + } + + public function getMigrationAfterCreateTable($table, $allFields) + { + $template = <<batchInsert('%s', array( + %s + ) + ); + } +EOD; + return sprintf($template, $table, join(",\n ", $allFields)); + } + + public function getMigrationBatchDelete($table) + { + $template = <<batchDelete('%s'); +EOD; + return sprintf($template, $table); + } + public function getMigrationDefinition($name, $definition) { $template = <<database); ModelMigration::setSkipAutoIncrement($options['no-ai']); - ModelMigration::setMigrationPath($migrationsDir.'/'.$version); + ModelMigration::setMigrationPath($migrationsDir); if ($tableName == 'all') { $migrations = ModelMigration::generateAll($version, $exportData); foreach ($migrations as $tableName => $migration) { @@ -120,7 +120,7 @@ public static function generate(array $options) */ public static function isConsole() { - return !isset($_SERVER['SERVER_SOFTWARE']); + return PHP_SAPI == 'cli'; } /** @@ -131,36 +131,37 @@ public static function isConsole() * @throws Exception * @throws ModelException * @throws ScriptException - * @throws \Exception */ public static function run(array $options) { $path = $options['directory']; + $migrationsDir = $options['migrationsDir']; + if (!file_exists($migrationsDir)) { + throw new ModelException('Migrations directory could not found.'); + } + $config = $options['config']; - $version = null; + if (!$config instanceof Config) { + throw new ModelException('Internal error. Config should be instance of \Phalcon\Config'); + } + $finalVersion = null; if (isset($options['version']) && $options['version'] !== null) { - $version = new VersionItem($options['version']); + $finalVersion = new VersionItem($options['version']); } + $tableName = 'all'; if (isset($options['tableName'])) { $tableName = $options['tableName']; - } else { - $tableName = 'all'; - } - - if (!file_exists($migrationsDir)) { - throw new ModelException('Migrations directory could not found'); } + // read all versions $versions = array(); $iterator = new \DirectoryIterator($migrationsDir); foreach ($iterator as $fileinfo) { - if ($fileinfo->isDir()) { - if (preg_match('/[a-z0-9](\.[a-z0-9]+)+/', $fileinfo->getFilename(), $matches)) { - $versions[] = new VersionItem($matches[0], 3); - } + if ($fileinfo->isDir() && preg_match('/[a-z0-9](\.[a-z0-9]+)+/', $fileinfo->getFilename(), $matches)) { + $versions[] = new VersionItem($matches[0], 3); } } @@ -168,57 +169,54 @@ public static function run(array $options) throw new ModelException('Migrations were not found at '.$migrationsDir); } - if ($version === null) { - $version = VersionItem::maximum($versions); + // set default final version + if ($finalVersion === null) { + $finalVersion = VersionItem::maximum($versions); } + // read current version if (is_file($path.'.phalcon')) { unlink($path.'.phalcon'); mkdir($path.'.phalcon'); } $migrationFid = $path.'.phalcon/migration-version'; - if (file_exists($migrationFid)) { - $fromVersion = trim(file_get_contents($migrationFid)); - } else { - $fromVersion = null; + $initialVersion = new VersionItem(file_exists($migrationFid) ? file_get_contents($migrationFid) : null); + + if ($initialVersion->getStamp() == $finalVersion->getStamp()) { + return; // nothing to do } + // init ModelMigration if (!isset($config->database)) { - throw new \Exception("Cannot load database configuration"); + throw new ScriptException('Cannot load database configuration'); } ModelMigration::setup($config->database); - - ModelMigration::setMigrationPath($migrationsDir.'/'.$version . '/') ; - $versionsBetween = VersionItem::between($fromVersion, $version, $versions); - - // get rid of the current version, we don't want migrations to run for our - // existing version. - if (isset($versionsBetween[0]) && (string)$versionsBetween[0] == $fromVersion) { - unset($versionsBetween[0]); - } - - foreach ($versionsBetween as $version) { - if ($tableName == 'all') { - $iterator = new \DirectoryIterator($migrationsDir.'/'.$version); - foreach ($iterator as $fileinfo) { - if ($fileinfo->isFile()) { - if (preg_match('/\.php$/', $fileinfo->getFilename())) { - ModelMigration::migrateFile((string) $version, $migrationsDir.'/'.$version.'/'.$fileinfo->getFilename()); + ModelMigration::setMigrationPath($migrationsDir); + + // run migration + $versionsBetween = VersionItem::between($initialVersion, $finalVersion, $versions); + foreach ($versionsBetween as $k => $version) { + /** @var \Phalcon\Version\Item $version */ + if ($k > 0) { // skip the initial version + if ($tableName == 'all') { + $iterator = new \DirectoryIterator($migrationsDir . '/' . $version); + foreach ($iterator as $fileinfo) { + if (!$fileinfo->isFile() || !preg_match('/\.php$/i', $fileinfo->getFilename())) { + continue; } + + ModelMigration::migrate($initialVersion, $version, $fileinfo->getBasename('.php')); } + } else { + ModelMigration::migrate($initialVersion, $version, $tableName); } - } else { - $migrationPath = $migrationsDir.'/'.$version.'/'.$tableName.'.php'; - if (!file_exists($migrationPath)) { - throw new ScriptException('Migration class was not found '.$migrationPath); - } - ModelMigration::migrateFile((string) $version, $migrationPath); + + file_put_contents($migrationFid, (string)$version); + print Color::success('Version ' . $version . ' was successfully migrated'); } - print Color::success('Version '.$version.' was successfully migrated').PHP_EOL; + $initialVersion = $version; } - - file_put_contents($migrationFid, (string) $version); } } diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index a15c34fa7..94b075af3 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -28,6 +28,7 @@ use Phalcon\Mvc\Model\Migration\Profiler; use Phalcon\Db\Exception as DbException; use Phalcon\Events\Manager as EventsManager; +use Phalcon\Version\Item as VersionItem; /** * Phalcon\Mvc\Model\Migration @@ -64,6 +65,13 @@ class Migration */ private static $_skipAI = false; + /** + * Version of the migration file + * + * @var string + */ + protected $_version = null; + /** * Prepares component * @@ -126,7 +134,7 @@ public static function setSkipAutoIncrement($skip) */ public static function setMigrationPath($path) { - self::$_migrationPath = $path; + self::$_migrationPath = rtrim($path, '\\/') . DIRECTORY_SEPARATOR; } /** @@ -329,7 +337,9 @@ public static function generate($version, $table, $exportData = null) $classVersion = preg_replace('/[^0-9A-Za-z]/', '', $version); $className = Text::camelize($table) . 'Migration_'.$classVersion; - $classData = $snippet->getMigrationClassData($className, $table, $tableDefinition); + + // morph() + $classData = $snippet->getMigrationMorph($className, $table, $tableDefinition); if (count($indexesDefinition)) { $classData .= $snippet->getMigrationDefinition('indexes', $indexesDefinition); @@ -343,16 +353,37 @@ public static function generate($version, $table, $exportData = null) $classData .= $snippet->getMigrationDefinition('options', $optionsDefinition); } - $classData .= " )\n );\n }"; - if ($exportData == 'always' || $exportData == 'oncreate') { - if ($exportData == 'oncreate') { - $classData .= "\n\n\tpublic function afterCreateTable() {\n"; - } else { - $classData .= "\n\n\tpublic function afterUp() {\n"; - } - $classData .= "\t\t\$this->batchInsert('$table', array(\n\t\t\t" . join(",\n\t\t\t", $allFields) . "\n\t\t));"; + $classData .= " )\n );\n }\n"; + + // up() + $classData .= $snippet->getMigrationUp(); + + if ($exportData == 'always') { + $classData .= $snippet->getMigrationBatchInsert($table, $allFields); + } + + $classData .= "\n }\n"; + + // down() + $classData .= $snippet->getMigrationDown(); + + if ($exportData == 'always') { + $classData .= $snippet->getMigrationBatchDelete($table); + } + + $classData .= "\n }\n"; - $fileHandler = fopen(self::$_migrationPath . '/' . $table . '.dat', 'w'); + // afterCreateTable() + if ($exportData == 'oncreate') { + $classData .= $snippet->getMigrationAfterCreateTable($table, $allFields); + } + + // end of class + $classData .= "\n}\n"; + + // dump data + if ($exportData == 'always' || $exportData == 'oncreate') { + $fileHandler = fopen(self::$_migrationPath . $version . '/' . $table . '.dat', 'w'); $cursor = self::$_connection->query('SELECT * FROM ' . $table); $cursor->setFetchMode(Db::FETCH_ASSOC); while ($row = $cursor->fetchArray()) { @@ -373,42 +404,64 @@ public static function generate($version, $table, $exportData = null) unset($row); unset($data); } - fclose($fileHandler); - $classData.="\n\t}"; + fclose($fileHandler); } - $classData.="\n}\n"; - $classData = str_replace("\t", " ", $classData); return $classData; } - /** - * Migrate single file - * - * @param $version - * @param $filePath - * - * @throws \Phalcon\Db\Exception - */ - public static function migrateFile($version, $filePath) + public static function migrate($fromVersion, $toVersion, $tableName) { - if (file_exists($filePath)) { - $fileName = basename($filePath); - $classVersion = preg_replace('/[^0-9A-Za-z]/', '', $version); - $className = Text::camelize(str_replace('.php', '', $fileName)).'Migration_'.$classVersion; - require_once $filePath; - - if (!class_exists($className)) { - throw new DbException('Migration class cannot be found ' . $className . ' at ' . $filePath); + if (!is_object($fromVersion)) { + $fromVersion = new VersionItem($fromVersion); + } + + if (!is_object($toVersion)) { + $toVersion = new VersionItem($toVersion); + } + + if ($fromVersion->getStamp() == $toVersion->getStamp()) { + return; // nothing to do + } + + if ($fromVersion->getStamp() < $toVersion->getStamp()) { + $toMigration = self::createClass($toVersion, $tableName); + + if (!is_null($toMigration)) { + // morph the table structure + if (method_exists($toMigration, 'morph')) { + $toMigration->morph(); + } + + // modify the datasets + if (method_exists($toMigration, 'up')) { + $toMigration->up(); + // we don't need the afterUp function anymore! + //if (method_exists($toMigration, 'afterUp')) { + // $toMigration->afterUp(); + //} + } + } + } else { + // rollback! + + // reset the data modifications + $fromMigration = self::createClass($fromVersion, $tableName); + if (!is_null($fromMigration) && method_exists($fromMigration, 'down')) { + $fromMigration->down(); } - $migration = new $className(); - if (method_exists($migration, 'up')) { - $migration->up(); - if (method_exists($migration, 'afterUp')) { - $migration->afterUp(); + // call the last morph function in the previous migration files + $toMigration = self::createPrevClassWithMorphMethod($toVersion, $tableName); + + if (!is_null($toMigration)) { + if (method_exists($toMigration, 'morph')) { + $toMigration->morph(); } + } else { + // for safety's sake commented out! + //self::$_connection->dropTable($tableName); } } } @@ -627,17 +680,110 @@ public function morphTable($tableName, $definition) */ public function batchInsert($tableName, $fields) { - $migrationData = self::$_migrationPath.'/'.$tableName.'.dat'; - if (file_exists($migrationData)) { - self::$_connection->begin(); - self::$_connection->delete($tableName); - $batchHandler = fopen($migrationData, 'r'); - while (($line = fgets($batchHandler)) !== false) { - self::$_connection->insert($tableName, explode('|', rtrim($line)), $fields, false); - unset($line); + $migrationData = self::$_migrationPath . $this->_version . '/' . $tableName . '.dat'; + if (!file_exists($migrationData)) { + return; // nothing to do + } + + self::$_connection->begin(); + self::$_connection->delete($tableName); + $batchHandler = fopen($migrationData, 'r'); + while (($line = fgets($batchHandler)) !== false) { + self::$_connection->insert($tableName, explode('|', rtrim($line)), $fields); + unset($line); + } + fclose($batchHandler); + self::$_connection->commit(); + } + + /** + * Delete the migration datasets from the table + * + * @param string $tableName + */ + public function batchDelete($tableName) + { + $migrationData = self::$_migrationPath . $this->_version . '/' . $tableName . '.dat'; + if (!file_exists($migrationData)) { + return; // nothing to do + } + + self::$_connection->begin(); + self::$_connection->delete($tableName); + $batchHandler = fopen($migrationData, 'r'); + while (($line = fgets($batchHandler)) !== false) { + $data = explode('|', rtrim($line), 2); + self::$_connection->delete($tableName, 'id=?', [$data[0]]); + unset($line); + } + fclose($batchHandler); + self::$_connection->commit(); + } + + /** + * Find the last morph function in the previous migration files + * + * @param VersionItem $version + * @param string $tableName + * @return null|\Phalcon\Mvc\Model\Migration + * + * @throws Exception + */ + private static function createPrevClassWithMorphMethod(VersionItem $version, $tableName) + { + $prevVersions = array(); + $iterator = new \DirectoryIterator(self::$_migrationPath); + foreach ($iterator as $fileinfo) { + if ($fileinfo->isDir() && preg_match('/[a-z0-9](\.[a-z0-9]+)+/', $fileinfo->getFilename(), $matches)) { + $prevVersion = new VersionItem($matches[0], 3); + if (($prevVersion->getStamp() <= $version->getStamp())) { + $prevVersions[] = $prevVersion; + } } - fclose($batchHandler); - self::$_connection->commit(); } + + $prevVersions = VersionItem::sortDesc($prevVersions); + foreach ($prevVersions as $prevVersion) { + $migration = self::createClass($prevVersion, $tableName); + if (!is_null($migration) && method_exists($migration, 'morph')) { + return $migration; + } + } + + return null; + } + + /** + * Create migration object for specified version + * + * @param \Phalcon\Version\Item|string $version + * @param string $tableName + * @return null|\Phalcon\Mvc\Model\Migration + * + * @throws Exception + */ + private static function createClass($version, $tableName) + { + if (is_object($version)) { + $version = (string)$version; + } + + $fileName = self::$_migrationPath . $version . '/' . $tableName . '.php'; + if (!file_exists($fileName)) { + return null; + } + + $classVersion = preg_replace('/[^0-9A-Za-z]/', '', $version); + $className = Text::camelize($tableName).'Migration_'.$classVersion; + + include_once $fileName; + if (!class_exists($className)) { + throw new Exception('Migration class cannot be found ' . $className . ' at ' . $fileName); + } + + $migration = new $className($version); + $migration->_version = $version; + + return $migration; } } diff --git a/scripts/Phalcon/Version/Item.php b/scripts/Phalcon/Version/Item.php index e12e3df63..49530edcd 100644 --- a/scripts/Phalcon/Version/Item.php +++ b/scripts/Phalcon/Version/Item.php @@ -147,26 +147,30 @@ public static function between($initialVersion, $finalVersion, $versions) if (!is_object($initialVersion)) { $initialVersion = new self($initialVersion); } + if (!is_object($finalVersion)) { $finalVersion = new self($finalVersion); } - if ($initialVersion->getStamp() > $finalVersion->getStamp()) { - $versions = self::sortDesc($versions); - list($initialVersion, $finalVersion) = array($finalVersion, $initialVersion); - } + $betweenVersions = array(); if ($initialVersion->getStamp() == $finalVersion->getStamp()) { - return $betweenVersions; + return $betweenVersions; // nothing to do + } + + if ($initialVersion->getStamp() < $finalVersion->getStamp()) { + $versions = self::sortAsc($versions); + } else { + $versions = self::sortDesc($versions); + list($initialVersion, $finalVersion) = array($finalVersion, $initialVersion); } foreach ($versions as $version) { - /** - * @var Item $version - */ - if (($version->getStamp() > $initialVersion->getStamp()) && ($version->getStamp() <= $finalVersion->getStamp())) { + /** @var Item $version */ + if (($version->getStamp() >= $initialVersion->getStamp()) && ($version->getStamp() <= $finalVersion->getStamp())) { $betweenVersions[] = $version; } } + return $betweenVersions ; } From e39f00b25424f6d24bbd6e90209d41f6f57292e9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 8 Sep 2015 22:35:11 +0300 Subject: [PATCH 21/48] Cleaned Migration --- scripts/Phalcon/Mvc/Model/Migration.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index 94b075af3..da98ca52e 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -476,13 +476,9 @@ public static function migrate($fromVersion, $toVersion, $tableName) */ public function morphTable($tableName, $definition) { - $defaultSchema = null; - - if (isset(self::$_databaseConfig->dbname)) { - $defaultSchema = self::$_databaseConfig->dbname; - } - + $defaultSchema = self::$_databaseConfig->get('dbname'); $tableExists = self::$_connection->tableExists($tableName, $defaultSchema); + if (isset($definition['columns'])) { if (count($definition['columns']) == 0) { throw new DbException('Table must have at least one column'); @@ -493,13 +489,19 @@ public function morphTable($tableName, $definition) if (!is_object($tableColumn)) { throw new DbException('Table must have at least one column'); } - /** @var \Phalcon\Db\ColumnInterface $tableColumn */ + /** + * @var \Phalcon\Db\ColumnInterface $tableColumn + * @var \Phalcon\Db\ColumnInterface[] $fields + */ $fields[$tableColumn->getName()] = $tableColumn; } if ($tableExists == true) { $localFields = array(); - /** @var \Phalcon\Db\ColumnInterface[] $description */ + /** + * @var \Phalcon\Db\ColumnInterface[] $description + * @var \Phalcon\Db\ColumnInterface[] $localFields + */ $description = self::$_connection->describeColumns($tableName, $defaultSchema); foreach ($description as $field) { $localFields[$field->getName()] = $field; @@ -513,7 +515,6 @@ public function morphTable($tableName, $definition) if (!isset($localFields[$fieldName])) { self::$_connection->addColumn($tableName, $tableColumn->getSchemaName(), $tableColumn); } else { - $changed = false; if ($localFields[$fieldName]->getType() != $tableColumn->getType()) { From 9dbd9c9d21948acdd2917841cd244f59ee8d030b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 10 Sep 2015 09:12:33 +0300 Subject: [PATCH 22/48] Do not use precision for int/bool/bigint in Postgresql --- scripts/Phalcon/Mvc/Model/Migration.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index da98ca52e..a3d9722b2 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -273,10 +273,16 @@ public static function generate($version, $table, $exportData = null) $fieldDefinition[] = "'autoIncrement' => true"; } - if ($field->getSize()) { - $fieldDefinition[] = "'size' => " . $field->getSize(); + if (self::$_databaseConfig->adapter == 'Postgresql' && + in_array($field->getType(), [Column::TYPE_BOOLEAN, Column::TYPE_INTEGER, Column::TYPE_BIGINTEGER]) + ) { + // nothing } else { - $fieldDefinition[] = "'size' => 1"; + if ($field->getSize()) { + $fieldDefinition[] = "'size' => " . $field->getSize(); + } else { + $fieldDefinition[] = "'size' => 1"; + } } if ($field->getScale()) { From 1a842d2200e38fef0fd8ee24686173578690632a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Thu, 10 Sep 2015 22:40:20 +0300 Subject: [PATCH 23/48] Fixed issue #453 --- scripts/Phalcon/Commands/Builtin/Migration.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/Phalcon/Commands/Builtin/Migration.php b/scripts/Phalcon/Commands/Builtin/Migration.php index 43bceebb1..2bb7cee23 100644 --- a/scripts/Phalcon/Commands/Builtin/Migration.php +++ b/scripts/Phalcon/Commands/Builtin/Migration.php @@ -153,10 +153,22 @@ public function run($parameters) if ($this->isReceivedOption('directory')) { $path = $this->getOption('directory'); } + $path = realpath($path) . DIRECTORY_SEPARATOR; + if ($this->isReceivedOption('config')) { + $config = $this->loadConfig($path . $this->getOption('config')); + } else { + $config = $this->getConfig($path); + } + if ($this->isReceivedOption('migrations')) { $migrationsDir = $path.$this->getOption('migrations'); + } elseif (isset($config['application']['migrationsDir'])) { + $migrationsDir = $config['application']['migrationsDir']; + if (!$this->path->isAbsolutePath($migrationsDir)) { + $migrationsDir = $path . $migrationsDir; + } } else { if (file_exists($path.'app')) { $migrationsDir = $path.'app/migrations'; @@ -170,12 +182,6 @@ public function run($parameters) $exportData = $this->getOption('data'); $originalVersion = $this->getOption('version'); - if ($this->isReceivedOption('config')) { - $config = $this->loadConfig($path . $this->getOption('config')); - } else { - $config = $this->getConfig($path); - } - $action = $this->getOption(array('action', 1)); $version = $this->getOption('version'); From d55544f57c0cce62c9843b4081cf54ff7a442cc9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 13 Sep 2015 15:16:39 +0300 Subject: [PATCH 24/48] Fixed #459 issue --- box.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/box.json b/box.json index e1c151f74..011f19af2 100644 --- a/box.json +++ b/box.json @@ -1,5 +1,9 @@ { - "directories": "resources", + "directories": [ + "resources", + "scripts", + "templates" + ], "files": "webtools.php", "finder": [ { @@ -9,11 +13,6 @@ "LICENSE", "phalcon.bat", "phalcon.sh" - ], - "in": "scripts", - "name": [ - "*.phtml", - "*.php" ] } ], @@ -21,4 +20,4 @@ "main": "phalcon.php", "output": "phalcon.phar", "stub": true -} \ No newline at end of file +} From a720b57bd6024e52e45cf3f5ab45d748c4612c2f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 15 Sep 2015 19:02:06 +0300 Subject: [PATCH 25/48] Fixed issue #496 --- scripts/Phalcon/Migrations.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/Phalcon/Migrations.php b/scripts/Phalcon/Migrations.php index 697862fc3..cc95ae931 100644 --- a/scripts/Phalcon/Migrations.php +++ b/scripts/Phalcon/Migrations.php @@ -98,6 +98,7 @@ public static function generate(array $options) ModelMigration::setSkipAutoIncrement($options['no-ai']); ModelMigration::setMigrationPath($migrationsDir); + if ($tableName == 'all') { $migrations = ModelMigration::generateAll($version, $exportData); foreach ($migrations as $tableName => $migration) { @@ -199,23 +200,22 @@ public static function run(array $options) $versionsBetween = VersionItem::between($initialVersion, $finalVersion, $versions); foreach ($versionsBetween as $k => $version) { /** @var \Phalcon\Version\Item $version */ - if ($k > 0) { // skip the initial version - if ($tableName == 'all') { - $iterator = new \DirectoryIterator($migrationsDir . '/' . $version); - foreach ($iterator as $fileinfo) { - if (!$fileinfo->isFile() || !preg_match('/\.php$/i', $fileinfo->getFilename())) { - continue; - } - - ModelMigration::migrate($initialVersion, $version, $fileinfo->getBasename('.php')); + if ($tableName == 'all') { + $iterator = new \DirectoryIterator($migrationsDir . '/' . $version); + foreach ($iterator as $fileinfo) { + if (!$fileinfo->isFile() || !preg_match('/\.php$/i', $fileinfo->getFilename())) { + continue; } - } else { - ModelMigration::migrate($initialVersion, $version, $tableName); - } - file_put_contents($migrationFid, (string)$version); - print Color::success('Version ' . $version . ' was successfully migrated'); + ModelMigration::migrate($initialVersion, $version, $fileinfo->getBasename('.php')); + } + } else { + ModelMigration::migrate($initialVersion, $version, $tableName); } + + file_put_contents($migrationFid, (string)$version); + print Color::success('Version ' . $version . ' was successfully migrated'); + $initialVersion = $version; } } From 12174c4fa0de977966eb7b8a2e68cfdb3b0d4c14 Mon Sep 17 00:00:00 2001 From: Brian Moore Date: Tue, 15 Sep 2015 12:34:40 -0400 Subject: [PATCH 26/48] Send router back to DI The routes set here are not actually being set, it just coincidentally works with a single demo module due to the "defaultNamespace" set in services.php --- templates/project/modules/routes.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/project/modules/routes.php b/templates/project/modules/routes.php index 22bbb433b..426318ae0 100644 --- a/templates/project/modules/routes.php +++ b/templates/project/modules/routes.php @@ -26,3 +26,5 @@ 'params' => 3 )); } + +$di->set("router", $router); From 7958b96605719b39840f88b87e460a7ddcf91332 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 16 Sep 2015 00:46:52 +0300 Subject: [PATCH 27/48] Fixed issue #497 --- scripts/Phalcon/Mvc/Model/Migration.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index da98ca52e..fcaaa6b0e 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -389,17 +389,14 @@ public static function generate($version, $table, $exportData = null) while ($row = $cursor->fetchArray()) { $data = array(); foreach ($row as $key => $value) { - if (isset($numericFields[$key])) { - if ($value==='' || is_null($value)) { - $data[] = 'NULL'; - } else { - $data[] = addslashes($value); - } + if (isset($numericFields[$key]) && ($value === '' || is_null($value))) { + $data[] = 'NULL'; } else { - $data[] = "'".addslashes($value)."'"; + $data[] = addslashes($value); } unset($value); } + fputs($fileHandler, join('|', $data).PHP_EOL); unset($row); unset($data); @@ -460,8 +457,7 @@ public static function migrate($fromVersion, $toVersion, $tableName) $toMigration->morph(); } } else { - // for safety's sake commented out! - //self::$_connection->dropTable($tableName); + self::$_connection->dropTable($tableName); } } } From 1f2c618ea82b89e84d088ca94705fe83252ff257 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 16 Sep 2015 01:16:05 +0300 Subject: [PATCH 28/48] Fixed issue #497 --- scripts/Phalcon/Mvc/Model/Migration.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index fcaaa6b0e..75d6e93a7 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -389,11 +389,16 @@ public static function generate($version, $table, $exportData = null) while ($row = $cursor->fetchArray()) { $data = array(); foreach ($row as $key => $value) { - if (isset($numericFields[$key]) && ($value === '' || is_null($value))) { - $data[] = 'NULL'; + if (isset($numericFields[$key])) { + if ($value==='' || is_null($value)) { + $data[] = 'NULL'; + } else { + $data[] = addslashes($value); + } } else { - $data[] = addslashes($value); + $data[] = "'".addslashes($value)."'"; } + unset($value); } @@ -686,7 +691,11 @@ public function batchInsert($tableName, $fields) self::$_connection->delete($tableName); $batchHandler = fopen($migrationData, 'r'); while (($line = fgets($batchHandler)) !== false) { - self::$_connection->insert($tableName, explode('|', rtrim($line)), $fields); + $values = array_map(function ($value) { + return trim($value, "'"); + }, explode('|', rtrim($line))); + + self::$_connection->insert($tableName, $values, $fields); unset($line); } fclose($batchHandler); From 66fa3d335aba798410d7ba6bb28334bd0eba70c1 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 16 Sep 2015 01:53:34 +0300 Subject: [PATCH 29/48] Fixed isse #184 --- scripts/Phalcon/Builder/Project/Modules.php | 7 ++++++- scripts/Phalcon/Builder/Project/ProjectBuilder.php | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/scripts/Phalcon/Builder/Project/Modules.php b/scripts/Phalcon/Builder/Project/Modules.php index 61a6eb597..981985750 100644 --- a/scripts/Phalcon/Builder/Project/Modules.php +++ b/scripts/Phalcon/Builder/Project/Modules.php @@ -66,10 +66,15 @@ class Modules extends ProjectBuilder */ private function createControllerFile() { + $namespace = $this->options->get('name'); + if (strtolower(trim($namespace)) == 'default') { + $namespace = 'MyDefault'; + } + $builder = new ControllerBuilder(array( 'name' => 'index', 'controllersDir' => $this->options->get('projectPath') . 'apps/frontend/controllers/', - 'namespace' => ucfirst($this->options->get('name')) . '\Frontend\Controllers', + 'namespace' => ucfirst($namespace) . '\Frontend\Controllers', 'baseClass' => 'ControllerBase' )); diff --git a/scripts/Phalcon/Builder/Project/ProjectBuilder.php b/scripts/Phalcon/Builder/Project/ProjectBuilder.php index 87d310016..bd5887953 100644 --- a/scripts/Phalcon/Builder/Project/ProjectBuilder.php +++ b/scripts/Phalcon/Builder/Project/ProjectBuilder.php @@ -123,8 +123,13 @@ protected function generateFile($getFile, $putFile, $name = '') $str = file_get_contents($getFile); if ($name) { + $namespace = $name; + if (strtolower(trim($name)) == 'default') { + $namespace = 'MyDefault'; + } + $str = preg_replace('/@@name@@/', $name, $str); - $str = preg_replace('/@@namespace@@/', ucfirst($name), $str); + $str = preg_replace('/@@namespace@@/', $namespace, $str); } if (sizeof($this->variableValues) > 0) { From 7495d00f4eace1ec7eca2b696bfd4217a3c90d61 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 16 Sep 2015 09:05:40 +0300 Subject: [PATCH 30/48] Improved color support detection --- scripts/Phalcon/Script/Color.php | 38 ++++++++------------------------ 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/scripts/Phalcon/Script/Color.php b/scripts/Phalcon/Script/Color.php index 39c8cc30a..3c3b74be0 100644 --- a/scripts/Phalcon/Script/Color.php +++ b/scripts/Phalcon/Script/Color.php @@ -25,15 +25,12 @@ * * Allows to generate messages using colors on xterm, ddterm, linux, etc. * - * @category Phalcon - * @package Script - * @subpackage Color - * @copyright Copyright (c) 2011-2015 Phalcon Team (team@phalconphp.com) - * @license New BSD License + * @package Phalcon\Script + * @copyright Copyright (c) 2011-2015 Phalcon Team (team@phalconphp.com) + * @license New BSD License */ final class Color { - const FG_BLACK = 1; const FG_DARK_GRAY = 2; const FG_BLUE = 3; @@ -119,17 +116,6 @@ final class Color self::AT_REVERSE => '7', self::AT_NONDISP => '8', self::AT_STRIKE => '9', -); - - /** - * Supported terminals - * - * @var string - */ - private static $_supportedShells = array( - 'xterm' => true, - 'xterm-256color' => true, - 'xterm-color' => true, ); /** @@ -139,21 +125,15 @@ final class Color */ public static function isSupportedShell() { - $flag = false; + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + return false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI'); + } - if (isset($_ENV['TERM'])) { - if (isset(self::$_supportedShells[$_ENV['TERM']])) { - $flag = true; - } - } else { - if (isset($_SERVER['TERM'])) { - if (isset(self::$_supportedShells[$_SERVER['TERM']])) { - $flag = true; - } - } + if (!defined('STDOUT')) { + return false; } - return $flag; + return function_exists('posix_isatty') && posix_isatty(STDOUT); } /** From ad7de6532e3f7ecd4b5bb0b3201c93bda54ee55d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Wed, 16 Sep 2015 09:40:45 +0300 Subject: [PATCH 31/48] Updated enumerate output --- README.md | 20 +++++++++---------- .../Phalcon/Commands/Builtin/Enumerate.php | 9 +++++++-- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9ed575c6a..f6bb7f539 100644 --- a/README.md +++ b/README.md @@ -122,26 +122,26 @@ chmod ugo+x /usr/bin/phalcon To get a list of available commands just execute following: ```bash -$ phalcon commands +$ phalcon commands help ``` This command should display something similar to: ```bash -Phalcon DevTools (2.0.7) +Phalcon DevTools (2.0.8) Help: Lists the commands available in Phalcon devtools Available commands: - commands (alias of: list, enumerate) - controller (alias of: create-controller) - model (alias of: create-model) - all-models (alias of: create-all-models) - project (alias of: create-project) - scaffold (alias of: create-scaffold) - migration (alias of: create-migration) - webtools (alias of: create-webtools) + commands (alias of: list, enumerate) + controller (alias of: create-controller) + model (alias of: create-model) + all-models (alias of: create-all-models) + project (alias of: create-project) + scaffold (alias of: create-scaffold) + migration (alias of: create-migration) + webtools (alias of: create-webtools) ``` ## Update WebTools from old version diff --git a/scripts/Phalcon/Commands/Builtin/Enumerate.php b/scripts/Phalcon/Commands/Builtin/Enumerate.php index cd62346ef..d765ff5d0 100644 --- a/scripts/Phalcon/Commands/Builtin/Enumerate.php +++ b/scripts/Phalcon/Commands/Builtin/Enumerate.php @@ -32,6 +32,8 @@ */ class Enumerate extends Command { + const COMMAND_COLUMN_LEN = 16; + protected $_possibleParameters = array(); /** @@ -42,13 +44,16 @@ class Enumerate extends Command */ public function run($parameters) { - print Color::colorize('Available commands:', Color::FG_BROWN) . PHP_EOL ; + print Color::colorize('Available commands:', Color::FG_BROWN) . PHP_EOL; foreach ($this->getScript()->getCommands() as $commands) { $providedCommands = $commands->getCommands(); + $commandLen = strlen($providedCommands[0]); + print ' ' . Color::colorize($providedCommands[0], Color::FG_GREEN); unset($providedCommands[0]); if (count($providedCommands)) { - print ' (alias of: ' . Color::colorize(join(', ', $providedCommands)) . ')'; + $spacer = str_repeat(' ', self::COMMAND_COLUMN_LEN - $commandLen); + print $spacer.' (alias of: ' . Color::colorize(join(', ', $providedCommands)) . ')'; } print PHP_EOL; } From ed87eae7a8308064fc1784ccb8c2717fddae7a2e Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 20 Sep 2015 15:45:16 +0300 Subject: [PATCH 32/48] Minor improvements related to system directory --- scripts/Phalcon/Commands/CommandsListener.php | 4 ++-- scripts/Phalcon/Generator/Snippet.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/Phalcon/Commands/CommandsListener.php b/scripts/Phalcon/Commands/CommandsListener.php index 64668ef5c..c4a334c62 100644 --- a/scripts/Phalcon/Commands/CommandsListener.php +++ b/scripts/Phalcon/Commands/CommandsListener.php @@ -45,8 +45,8 @@ public function beforeCommand(Event $event, Command $command) { if ($command->canBeExternal() == false) { $path = $command->getOption('directory'); - if (!file_exists($path . '.phalcon')) { - throw new CommandsException("This command should be invoked inside a Phalcon project directory"); + if (!file_exists($path . '.phalcon') || !is_dir($path . '.phalcon')) { + throw new CommandsException('This command should be invoked inside a Phalcon project directory.'); } } diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index 9d897b6d1..5b4c8f804 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -190,7 +190,7 @@ public function get%s() return PHP_EOL.sprintf($templateGetterMap, $fieldName, $type, $setterName, $fieldName, $typeMap, $fieldName).PHP_EOL; } - public function getGetter($fieldName, $type, $setterName) + public function getGetter($fieldName, $type, $getterName) { $templateGetter = <<%s; } EOD; - return PHP_EOL.sprintf($templateGetter, $fieldName, $type, $setterName, $fieldName).PHP_EOL; + return PHP_EOL.sprintf($templateGetter, $fieldName, $type, $getterName, $fieldName).PHP_EOL; } public function getInitialize(array $pieces) From ca914fe4b509750b99858a9f0044b96200acffe0 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 20 Sep 2015 15:45:39 +0300 Subject: [PATCH 33/48] Added Command::getOptions --- scripts/Phalcon/Commands/Command.php | 47 +++++++++++++++++++++------- 1 file changed, 35 insertions(+), 12 deletions(-) diff --git a/scripts/Phalcon/Commands/Command.php b/scripts/Phalcon/Commands/Command.php index 8f8d7a572..a0bec49d7 100644 --- a/scripts/Phalcon/Commands/Command.php +++ b/scripts/Phalcon/Commands/Command.php @@ -56,7 +56,7 @@ abstract class Command implements CommandsInterface /** * Parameters received by the script. - * @var string + * @var array */ protected $_parameters = array(); @@ -301,10 +301,33 @@ public function showHelp($possibleParameters) } /** - * Returns the value of an option received. If more parameters are taken as filters. + * Returns all received options. + * + * @param mixed $filters Filter name or array of filters [Optional] + * + * @return array + */ + public function getOptions($filters = null) + { + if (!$filters) { + return $this->_parameters; + } + + $result = []; + + foreach ($this->_parameters as $param) { + $filter = new Filter(); + $result[] = $filter->sanitize($param, $filters); + } + + return $result; + } + + /** + * Returns the value of an option received. * * @param mixed $option Option name or array of options - * @param mixed $filters Filter name or array of filters + * @param mixed $filters Filter name or array of filters [Optional] * @param mixed $defaultValue Default value [Optional] * * @return mixed @@ -325,19 +348,19 @@ public function getOption($option, $filters = null, $defaultValue = null) } return $defaultValue; - } else { - if (isset($this->_parameters[$option])) { - if ($filters !== null) { - $filter = new Filter(); + } - return $filter->sanitize($this->_parameters[$option], $filters); - } + if (isset($this->_parameters[$option])) { + if ($filters !== null) { + $filter = new Filter(); - return $this->_parameters[$option]; - } else { - return $defaultValue; + return $filter->sanitize($this->_parameters[$option], $filters); } + + return $this->_parameters[$option]; } + + return $defaultValue; } /** From 5341228a20d894058f3d97bd225c91defdd3cc12 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 20 Sep 2015 15:46:09 +0300 Subject: [PATCH 34/48] Fixed issue #505 --- scripts/Phalcon/Builder/Model.php | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/Phalcon/Builder/Model.php b/scripts/Phalcon/Builder/Model.php index 43bc139ba..47d250868 100644 --- a/scripts/Phalcon/Builder/Model.php +++ b/scripts/Phalcon/Builder/Model.php @@ -323,7 +323,12 @@ public function build() if ($useSettersGetters) { foreach ($fields as $field) { /** @var \Phalcon\Db\Column $field */ - $methodName = Utils::camelize($field->getName()); + + $methodName = $field->getName(); + $methodParts = explode('_', $methodName); + $methodParts = array_map('ucfirst',$methodParts); + $methodName = implode('', $methodParts); + $possibleMethods['set' . $methodName] = true; $possibleMethods['get' . $methodName] = true; } @@ -441,13 +446,18 @@ public function build() $type = $this->getPHPType($field->getType()); if ($useSettersGetters) { $attributes[] = $this->snippet->getAttributes($type, 'protected', $field->getName()); - $setterName = Utils::camelize($field->getName()); - $setters[] = $this->snippet->getSetter($field->getName(), $type, $setterName); + + $methodName = $field->getName(); + $methodParts = explode('_', $methodName); + $methodParts = array_map('ucfirst',$methodParts); + $methodName = implode('', $methodParts); + + $setters[] = $this->snippet->getSetter($field->getName(), $type, $methodName); if (isset($this->_typeMap[$type])) { - $getters[] = $this->snippet->getGetterMap($field->getName(), $type, $setterName, $this->_typeMap[$type]); + $getters[] = $this->snippet->getGetterMap($field->getName(), $type, $methodName, $this->_typeMap[$type]); } else { - $getters[] = $this->snippet->getGetter($field->getName(), $type, $setterName); + $getters[] = $this->snippet->getGetter($field->getName(), $type, $methodName); } } else { $attributes[] = $this->snippet->getAttributes($type, 'public', $field->getName()); From f3499fce5ce0dab9fe77899b7bfbea27f9fcae0b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 00:26:54 +0300 Subject: [PATCH 35/48] Cleaned entry point --- phalcon.pear | 15 +++------------ phalcon.php | 9 +-------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/phalcon.pear b/phalcon.pear index 3da29c314..010eb2c6f 100755 --- a/phalcon.pear +++ b/phalcon.pear @@ -30,10 +30,7 @@ use Phalcon\Events\Manager as EventsManager; use Phalcon\Exception as PhalconException; try { - $extensionLoaded = true; - if (!extension_loaded('phalcon')) { - $extensionLoaded = false; include dirname(__FILE__) . '/scripts/Phalcon/Script.php'; throw new Exception( sprintf( @@ -86,14 +83,8 @@ try { } $script->run(); -} -catch (PhalconException $e) { +} catch (PhalconException $e) { print Color::error($e->getMessage()) . PHP_EOL; -} -catch (Exception $e) { - if ($extensionLoaded) { - print Color::error($e->getMessage()) . PHP_EOL; - } else { - print 'ERROR: ' . $e->getMessage() . PHP_EOL; - } +} catch (Exception $e) { + print 'ERROR: ' . $e->getMessage() . PHP_EOL; } diff --git a/phalcon.php b/phalcon.php index 8ea7e2bb1..c36bde738 100755 --- a/phalcon.php +++ b/phalcon.php @@ -30,10 +30,7 @@ use Phalcon\Exception as PhalconException; try { - $extensionLoaded = true; - if (!extension_loaded('phalcon')) { - $extensionLoaded = false; include dirname(__FILE__) . '/scripts/Phalcon/Script.php'; throw new Exception( sprintf( @@ -90,9 +87,5 @@ } catch (PhalconException $e) { print Color::error($e->getMessage()) . PHP_EOL; } catch (Exception $e) { - if ($extensionLoaded) { - print Color::error($e->getMessage()) . PHP_EOL; - } else { - print 'ERROR: ' . $e->getMessage() . PHP_EOL; - } + print 'ERROR: ' . $e->getMessage() . PHP_EOL; } From 2dda45ea8b7e423fb633163242b1459fc2a9c06a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 00:46:22 +0300 Subject: [PATCH 36/48] Regenerated stubs for 2.0.7 (improved) --- ide/2.0.7/Phalcon/Config.php | 35 +++++++++---------- ide/2.0.7/Phalcon/FilterInterface.php | 2 +- ide/2.0.7/Phalcon/Registry.php | 4 +-- ide/2.0.7/Phalcon/acl/Resource.php | 2 ++ ide/2.0.7/Phalcon/acl/Role.php | 2 ++ ide/2.0.7/Phalcon/assets/Collection.php | 3 -- ide/2.0.7/Phalcon/db/RawValue.php | 2 ++ ide/2.0.7/Phalcon/http/Request.php | 2 +- ide/2.0.7/Phalcon/http/response/Headers.php | 3 -- ide/2.0.7/Phalcon/mvc/model/Validator.php | 5 +-- .../Phalcon/mvc/model/validator/Email.php | 3 -- .../mvc/model/validator/Exclusionin.php | 3 -- .../mvc/model/validator/Inclusionin.php | 3 -- ide/2.0.7/Phalcon/mvc/model/validator/Ip.php | 3 -- .../mvc/model/validator/Numericality.php | 3 -- .../mvc/model/validator/PresenceOf.php | 3 -- .../Phalcon/mvc/model/validator/Regex.php | 3 -- .../mvc/model/validator/StringLength.php | 3 -- .../mvc/model/validator/Uniqueness.php | 3 -- ide/2.0.7/Phalcon/mvc/model/validator/Url.php | 3 -- ide/2.0.7/Phalcon/translate/adapter/Csv.php | 3 -- ide/2.0.7/Phalcon/validation/Validator.php | 2 +- .../Phalcon/validation/ValidatorInterface.php | 2 +- 23 files changed, 30 insertions(+), 67 deletions(-) diff --git a/ide/2.0.7/Phalcon/Config.php b/ide/2.0.7/Phalcon/Config.php index e55ccf325..b3112b0da 100644 --- a/ide/2.0.7/Phalcon/Config.php +++ b/ide/2.0.7/Phalcon/Config.php @@ -30,7 +30,7 @@ class Config implements \ArrayAccess, \Countable /** * Phalcon\Config constructor * - * @param array $arrayConfig + * @param array $arrayConfig */ public function __construct($arrayConfig = null) {} @@ -40,8 +40,8 @@ public function __construct($arrayConfig = null) {} * var_dump(isset($config['database'])); * * - * @param mixed $index - * @return bool + * @param mixed $index + * @return bool */ public function offsetExists($index) {} @@ -52,9 +52,8 @@ public function offsetExists($index) {} * echo $config->get('controllersDir', '../app/controllers/'); * * - * @param mixed $index - * @param mixed $defaultValue - * @return mixed + * @param mixed $index + * @param mixed $defaultValue */ public function get($index, $defaultValue = null) {} @@ -64,8 +63,8 @@ public function get($index, $defaultValue = null) {} * print_r($config['database']); * * - * @param mixed $index - * @return string + * @param mixed $index + * @return string */ public function offsetGet($index) {} @@ -75,8 +74,8 @@ public function offsetGet($index) {} * $config['database'] = array('type' => 'Sqlite'); * * - * @param mixed $index - * @param mixed $value + * @param mixed $index + * @param mixed $value */ public function offsetSet($index, $value) {} @@ -86,7 +85,7 @@ public function offsetSet($index, $value) {} * unset($config['database']); * * - * @param mixed $index + * @param mixed $index */ public function offsetUnset($index) {} @@ -97,8 +96,8 @@ public function offsetUnset($index) {} * $globalConfig->merge($config2); * * - * @param mixed $config - * @return Config + * @param mixed $config + * @return Config */ public function merge(Config $config) {} @@ -108,7 +107,7 @@ public function merge(Config $config) {} * print_r($config->toArray()); * * - * @return array + * @return array */ public function toArray() {} @@ -122,22 +121,22 @@ public function toArray() {} * print $config->count(); * * - * @return int + * @return int */ public function count() {} /** * Restores the state of a Phalcon\Config object * - * @param array $data - * @return Config + * @param array $data + * @return Config */ public static function __set_state($data) {} /** * Helper method for merge configs (forwarding nested config instance) * - * @param Config $config + * @param Config $config * @param Config $instance = null * @return Config config */ diff --git a/ide/2.0.7/Phalcon/FilterInterface.php b/ide/2.0.7/Phalcon/FilterInterface.php index 5ebd2ee21..459b8b42b 100644 --- a/ide/2.0.7/Phalcon/FilterInterface.php +++ b/ide/2.0.7/Phalcon/FilterInterface.php @@ -23,7 +23,7 @@ public function add($name, $handler); * * @param mixed $value * @param mixed $filters - * @return variable + * @return mixed */ public function sanitize($value, $filters); diff --git a/ide/2.0.7/Phalcon/Registry.php b/ide/2.0.7/Phalcon/Registry.php index 560353724..1e5a4c2c7 100644 --- a/ide/2.0.7/Phalcon/Registry.php +++ b/ide/2.0.7/Phalcon/Registry.php @@ -65,7 +65,7 @@ public final function offsetExists($offset) {} * Returns an index in the registry * * @param string $offset - * @return variable + * @return mixed */ public final function offsetGet($offset) {} @@ -132,7 +132,7 @@ public final function __set($key, $value) {} * Returns an index in the registry * * @param string $key - * @return variable + * @return mixed */ public final function __get($key) {} diff --git a/ide/2.0.7/Phalcon/acl/Resource.php b/ide/2.0.7/Phalcon/acl/Resource.php index 873993215..5f749d9ba 100644 --- a/ide/2.0.7/Phalcon/acl/Resource.php +++ b/ide/2.0.7/Phalcon/acl/Resource.php @@ -32,6 +32,8 @@ public function getName() {} /** * Resource name + * + * @return string */ public function __toString() {} diff --git a/ide/2.0.7/Phalcon/acl/Role.php b/ide/2.0.7/Phalcon/acl/Role.php index ad6ff8cf4..4be7debe1 100644 --- a/ide/2.0.7/Phalcon/acl/Role.php +++ b/ide/2.0.7/Phalcon/acl/Role.php @@ -32,6 +32,8 @@ public function getName() {} /** * Role name + * + * @return string */ public function __toString() {} diff --git a/ide/2.0.7/Phalcon/assets/Collection.php b/ide/2.0.7/Phalcon/assets/Collection.php index 3a7cd3bfa..ea2bd2a1c 100644 --- a/ide/2.0.7/Phalcon/assets/Collection.php +++ b/ide/2.0.7/Phalcon/assets/Collection.php @@ -265,7 +265,4 @@ public function getRealTargetPath($basePath) {} */ public function addFilter(\Phalcon\Assets\FilterInterface $filter) {} - - function zephir_init_properties_Phalcon_Assets_Collection() {} - } diff --git a/ide/2.0.7/Phalcon/db/RawValue.php b/ide/2.0.7/Phalcon/db/RawValue.php index fe66e8fd4..e2e13798f 100644 --- a/ide/2.0.7/Phalcon/db/RawValue.php +++ b/ide/2.0.7/Phalcon/db/RawValue.php @@ -32,6 +32,8 @@ public function getValue() {} /** * Raw value without quoting or formating + * + * @return string */ public function __toString() {} diff --git a/ide/2.0.7/Phalcon/http/Request.php b/ide/2.0.7/Phalcon/http/Request.php index 02178ae72..4fd377e06 100644 --- a/ide/2.0.7/Phalcon/http/Request.php +++ b/ide/2.0.7/Phalcon/http/Request.php @@ -440,7 +440,7 @@ public function getBestAccept() {} /** * Gets a charsets array and their quality accepted by the browser/client from _SERVER["HTTP_ACCEPT_CHARSET"] * - * @return variable + * @return mixed */ public function getClientCharsets() {} diff --git a/ide/2.0.7/Phalcon/http/response/Headers.php b/ide/2.0.7/Phalcon/http/response/Headers.php index 6089947e7..215ada01f 100644 --- a/ide/2.0.7/Phalcon/http/response/Headers.php +++ b/ide/2.0.7/Phalcon/http/response/Headers.php @@ -69,7 +69,4 @@ public function toArray() {} */ public static function __set_state($data) {} - - function zephir_init_properties_Phalcon_Http_Response_Headers() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/Validator.php b/ide/2.0.7/Phalcon/mvc/model/Validator.php index 62ae37996..10af0393b 100644 --- a/ide/2.0.7/Phalcon/mvc/model/Validator.php +++ b/ide/2.0.7/Phalcon/mvc/model/Validator.php @@ -50,7 +50,7 @@ public function getOptions() {} * * @param string $option * @param mixed $defaultValue - * @return variable + * @return mixed */ public function getOption($option, $defaultValue = "") {} @@ -62,7 +62,4 @@ public function getOption($option, $defaultValue = "") {} */ public function isSetOption($option) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Email.php b/ide/2.0.7/Phalcon/mvc/model/validator/Email.php index e9bdea691..c9678c118 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Email.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Email.php @@ -32,7 +32,4 @@ class Email extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\V */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Email() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Exclusionin.php b/ide/2.0.7/Phalcon/mvc/model/validator/Exclusionin.php index 472e40659..68d4f6712 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Exclusionin.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Exclusionin.php @@ -33,7 +33,4 @@ class Exclusionin extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\M */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Exclusionin() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Inclusionin.php b/ide/2.0.7/Phalcon/mvc/model/validator/Inclusionin.php index 885a18695..59cf66446 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Inclusionin.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Inclusionin.php @@ -33,7 +33,4 @@ class Inclusionin extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\M */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Inclusionin() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Ip.php b/ide/2.0.7/Phalcon/mvc/model/validator/Ip.php index 68e669af5..d51d0bb77 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Ip.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Ip.php @@ -56,7 +56,4 @@ class Ip extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\Vali */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Ip() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Numericality.php b/ide/2.0.7/Phalcon/mvc/model/validator/Numericality.php index 3e8ee0c64..3d974013a 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Numericality.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Numericality.php @@ -32,7 +32,4 @@ class Numericality extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\ */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Numericality() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/PresenceOf.php b/ide/2.0.7/Phalcon/mvc/model/validator/PresenceOf.php index 97471fec4..60940e751 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/PresenceOf.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/PresenceOf.php @@ -33,7 +33,4 @@ class PresenceOf extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Mo */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_PresenceOf() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Regex.php b/ide/2.0.7/Phalcon/mvc/model/validator/Regex.php index c89d1e5b1..2d4bc5be0 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Regex.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Regex.php @@ -33,7 +33,4 @@ class Regex extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\V */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Regex() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/StringLength.php b/ide/2.0.7/Phalcon/mvc/model/validator/StringLength.php index b1588c7b5..0af90947b 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/StringLength.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/StringLength.php @@ -36,7 +36,4 @@ class StringLength extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\ */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_StringLength() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Uniqueness.php b/ide/2.0.7/Phalcon/mvc/model/validator/Uniqueness.php index 1a5105ca0..19502febe 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Uniqueness.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Uniqueness.php @@ -35,7 +35,4 @@ class Uniqueness extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Mo */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Uniqueness() {} - } diff --git a/ide/2.0.7/Phalcon/mvc/model/validator/Url.php b/ide/2.0.7/Phalcon/mvc/model/validator/Url.php index 9579116c2..11d72f931 100644 --- a/ide/2.0.7/Phalcon/mvc/model/validator/Url.php +++ b/ide/2.0.7/Phalcon/mvc/model/validator/Url.php @@ -32,7 +32,4 @@ class Url extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\Val */ public function validate(\Phalcon\Mvc\EntityInterface $record) {} - - function zephir_init_properties_Phalcon_Mvc_Model_Validator_Url() {} - } diff --git a/ide/2.0.7/Phalcon/translate/adapter/Csv.php b/ide/2.0.7/Phalcon/translate/adapter/Csv.php index 5547f044d..c0410d591 100644 --- a/ide/2.0.7/Phalcon/translate/adapter/Csv.php +++ b/ide/2.0.7/Phalcon/translate/adapter/Csv.php @@ -46,7 +46,4 @@ public function query($index, $placeholders = null) {} */ public function exists($index) {} - - function zephir_init_properties_Phalcon_Translate_Adapter_Csv() {} - } diff --git a/ide/2.0.7/Phalcon/validation/Validator.php b/ide/2.0.7/Phalcon/validation/Validator.php index ac71fc797..7dcb193cc 100644 --- a/ide/2.0.7/Phalcon/validation/Validator.php +++ b/ide/2.0.7/Phalcon/validation/Validator.php @@ -43,7 +43,7 @@ public function hasOption($key) {} * * @param string $key * @param mixed $defaultValue - * @return variable + * @return mixed */ public function getOption($key, $defaultValue = null) {} diff --git a/ide/2.0.7/Phalcon/validation/ValidatorInterface.php b/ide/2.0.7/Phalcon/validation/ValidatorInterface.php index 792629cd2..301c3811a 100644 --- a/ide/2.0.7/Phalcon/validation/ValidatorInterface.php +++ b/ide/2.0.7/Phalcon/validation/ValidatorInterface.php @@ -33,7 +33,7 @@ public function hasOption($key); * * @param string $key * @param mixed $defaultValue - * @return variable + * @return mixed */ public function getOption($key, $defaultValue = null); From 01f3aa627ab3a992389e3e31fc18fb4003e1bbbc Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 00:46:44 +0300 Subject: [PATCH 37/48] Cleaned ScriptException --- scripts/Phalcon/Script/ScriptException.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/Phalcon/Script/ScriptException.php b/scripts/Phalcon/Script/ScriptException.php index 55ca2b369..8798d2785 100644 --- a/scripts/Phalcon/Script/ScriptException.php +++ b/scripts/Phalcon/Script/ScriptException.php @@ -20,15 +20,15 @@ namespace Phalcon\Script; +use Phalcon\Exception as PhalconException; + /** * \Phalcon\Script\ScriptException * - * @category Phalcon - * @package Script - * @subpackage Exception + * @package Phalcon * @copyright Copyright (c) 2011-2015 Phalcon Team (team@phalconphp.com) - * @license New BSD License + * @license New BSD License */ -class ScriptException extends \Phalcon\Exception +class ScriptException extends PhalconException { } From 85d57bc16e17a8e0f34bf109470810011cac99cc Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 01:04:18 +0300 Subject: [PATCH 38/48] Fixed template-path parameter --- scripts/Phalcon/Commands/Builtin/Project.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Phalcon/Commands/Builtin/Project.php b/scripts/Phalcon/Commands/Builtin/Project.php index ec57b6824..d8dc49e9e 100644 --- a/scripts/Phalcon/Commands/Builtin/Project.php +++ b/scripts/Phalcon/Commands/Builtin/Project.php @@ -40,7 +40,7 @@ class Project extends Command 'enable-webtools' => 'Determines if webtools should be enabled [optional]', 'directory=s' => 'Base path on which project will be created [optional]', 'type=s' => 'Type of the application to be generated (cli, micro, simple, modules)', - 'template-path' => 'Specify a template path [optional]', + 'template-path=s' => 'Specify a template path [optional]', 'use-config-ini' => 'Use a ini file as configuration file [optional]', 'trace' => 'Shows the trace of the framework in case of exception. [optional]', 'help' => 'Shows this help' From 7d30ec257757f583bc72c03b57244cff0efdb044 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 01:44:20 +0300 Subject: [PATCH 39/48] Improved migration class template --- scripts/Phalcon/Generator/Snippet.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/Phalcon/Generator/Snippet.php b/scripts/Phalcon/Generator/Snippet.php index 5b4c8f804..fa41bc3f3 100644 --- a/scripts/Phalcon/Generator/Snippet.php +++ b/scripts/Phalcon/Generator/Snippet.php @@ -321,6 +321,9 @@ public function getMigrationMorph($className, $table, $tableDefinition) use Phalcon\Db\Reference; use Phalcon\Mvc\Model\Migration; +/** + * Class %s + */ class %s extends Migration { /** @@ -333,7 +336,7 @@ public function morph() \$this->morphTable('%s', array( %s EOD; - return sprintf($template, $className, $table, $this->getMigrationDefinition('columns', $tableDefinition)); + return sprintf($template, $className, $className, $table, $this->getMigrationDefinition('columns', $tableDefinition)); } public function getMigrationUp() From 793158536c2124f5153855cd582993efcdccb4d4 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 01:44:58 +0300 Subject: [PATCH 40/48] Added Mvc\Model\Migration::getDbName --- scripts/Phalcon/Mvc/Model/Migration.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/Phalcon/Mvc/Model/Migration.php b/scripts/Phalcon/Mvc/Model/Migration.php index a36725cd1..c875f3ec4 100644 --- a/scripts/Phalcon/Mvc/Model/Migration.php +++ b/scripts/Phalcon/Mvc/Model/Migration.php @@ -160,6 +160,16 @@ public static function generateAll($version, $exportData = null) return $classDefinition; } + /** + * Returns database name + * + * @return mixed + */ + public static function getDbName() + { + return self::$_databaseConfig->get('dbname'); + } + /** * Generate specified table migration * From 3671555cb7a24b1061f868e18d9046ea1199cfea Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 08:18:52 +0300 Subject: [PATCH 41/48] Cleaned entry point --- phalcon.pear | 7 ++----- phalcon.php | 7 ++----- scripts/Phalcon/Script.php | 1 - 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/phalcon.pear b/phalcon.pear index 010eb2c6f..a5778ecd4 100755 --- a/phalcon.pear +++ b/phalcon.pear @@ -31,12 +31,9 @@ use Phalcon\Exception as PhalconException; try { if (!extension_loaded('phalcon')) { - include dirname(__FILE__) . '/scripts/Phalcon/Script.php'; throw new Exception( - sprintf( - "Phalcon extension isn't installed, follow these instructions to install it: %s", - Script::DOC_INSTALL_URL - ) + "Phalcon extension isn't installed, follow these instructions to install it: " . + 'http://phalconphp.com/documentation/install' ); } diff --git a/phalcon.php b/phalcon.php index c36bde738..265cdebab 100755 --- a/phalcon.php +++ b/phalcon.php @@ -31,12 +31,9 @@ try { if (!extension_loaded('phalcon')) { - include dirname(__FILE__) . '/scripts/Phalcon/Script.php'; throw new Exception( - sprintf( - "Phalcon extension isn't installed, follow these instructions to install it: %s", - Script::DOC_INSTALL_URL - ) + "Phalcon extension isn't installed, follow these instructions to install it: " . + 'http://phalconphp.com/documentation/install' ); } diff --git a/scripts/Phalcon/Script.php b/scripts/Phalcon/Script.php index 484ea70c5..208067ba7 100644 --- a/scripts/Phalcon/Script.php +++ b/scripts/Phalcon/Script.php @@ -43,7 +43,6 @@ class Script */ const COMPATIBLE_VERSION = 2000023; - const DOC_INSTALL_URL = ' http://phalconphp.com/documentation/install'; const DOC_DOWNLOAD_URL = 'http://phalconphp.com/download'; /** From c6e8c8b1ff879f4b5029a8a378022838608a0aca Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 08:19:35 +0300 Subject: [PATCH 42/48] Moved loading config logic to the common place --- .../Phalcon/Commands/Builtin/Migration.php | 81 ------------------ scripts/Phalcon/Commands/Command.php | 85 +++++++++++++++++++ 2 files changed, 85 insertions(+), 81 deletions(-) diff --git a/scripts/Phalcon/Commands/Builtin/Migration.php b/scripts/Phalcon/Commands/Builtin/Migration.php index 2bb7cee23..ed9eb53e4 100644 --- a/scripts/Phalcon/Commands/Builtin/Migration.php +++ b/scripts/Phalcon/Commands/Builtin/Migration.php @@ -54,87 +54,6 @@ class Migration extends Command 'data=s' => "Export data [always|oncreate] (Import data when run migration).", ); - /** - * Determines correct adapter by file name - * and load config - * - * @param string $fileName Config file name - * - * @return \Phalcon\Config - * @throws \Phalcon\Builder\BuilderException - */ - protected function loadConfig($fileName) - { - $pathInfo = pathinfo($fileName); - - if (isset($pathInfo['extension'])) { - $extension = strtolower(trim($pathInfo['extension'])); - if ($extension === 'php') { - $config = include($fileName); - if (is_array($config)) { - $config = new Config($config); - } - - return $config; - } elseif ($extension === 'ini') { - return new IniConfig($fileName); - } elseif ($extension === 'json') { - return new JsonConfig($fileName); - } elseif ($extension === 'json') { - return new YamlConfig($fileName); - } - } - - throw new BuilderException("Builder can't locate the configuration file."); - } - - /** - * @param string $path Config path - * - * @return \Phalcon\Config - * @throws \Phalcon\Builder\BuilderException - */ - protected function getConfig($path) - { - foreach (array('app/config/', 'config/') as $configPath) { - if (file_exists($path . $configPath. "config.ini")) { - return new IniConfig($path . $configPath. "/config.ini"); - } elseif (file_exists($path . $configPath. "/config.php")) { - $config = include($path . $configPath. "/config.php"); - if (is_array($config)) { - $config = new Config($config); - } - - return $config; - } elseif (file_exists($path . $configPath. "/config.json")) { - return new JsonConfig($path . $configPath. "/config.json"); - } elseif (file_exists($path . $configPath. "/config.yaml")) { - return new YamlConfig($path . $configPath. "/config.yaml"); - } - } - - $directory = new \RecursiveDirectoryIterator('.'); - $iterator = new \RecursiveIteratorIterator($directory); - foreach ($iterator as $f) { - if (preg_match('/config\.php$/i', $f->getPathName())) { - $config = include($f->getPathName()); - if (is_array($config)) { - $config = new Config($config); - } - - return $config; - } elseif (preg_match('/config\.ini$/i', $f->getPathName())) { - return new IniConfig($f->getPathName()); - } elseif (preg_match('/config\.json$/i', $f->getPathName())) { - return new JsonConfig($f->getPathName()); - } elseif (preg_match('/config\.yaml$/i', $f->getPathName())) { - return new YamlConfig($f->getPathName()); - } - } - - throw new BuilderException("Builder can't locate the configuration file."); - } - /** * Executes the command * diff --git a/scripts/Phalcon/Commands/Command.php b/scripts/Phalcon/Commands/Command.php index a0bec49d7..17ce1b7b8 100644 --- a/scripts/Phalcon/Commands/Command.php +++ b/scripts/Phalcon/Commands/Command.php @@ -26,6 +26,10 @@ use Phalcon\Events\Manager as EventsManager; use Phalcon\Filter; use Phalcon\Builder\Path; +use Phalcon\Config\Adapter\Ini as IniConfig; +use Phalcon\Config\Adapter\Json as JsonConfig; +use Phalcon\Config\Adapter\Yaml as YamlConfig; +use Phalcon\Config; /** * Command Class @@ -121,6 +125,87 @@ public function getScript() return $this->_script; } + /** + * @param string $path Config path + * + * @return \Phalcon\Config + * @throws CommandsException + */ + protected function getConfig($path) + { + foreach (array('app/config/', 'config/') as $configPath) { + if (file_exists($path . $configPath. "config.ini")) { + return new IniConfig($path . $configPath. "/config.ini"); + } elseif (file_exists($path . $configPath. "/config.php")) { + $config = include($path . $configPath. "/config.php"); + if (is_array($config)) { + $config = new Config($config); + } + + return $config; + } elseif (file_exists($path . $configPath. "/config.json")) { + return new JsonConfig($path . $configPath. "/config.json"); + } elseif (file_exists($path . $configPath. "/config.yaml")) { + return new YamlConfig($path . $configPath. "/config.yaml"); + } + } + + $directory = new \RecursiveDirectoryIterator('.'); + $iterator = new \RecursiveIteratorIterator($directory); + foreach ($iterator as $f) { + if (preg_match('/config\.php$/i', $f->getPathName())) { + $config = include($f->getPathName()); + if (is_array($config)) { + $config = new Config($config); + } + + return $config; + } elseif (preg_match('/config\.ini$/i', $f->getPathName())) { + return new IniConfig($f->getPathName()); + } elseif (preg_match('/config\.json$/i', $f->getPathName())) { + return new JsonConfig($f->getPathName()); + } elseif (preg_match('/config\.yaml$/i', $f->getPathName())) { + return new YamlConfig($f->getPathName()); + } + } + + throw new CommandsException("Builder can't locate the configuration file."); + } + + /** + * Determines correct adapter by file name + * and load config + * + * @param string $fileName Config file name + * + * @return \Phalcon\Config + * @throws CommandsException + */ + protected function loadConfig($fileName) + { + $pathInfo = pathinfo($fileName); + + if (isset($pathInfo['extension'])) { + $extension = strtolower(trim($pathInfo['extension'])); + if ($extension === 'php') { + $config = include($fileName); + if (is_array($config)) { + $config = new Config($config); + } + + return $config; + } elseif ($extension === 'ini') { + return new IniConfig($fileName); + } elseif ($extension === 'json') { + return new JsonConfig($fileName); + } elseif ($extension === 'json') { + return new YamlConfig($fileName); + } + } + + throw new CommandsException("Builder can't locate the configuration file."); + } + /** * Parse the parameters passed to the script. * From ac21726159736b671080abd2d0e5ef5b62d4ba59 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 08:20:16 +0300 Subject: [PATCH 43/48] Added to the WebTools support of many config adapters --- scripts/Phalcon/Web/Tools.php | 58 +++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 20 deletions(-) diff --git a/scripts/Phalcon/Web/Tools.php b/scripts/Phalcon/Web/Tools.php index 89e23e675..6972d5f11 100644 --- a/scripts/Phalcon/Web/Tools.php +++ b/scripts/Phalcon/Web/Tools.php @@ -29,8 +29,10 @@ use Phalcon\Script; use Phalcon\Di\FactoryDefault; use Phalcon\Mvc\View; -use Phalcon\Config\Adapter\Ini as ConfigIni; use Phalcon\Config; +use Phalcon\Config\Adapter\Ini as ConfigIni; +use Phalcon\Config\Adapter\Yaml as YamlConfig; +use Phalcon\Config\Adapter\Json as JsonConfig; /** * Phalcon\Web\Tools @@ -214,10 +216,8 @@ public static function main($path, $ip = null) { if (!extension_loaded('phalcon')) { throw new \Exception( - sprintf( - "Phalcon extension isn't installed, follow these instructions to install it: %s", - Script::DOC_INSTALL_URL - ) + "Phalcon extension isn't installed, follow these instructions to install it: " . + 'http://phalconphp.com/documentation/install' ); } @@ -239,6 +239,7 @@ public static function main($path, $ip = null) ); $readed = false; + $config = null; foreach ($configDirs as $configPath) { if (file_exists($configPath . 'config.ini')) { @@ -246,16 +247,24 @@ public static function main($path, $ip = null) $readed = true; break; - } else { - if (file_exists($configPath . 'config.php')) { - $config = include($configPath . 'config.php'); - if (is_array($config)) { - $config = new Config($config); - } - $readed = true; - - break; + } elseif (file_exists($configPath . 'config.php')) { + $config = include($configPath . 'config.php'); + if (is_array($config)) { + $config = new Config($config); } + $readed = true; + + break; + } elseif (file_exists($configPath . 'config.yaml')) { + $config = new YamlConfig($configPath . 'config.yaml'); + $readed = true; + + break; + } elseif (file_exists($configPath . 'config.json')) { + $config = new JsonConfig($configPath . 'config.json'); + $readed = true; + + break; } } @@ -291,23 +300,32 @@ public static function main($path, $ip = null) try { $di = new FactoryDefault(); - $di->set('view', function () use ($path) { + $di->setShared('view', function () use ($path) { $view = new View(); $view->setViewsDir($path . '/scripts/Phalcon/Web/Tools/views/'); return $view; }); - $di->set('config', $config); + $di->setShared('config', $config); - $di->set('url', function () use ($config) { + $di->setShared('url', function () use ($config) { $url = new Url(); - $url->setBaseUri($config->application->baseUri); + + if (isset($config->application->baseUri)) { + $baseUri = $config->application->baseUri; + } elseif (isset($config->baseUri)) { + $baseUri = $config->baseUri; + } else { + $baseUri = '/'; + } + + $url->setBaseUri($baseUri); return $url; }); - $di->set('flash', function () { + $di->setShared('flash', function () { return new Flash(array( 'error' => 'alert alert-danger', 'success' => 'alert alert-success', @@ -316,7 +334,7 @@ public static function main($path, $ip = null) )); }); - $di->set('db', function () use ($config) { + $di->setShared('db', function () use ($config) { if (isset($config->database->adapter)) { $adapter = $config->database->adapter; From 4b1e46543c713d9c179fc386ba3562225aeef913 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 08:26:41 +0300 Subject: [PATCH 44/48] Cleaned Tools class --- scripts/Phalcon/Web/Tools.php | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/scripts/Phalcon/Web/Tools.php b/scripts/Phalcon/Web/Tools.php index 6972d5f11..50391df73 100644 --- a/scripts/Phalcon/Web/Tools.php +++ b/scripts/Phalcon/Web/Tools.php @@ -238,13 +238,11 @@ public static function main($path, $ip = null) $basePath . '/apps/backend/config/', ); - $readed = false; $config = null; foreach ($configDirs as $configPath) { if (file_exists($configPath . 'config.ini')) { $config = new ConfigIni($configPath . 'config.ini'); - $readed = true; break; } elseif (file_exists($configPath . 'config.php')) { @@ -252,25 +250,22 @@ public static function main($path, $ip = null) if (is_array($config)) { $config = new Config($config); } - $readed = true; break; } elseif (file_exists($configPath . 'config.yaml')) { $config = new YamlConfig($configPath . 'config.yaml'); - $readed = true; break; } elseif (file_exists($configPath . 'config.json')) { $config = new JsonConfig($configPath . 'config.json'); - $readed = true; break; } } - if ($readed === false) { + if (null === $config) { throw new Exception(sprintf( - 'Configuration file could not be loaded! Scanned dirs: %s', + "Configuration file couldn't be loaded! Scanned dirs: %s", implode(', ', $configDirs) )); } From d196d534a9a0c6638e1caa72dafb09586e89b282 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 21 Sep 2015 22:53:39 +0300 Subject: [PATCH 45/48] Removed PEAR instruction Removed because of the long lack of feedback for #109 Will be added back as needed. --- README.md | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index f6bb7f539..6c6bb4b41 100644 --- a/README.md +++ b/README.md @@ -77,30 +77,11 @@ chmod +xr ./phalcon.phar php ./phalcon.phar ``` -## Installation via PEAR +## Installation via Git -Phalcon Devtools can be installed using PEAR. Since the current version of Devtools -is in beta state, you might need to update your PEAR config. You can execute following to check -your current state: +Phalcon Devtools can be installed by using Git. -```bash -pear config-show | grep preferred_state | awk '{split($0, s, " "); print s[5]}' -``` - -If it prints "stable" you need to set the preferred_state to beta: - -```bash -pear config-set preferred_state beta -``` - -After that just discover the channel and install the package: - -```bash -pear channel-discover pear.phalconphp.com -pear install phalcon/Devtools -``` - -Alternatively you can just clone the repo and checkout the current branch +Just clone the repo and checkout the current branch: ```bash cd ~ From dac2e344e0c22e57b97bf19a6299e4c0307f5e51 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 22 Sep 2015 22:49:07 +0300 Subject: [PATCH 46/48] Added link to license --- README.md | 5 ++++- docs/LICENSE.md | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 docs/LICENSE.md diff --git a/README.md b/README.md index 6c6bb4b41..ceadd298d 100644 --- a/README.md +++ b/README.md @@ -163,4 +163,7 @@ $config = [ ## License -Phalcon Developer Tools is open source software licensed under the New BSD License. See the docs/LICENSE.txt file for more. +Phalcon Developer Tools is open source software licensed under the [New BSD License][1]. +© Phalcon Framework Team and contributors + +[1]: https://github.com/phalcon/phalcon-devtools/blob/master/docs/LICENSE.md diff --git a/docs/LICENSE.md b/docs/LICENSE.md new file mode 100644 index 000000000..b9b5d1f15 --- /dev/null +++ b/docs/LICENSE.md @@ -0,0 +1,27 @@ +New BSD License +--------------- + +Copyright (c) 2011-2015, Phalcon Team +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Phalcon Team nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL "PHALCON TEAM" BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. From 56449eef595d804ced67fb647a96036a60acc7fe Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 22 Sep 2015 22:58:28 +0300 Subject: [PATCH 47/48] Fixed #511 issue --- scripts/Phalcon/Builder/AllModels.php | 2 +- scripts/Phalcon/Builder/Controller.php | 2 +- scripts/Phalcon/Builder/Model.php | 14 ++------ scripts/Phalcon/Utils.php | 33 +++++++++++++++++++ .../Tools/controllers/ModelsController.php | 2 +- .../Tools/controllers/ScaffoldController.php | 2 +- 6 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 scripts/Phalcon/Utils.php diff --git a/scripts/Phalcon/Builder/AllModels.php b/scripts/Phalcon/Builder/AllModels.php index bf6ee7bfa..780cb575e 100644 --- a/scripts/Phalcon/Builder/AllModels.php +++ b/scripts/Phalcon/Builder/AllModels.php @@ -20,7 +20,7 @@ namespace Phalcon\Builder; -use Phalcon\Text as Utils; +use Phalcon\Utils; use Phalcon\Script\Color; /** diff --git a/scripts/Phalcon/Builder/Controller.php b/scripts/Phalcon/Builder/Controller.php index e44bd376b..719c5fa9a 100644 --- a/scripts/Phalcon/Builder/Controller.php +++ b/scripts/Phalcon/Builder/Controller.php @@ -20,7 +20,7 @@ namespace Phalcon\Builder; -use Phalcon\Text as Utils; +use Phalcon\Utils; /** * Controller Class diff --git a/scripts/Phalcon/Builder/Model.php b/scripts/Phalcon/Builder/Model.php index 47d250868..23a39f5c2 100644 --- a/scripts/Phalcon/Builder/Model.php +++ b/scripts/Phalcon/Builder/Model.php @@ -21,7 +21,7 @@ namespace Phalcon\Builder; use Phalcon\Db\Column; -use Phalcon\Text as Utils; +use Phalcon\Utils; use ReflectionException; use Phalcon\Generator\Snippet; use ReflectionClass; @@ -323,11 +323,7 @@ public function build() if ($useSettersGetters) { foreach ($fields as $field) { /** @var \Phalcon\Db\Column $field */ - - $methodName = $field->getName(); - $methodParts = explode('_', $methodName); - $methodParts = array_map('ucfirst',$methodParts); - $methodName = implode('', $methodParts); + $methodName = Utils::camelize($field->getName()); $possibleMethods['set' . $methodName] = true; $possibleMethods['get' . $methodName] = true; @@ -446,11 +442,7 @@ public function build() $type = $this->getPHPType($field->getType()); if ($useSettersGetters) { $attributes[] = $this->snippet->getAttributes($type, 'protected', $field->getName()); - - $methodName = $field->getName(); - $methodParts = explode('_', $methodName); - $methodParts = array_map('ucfirst',$methodParts); - $methodName = implode('', $methodParts); + $methodName = Utils::camelize($field->getName()); $setters[] = $this->snippet->getSetter($field->getName(), $type, $methodName); diff --git a/scripts/Phalcon/Utils.php b/scripts/Phalcon/Utils.php new file mode 100644 index 000000000..6f9508c3f --- /dev/null +++ b/scripts/Phalcon/Utils.php @@ -0,0 +1,33 @@ + | + | Eduar Carvajal | + | Serghei Iakovlev | + +------------------------------------------------------------------------+ +*/ + +namespace Phalcon; + +class Utils +{ + public static function camelize($string) + { + $stringParts = explode('_', $string); + $stringParts = array_map('ucfirst', $stringParts); + + return implode('', $stringParts); + } +} diff --git a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php index f6e867668..f15dd1213 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ModelsController.php +++ b/scripts/Phalcon/Web/Tools/controllers/ModelsController.php @@ -21,7 +21,7 @@ use Phalcon\Tag; use Phalcon\Builder\BuilderException; -use Phalcon\Text as Utils; +use Phalcon\Utils; class ModelsController extends ControllerBase { diff --git a/scripts/Phalcon/Web/Tools/controllers/ScaffoldController.php b/scripts/Phalcon/Web/Tools/controllers/ScaffoldController.php index aa1e8dbf8..ba1ac257f 100644 --- a/scripts/Phalcon/Web/Tools/controllers/ScaffoldController.php +++ b/scripts/Phalcon/Web/Tools/controllers/ScaffoldController.php @@ -20,7 +20,7 @@ use Phalcon\Builder\BuilderException; use Phalcon\Builder\Scaffold; -use Phalcon\Text as Utils; +use Phalcon\Utils; class ScaffoldController extends ControllerBase { From f4e087d8654a22d801dcc0333e22422496a57582 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 26 Sep 2015 00:26:54 +0300 Subject: [PATCH 48/48] Added 2.0.8 stubs --- ide/2.0.8/Phalcon/Acl.php | 45 + ide/2.0.8/Phalcon/Config.php | 145 ++ ide/2.0.8/Phalcon/Crypt.php | 190 +++ ide/2.0.8/Phalcon/CryptInterface.php | 107 ++ ide/2.0.8/Phalcon/Db.php | 96 ++ ide/2.0.8/Phalcon/Debug.php | 192 +++ ide/2.0.8/Phalcon/Di.php | 247 ++++ ide/2.0.8/Phalcon/DiInterface.php | 134 ++ ide/2.0.8/Phalcon/Dispatcher.php | 288 ++++ ide/2.0.8/Phalcon/DispatcherInterface.php | 120 ++ ide/2.0.8/Phalcon/Escaper.php | 112 ++ ide/2.0.8/Phalcon/EscaperInterface.php | 73 + ide/2.0.8/Phalcon/Exception.php | 12 + ide/2.0.8/Phalcon/Filter.php | 93 ++ ide/2.0.8/Phalcon/FilterInterface.php | 37 + ide/2.0.8/Phalcon/Flash.php | 119 ++ ide/2.0.8/Phalcon/FlashInterface.php | 48 + ide/2.0.8/Phalcon/Image.php | 36 + ide/2.0.8/Phalcon/Kernel.php | 20 + ide/2.0.8/Phalcon/Loader.php | 189 +++ ide/2.0.8/Phalcon/Logger.php | 53 + ide/2.0.8/Phalcon/Registry.php | 150 ++ ide/2.0.8/Phalcon/Security.php | 201 +++ ide/2.0.8/Phalcon/Session.php | 23 + ide/2.0.8/Phalcon/Tag.php | 718 ++++++++++ ide/2.0.8/Phalcon/Text.php | 171 +++ ide/2.0.8/Phalcon/Translate.php | 13 + ide/2.0.8/Phalcon/Validation.php | 179 +++ ide/2.0.8/Phalcon/Version.php | 106 ++ ide/2.0.8/Phalcon/acl/Adapter.php | 103 ++ ide/2.0.8/Phalcon/acl/AdapterInterface.php | 150 ++ ide/2.0.8/Phalcon/acl/Exception.php | 12 + ide/2.0.8/Phalcon/acl/Resource.php | 55 + ide/2.0.8/Phalcon/acl/ResourceInterface.php | 41 + ide/2.0.8/Phalcon/acl/Role.php | 55 + ide/2.0.8/Phalcon/acl/RoleInterface.php | 41 + ide/2.0.8/Phalcon/acl/adapter/Memory.php | 267 ++++ ide/2.0.8/Phalcon/annotations/Adapter.php | 74 + .../Phalcon/annotations/AdapterInterface.php | 68 + ide/2.0.8/Phalcon/annotations/Annotation.php | 108 ++ ide/2.0.8/Phalcon/annotations/Collection.php | 104 ++ ide/2.0.8/Phalcon/annotations/Exception.php | 9 + ide/2.0.8/Phalcon/annotations/Reader.php | 30 + .../Phalcon/annotations/ReaderInterface.php | 30 + ide/2.0.8/Phalcon/annotations/Reflection.php | 78 ++ ide/2.0.8/Phalcon/annotations/adapter/Apc.php | 44 + .../Phalcon/annotations/adapter/Files.php | 43 + .../Phalcon/annotations/adapter/Memory.php | 35 + .../Phalcon/annotations/adapter/Xcache.php | 31 + ide/2.0.8/Phalcon/assets/Collection.php | 268 ++++ ide/2.0.8/Phalcon/assets/Exception.php | 12 + ide/2.0.8/Phalcon/assets/FilterInterface.php | 20 + ide/2.0.8/Phalcon/assets/Inline.php | 73 + ide/2.0.8/Phalcon/assets/Manager.php | 242 ++++ ide/2.0.8/Phalcon/assets/Resource.php | 170 +++ ide/2.0.8/Phalcon/assets/filters/Cssmin.php | 22 + ide/2.0.8/Phalcon/assets/filters/Jsmin.php | 22 + ide/2.0.8/Phalcon/assets/filters/None.php | 20 + ide/2.0.8/Phalcon/assets/inline/Css.php | 21 + ide/2.0.8/Phalcon/assets/inline/Js.php | 21 + ide/2.0.8/Phalcon/assets/resource/Css.php | 22 + ide/2.0.8/Phalcon/assets/resource/Js.php | 22 + ide/2.0.8/Phalcon/cache/Backend.php | 102 ++ ide/2.0.8/Phalcon/cache/BackendInterface.php | 114 ++ ide/2.0.8/Phalcon/cache/Exception.php | 12 + ide/2.0.8/Phalcon/cache/FrontendInterface.php | 57 + ide/2.0.8/Phalcon/cache/Multiple.php | 116 ++ ide/2.0.8/Phalcon/cache/backend/Apc.php | 95 ++ ide/2.0.8/Phalcon/cache/backend/File.php | 135 ++ .../Phalcon/cache/backend/Libmemcached.php | 123 ++ ide/2.0.8/Phalcon/cache/backend/Memcache.php | 117 ++ ide/2.0.8/Phalcon/cache/backend/Memory.php | 109 ++ ide/2.0.8/Phalcon/cache/backend/Mongo.php | 124 ++ ide/2.0.8/Phalcon/cache/backend/Redis.php | 118 ++ ide/2.0.8/Phalcon/cache/backend/Xcache.php | 102 ++ ide/2.0.8/Phalcon/cache/frontend/Base64.php | 92 ++ ide/2.0.8/Phalcon/cache/frontend/Data.php | 94 ++ ide/2.0.8/Phalcon/cache/frontend/Igbinary.php | 92 ++ ide/2.0.8/Phalcon/cache/frontend/Json.php | 89 ++ ide/2.0.8/Phalcon/cache/frontend/None.php | 83 ++ ide/2.0.8/Phalcon/cache/frontend/Output.php | 105 ++ ide/2.0.8/Phalcon/cli/Console.php | 123 ++ ide/2.0.8/Phalcon/cli/Dispatcher.php | 111 ++ ide/2.0.8/Phalcon/cli/Router.php | 211 +++ ide/2.0.8/Phalcon/cli/Task.php | 31 + ide/2.0.8/Phalcon/cli/console/Exception.php | 12 + .../Phalcon/cli/dispatcher/Exception.php | 12 + ide/2.0.8/Phalcon/cli/router/Exception.php | 12 + ide/2.0.8/Phalcon/cli/router/Route.php | 184 +++ ide/2.0.8/Phalcon/config/Exception.php | 12 + ide/2.0.8/Phalcon/config/adapter/Ini.php | 58 + ide/2.0.8/Phalcon/config/adapter/Json.php | 29 + ide/2.0.8/Phalcon/config/adapter/Php.php | 42 + ide/2.0.8/Phalcon/config/adapter/Yaml.php | 41 + ide/2.0.8/Phalcon/crypt/Exception.php | 12 + ide/2.0.8/Phalcon/db/Adapter.php | 715 ++++++++++ ide/2.0.8/Phalcon/db/AdapterInterface.php | 559 ++++++++ ide/2.0.8/Phalcon/db/Column.php | 388 ++++++ ide/2.0.8/Phalcon/db/ColumnInterface.php | 147 ++ ide/2.0.8/Phalcon/db/Dialect.php | 379 ++++++ ide/2.0.8/Phalcon/db/DialectInterface.php | 290 ++++ ide/2.0.8/Phalcon/db/Exception.php | 12 + ide/2.0.8/Phalcon/db/Index.php | 73 + ide/2.0.8/Phalcon/db/IndexInterface.php | 50 + ide/2.0.8/Phalcon/db/Profiler.php | 104 ++ ide/2.0.8/Phalcon/db/RawValue.php | 47 + ide/2.0.8/Phalcon/db/Reference.php | 132 ++ ide/2.0.8/Phalcon/db/ReferenceInterface.php | 84 ++ ide/2.0.8/Phalcon/db/ResultInterface.php | 84 ++ ide/2.0.8/Phalcon/db/adapter/Pdo.php | 245 ++++ ide/2.0.8/Phalcon/db/adapter/pdo/Mysql.php | 48 + ide/2.0.8/Phalcon/db/adapter/pdo/Oracle.php | 84 ++ .../Phalcon/db/adapter/pdo/Postgresql.php | 99 ++ ide/2.0.8/Phalcon/db/adapter/pdo/Sqlite.php | 92 ++ ide/2.0.8/Phalcon/db/dialect/MySQL.php | 241 ++++ ide/2.0.8/Phalcon/db/dialect/Oracle.php | 268 ++++ ide/2.0.8/Phalcon/db/dialect/Postgresql.php | 239 ++++ ide/2.0.8/Phalcon/db/dialect/Sqlite.php | 241 ++++ ide/2.0.8/Phalcon/db/profiler/Item.php | 124 ++ ide/2.0.8/Phalcon/db/result/Pdo.php | 163 +++ ide/2.0.8/Phalcon/debug/Dump.php | 134 ++ ide/2.0.8/Phalcon/debug/Exception.php | 12 + ide/2.0.8/Phalcon/di/Exception.php | 12 + ide/2.0.8/Phalcon/di/FactoryDefault.php | 19 + ide/2.0.8/Phalcon/di/Injectable.php | 87 ++ .../Phalcon/di/InjectionAwareInterface.php | 26 + ide/2.0.8/Phalcon/di/Service.php | 123 ++ ide/2.0.8/Phalcon/di/ServiceInterface.php | 82 ++ ide/2.0.8/Phalcon/di/factorydefault/Cli.php | 20 + ide/2.0.8/Phalcon/di/service/Builder.php | 41 + ide/2.0.8/Phalcon/escaper/Exception.php | 12 + ide/2.0.8/Phalcon/events/Event.php | 111 ++ .../Phalcon/events/EventsAwareInterface.php | 26 + ide/2.0.8/Phalcon/events/Exception.php | 12 + ide/2.0.8/Phalcon/events/Manager.php | 133 ++ ide/2.0.8/Phalcon/events/ManagerInterface.php | 55 + ide/2.0.8/Phalcon/filter/Exception.php | 12 + .../Phalcon/filter/UserFilterInterface.php | 19 + ide/2.0.8/Phalcon/flash/Direct.php | 28 + ide/2.0.8/Phalcon/flash/Exception.php | 12 + ide/2.0.8/Phalcon/flash/Session.php | 82 ++ ide/2.0.8/Phalcon/forms/Element.php | 292 ++++ ide/2.0.8/Phalcon/forms/ElementInterface.php | 258 ++++ ide/2.0.8/Phalcon/forms/Exception.php | 12 + ide/2.0.8/Phalcon/forms/Form.php | 284 ++++ ide/2.0.8/Phalcon/forms/Manager.php | 48 + ide/2.0.8/Phalcon/forms/element/Check.php | 20 + ide/2.0.8/Phalcon/forms/element/Date.php | 20 + ide/2.0.8/Phalcon/forms/element/Email.php | 20 + ide/2.0.8/Phalcon/forms/element/File.php | 20 + ide/2.0.8/Phalcon/forms/element/Hidden.php | 20 + ide/2.0.8/Phalcon/forms/element/Numeric.php | 21 + ide/2.0.8/Phalcon/forms/element/Password.php | 21 + ide/2.0.8/Phalcon/forms/element/Radio.php | 20 + ide/2.0.8/Phalcon/forms/element/Select.php | 55 + ide/2.0.8/Phalcon/forms/element/Submit.php | 20 + ide/2.0.8/Phalcon/forms/element/Text.php | 20 + ide/2.0.8/Phalcon/forms/element/TextArea.php | 20 + ide/2.0.8/Phalcon/http/Cookie.php | 217 +++ ide/2.0.8/Phalcon/http/CookieInterface.php | 138 ++ ide/2.0.8/Phalcon/http/Request.php | 488 +++++++ ide/2.0.8/Phalcon/http/RequestInterface.php | 306 +++++ ide/2.0.8/Phalcon/http/Response.php | 298 ++++ ide/2.0.8/Phalcon/http/ResponseInterface.php | 150 ++ ide/2.0.8/Phalcon/http/cookie/Exception.php | 12 + ide/2.0.8/Phalcon/http/request/Exception.php | 12 + ide/2.0.8/Phalcon/http/request/File.php | 131 ++ .../Phalcon/http/request/FileInterface.php | 64 + ide/2.0.8/Phalcon/http/response/Cookies.php | 109 ++ .../http/response/CookiesInterface.php | 80 ++ ide/2.0.8/Phalcon/http/response/Exception.php | 12 + ide/2.0.8/Phalcon/http/response/Headers.php | 72 + .../http/response/HeadersInterface.php | 55 + ide/2.0.8/Phalcon/image/Adapter.php | 234 ++++ ide/2.0.8/Phalcon/image/AdapterInterface.php | 98 ++ ide/2.0.8/Phalcon/image/Exception.php | 9 + ide/2.0.8/Phalcon/image/adapter/Gd.php | 125 ++ ide/2.0.8/Phalcon/image/adapter/Imagick.php | 199 +++ ide/2.0.8/Phalcon/loader/Exception.php | 12 + ide/2.0.8/Phalcon/logger/Adapter.php | 173 +++ ide/2.0.8/Phalcon/logger/AdapterInterface.php | 143 ++ ide/2.0.8/Phalcon/logger/Exception.php | 12 + ide/2.0.8/Phalcon/logger/Formatter.php | 31 + .../Phalcon/logger/FormatterInterface.php | 24 + ide/2.0.8/Phalcon/logger/Item.php | 74 + ide/2.0.8/Phalcon/logger/Multiple.php | 111 ++ ide/2.0.8/Phalcon/logger/adapter/File.php | 78 ++ ide/2.0.8/Phalcon/logger/adapter/Firephp.php | 52 + ide/2.0.8/Phalcon/logger/adapter/Stream.php | 57 + ide/2.0.8/Phalcon/logger/adapter/Syslog.php | 57 + .../Phalcon/logger/formatter/Firephp.php | 71 + ide/2.0.8/Phalcon/logger/formatter/Json.php | 24 + ide/2.0.8/Phalcon/logger/formatter/Line.php | 74 + ide/2.0.8/Phalcon/logger/formatter/Syslog.php | 24 + ide/2.0.8/Phalcon/mvc/Application.php | 127 ++ ide/2.0.8/Phalcon/mvc/Collection.php | 509 +++++++ ide/2.0.8/Phalcon/mvc/CollectionInterface.php | 148 ++ ide/2.0.8/Phalcon/mvc/Controller.php | 38 + ide/2.0.8/Phalcon/mvc/ControllerInterface.php | 12 + ide/2.0.8/Phalcon/mvc/Dispatcher.php | 110 ++ ide/2.0.8/Phalcon/mvc/DispatcherInterface.php | 54 + ide/2.0.8/Phalcon/mvc/EntityInterface.php | 28 + ide/2.0.8/Phalcon/mvc/Micro.php | 311 +++++ ide/2.0.8/Phalcon/mvc/Model.php | 1204 +++++++++++++++++ ide/2.0.8/Phalcon/mvc/ModelInterface.php | 323 +++++ .../Phalcon/mvc/ModuleDefinitionInterface.php | 26 + ide/2.0.8/Phalcon/mvc/Router.php | 418 ++++++ ide/2.0.8/Phalcon/mvc/RouterInterface.php | 212 +++ ide/2.0.8/Phalcon/mvc/Url.php | 141 ++ ide/2.0.8/Phalcon/mvc/UrlInterface.php | 59 + ide/2.0.8/Phalcon/mvc/View.php | 641 +++++++++ ide/2.0.8/Phalcon/mvc/ViewBaseInterface.php | 86 ++ ide/2.0.8/Phalcon/mvc/ViewInterface.php | 196 +++ .../Phalcon/mvc/application/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/collection/Behavior.php | 55 + .../mvc/collection/BehaviorInterface.php | 36 + ide/2.0.8/Phalcon/mvc/collection/Document.php | 72 + .../Phalcon/mvc/collection/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/collection/Manager.php | 174 +++ .../mvc/collection/ManagerInterface.php | 108 ++ .../mvc/collection/behavior/SoftDelete.php | 21 + .../mvc/collection/behavior/Timestampable.php | 21 + .../Phalcon/mvc/dispatcher/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/micro/Collection.php | 174 +++ .../Phalcon/mvc/micro/CollectionInterface.php | 145 ++ ide/2.0.8/Phalcon/mvc/micro/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/micro/LazyLoader.php | 34 + .../Phalcon/mvc/micro/MiddlewareInterface.php | 19 + ide/2.0.8/Phalcon/mvc/model/Behavior.php | 55 + .../Phalcon/mvc/model/BehaviorInterface.php | 36 + ide/2.0.8/Phalcon/mvc/model/Criteria.php | 403 ++++++ .../Phalcon/mvc/model/CriteriaInterface.php | 209 +++ ide/2.0.8/Phalcon/mvc/model/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/model/Manager.php | 676 +++++++++ .../Phalcon/mvc/model/ManagerInterface.php | 366 +++++ ide/2.0.8/Phalcon/mvc/model/Message.php | 123 ++ .../Phalcon/mvc/model/MessageInterface.php | 78 ++ ide/2.0.8/Phalcon/mvc/model/MetaData.php | 389 ++++++ .../Phalcon/mvc/model/MetaDataInterface.php | 241 ++++ ide/2.0.8/Phalcon/mvc/model/Query.php | 469 +++++++ .../Phalcon/mvc/model/QueryInterface.php | 59 + ide/2.0.8/Phalcon/mvc/model/Relation.php | 179 +++ .../Phalcon/mvc/model/RelationInterface.php | 116 ++ .../Phalcon/mvc/model/ResultInterface.php | 19 + ide/2.0.8/Phalcon/mvc/model/Resultset.php | 253 ++++ .../Phalcon/mvc/model/ResultsetInterface.php | 62 + ide/2.0.8/Phalcon/mvc/model/Row.php | 82 ++ ide/2.0.8/Phalcon/mvc/model/Transaction.php | 146 ++ .../mvc/model/TransactionInterface.php | 91 ++ .../Phalcon/mvc/model/ValidationFailed.php | 41 + ide/2.0.8/Phalcon/mvc/model/Validator.php | 65 + .../Phalcon/mvc/model/ValidatorInterface.php | 27 + .../Phalcon/mvc/model/behavior/SoftDelete.php | 21 + .../mvc/model/behavior/Timestampable.php | 21 + ide/2.0.8/Phalcon/mvc/model/metadata/Apc.php | 49 + .../Phalcon/mvc/model/metadata/Files.php | 43 + .../mvc/model/metadata/Libmemcached.php | 60 + .../Phalcon/mvc/model/metadata/Memcache.php | 56 + .../Phalcon/mvc/model/metadata/Memory.php | 35 + .../Phalcon/mvc/model/metadata/Redis.php | 56 + .../Phalcon/mvc/model/metadata/Session.php | 45 + .../mvc/model/metadata/StrategyInterface.php | 28 + .../Phalcon/mvc/model/metadata/Xcache.php | 49 + .../model/metadata/strategy/Annotations.php | 27 + .../model/metadata/strategy/Introspection.php | 30 + ide/2.0.8/Phalcon/mvc/model/query/Builder.php | 472 +++++++ .../mvc/model/query/BuilderInterface.php | 249 ++++ ide/2.0.8/Phalcon/mvc/model/query/Lang.php | 30 + ide/2.0.8/Phalcon/mvc/model/query/Status.php | 63 + .../mvc/model/query/StatusInterface.php | 41 + .../Phalcon/mvc/model/resultset/Complex.php | 59 + .../Phalcon/mvc/model/resultset/Simple.php | 64 + .../mvc/model/transaction/Exception.php | 12 + .../Phalcon/mvc/model/transaction/Failed.php | 37 + .../Phalcon/mvc/model/transaction/Manager.php | 176 +++ .../model/transaction/ManagerInterface.php | 71 + .../Phalcon/mvc/model/validator/Email.php | 35 + .../mvc/model/validator/Exclusionin.php | 36 + .../mvc/model/validator/Inclusionin.php | 36 + ide/2.0.8/Phalcon/mvc/model/validator/Ip.php | 59 + .../mvc/model/validator/Numericality.php | 35 + .../mvc/model/validator/PresenceOf.php | 36 + .../Phalcon/mvc/model/validator/Regex.php | 36 + .../mvc/model/validator/StringLength.php | 39 + .../mvc/model/validator/Uniqueness.php | 38 + ide/2.0.8/Phalcon/mvc/model/validator/Url.php | 35 + ide/2.0.8/Phalcon/mvc/router/Annotations.php | 105 ++ ide/2.0.8/Phalcon/mvc/router/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/router/Group.php | 219 +++ .../Phalcon/mvc/router/GroupInterface.php | 186 +++ ide/2.0.8/Phalcon/mvc/router/Route.php | 243 ++++ .../Phalcon/mvc/router/RouteInterface.php | 113 ++ ide/2.0.8/Phalcon/mvc/url/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/user/Component.php | 13 + ide/2.0.8/Phalcon/mvc/user/Module.php | 13 + ide/2.0.8/Phalcon/mvc/user/Plugin.php | 13 + ide/2.0.8/Phalcon/mvc/view/Engine.php | 47 + .../Phalcon/mvc/view/EngineInterface.php | 37 + ide/2.0.8/Phalcon/mvc/view/Exception.php | 12 + ide/2.0.8/Phalcon/mvc/view/Simple.php | 264 ++++ ide/2.0.8/Phalcon/mvc/view/engine/Php.php | 21 + ide/2.0.8/Phalcon/mvc/view/engine/Volt.php | 103 ++ .../Phalcon/mvc/view/engine/volt/Compiler.php | 446 ++++++ .../mvc/view/engine/volt/Exception.php | 12 + ide/2.0.8/Phalcon/paginator/Adapter.php | 44 + .../Phalcon/paginator/AdapterInterface.php | 47 + ide/2.0.8/Phalcon/paginator/Exception.php | 12 + ide/2.0.8/Phalcon/paginator/adapter/Model.php | 41 + .../Phalcon/paginator/adapter/NativeArray.php | 46 + .../paginator/adapter/QueryBuilder.php | 69 + ide/2.0.8/Phalcon/queue/Beanstalk.php | 142 ++ ide/2.0.8/Phalcon/queue/beanstalk/Job.php | 95 ++ ide/2.0.8/Phalcon/security/Exception.php | 12 + ide/2.0.8/Phalcon/security/Random.php | 174 +++ ide/2.0.8/Phalcon/session/Adapter.php | 219 +++ .../Phalcon/session/AdapterInterface.php | 106 ++ ide/2.0.8/Phalcon/session/Bag.php | 192 +++ ide/2.0.8/Phalcon/session/BagInterface.php | 71 + ide/2.0.8/Phalcon/session/Exception.php | 12 + ide/2.0.8/Phalcon/session/adapter/Files.php | 20 + .../Phalcon/session/adapter/Libmemcached.php | 88 ++ .../Phalcon/session/adapter/Memcache.php | 79 ++ ide/2.0.8/Phalcon/session/adapter/Redis.php | 80 ++ ide/2.0.8/Phalcon/tag/Exception.php | 12 + ide/2.0.8/Phalcon/tag/Select.php | 39 + ide/2.0.8/Phalcon/translate/Adapter.php | 86 ++ .../Phalcon/translate/AdapterInterface.php | 44 + ide/2.0.8/Phalcon/translate/Exception.php | 12 + .../translate/InterpolatorInterface.php | 21 + ide/2.0.8/Phalcon/translate/adapter/Csv.php | 49 + .../Phalcon/translate/adapter/Gettext.php | 154 +++ .../Phalcon/translate/adapter/NativeArray.php | 39 + .../interpolator/AssociativeArray.php | 18 + .../translate/interpolator/IndexedArray.php | 18 + ide/2.0.8/Phalcon/validation/Exception.php | 12 + ide/2.0.8/Phalcon/validation/Message.php | 109 ++ .../Phalcon/validation/MessageInterface.php | 81 ++ ide/2.0.8/Phalcon/validation/Validator.php | 67 + .../Phalcon/validation/ValidatorInterface.php | 49 + .../Phalcon/validation/message/Group.php | 142 ++ .../Phalcon/validation/validator/Alnum.php | 27 + .../Phalcon/validation/validator/Alpha.php | 27 + .../Phalcon/validation/validator/Between.php | 30 + .../validation/validator/Confirmation.php | 37 + .../validation/validator/CreditCard.php | 35 + .../Phalcon/validation/validator/Digit.php | 27 + .../Phalcon/validation/validator/Email.php | 27 + .../validation/validator/ExclusionIn.php | 28 + .../Phalcon/validation/validator/File.php | 32 + .../validation/validator/Identical.php | 28 + .../validation/validator/InclusionIn.php | 28 + .../validation/validator/Numericality.php | 27 + .../validation/validator/PresenceOf.php | 27 + .../Phalcon/validation/validator/Regex.php | 28 + .../validation/validator/StringLength.php | 32 + .../validation/validator/Uniqueness.php | 35 + .../Phalcon/validation/validator/Url.php | 27 + 357 files changed, 36762 insertions(+) create mode 100644 ide/2.0.8/Phalcon/Acl.php create mode 100644 ide/2.0.8/Phalcon/Config.php create mode 100644 ide/2.0.8/Phalcon/Crypt.php create mode 100644 ide/2.0.8/Phalcon/CryptInterface.php create mode 100644 ide/2.0.8/Phalcon/Db.php create mode 100644 ide/2.0.8/Phalcon/Debug.php create mode 100644 ide/2.0.8/Phalcon/Di.php create mode 100644 ide/2.0.8/Phalcon/DiInterface.php create mode 100644 ide/2.0.8/Phalcon/Dispatcher.php create mode 100644 ide/2.0.8/Phalcon/DispatcherInterface.php create mode 100644 ide/2.0.8/Phalcon/Escaper.php create mode 100644 ide/2.0.8/Phalcon/EscaperInterface.php create mode 100644 ide/2.0.8/Phalcon/Exception.php create mode 100644 ide/2.0.8/Phalcon/Filter.php create mode 100644 ide/2.0.8/Phalcon/FilterInterface.php create mode 100644 ide/2.0.8/Phalcon/Flash.php create mode 100644 ide/2.0.8/Phalcon/FlashInterface.php create mode 100644 ide/2.0.8/Phalcon/Image.php create mode 100644 ide/2.0.8/Phalcon/Kernel.php create mode 100644 ide/2.0.8/Phalcon/Loader.php create mode 100644 ide/2.0.8/Phalcon/Logger.php create mode 100644 ide/2.0.8/Phalcon/Registry.php create mode 100644 ide/2.0.8/Phalcon/Security.php create mode 100644 ide/2.0.8/Phalcon/Session.php create mode 100644 ide/2.0.8/Phalcon/Tag.php create mode 100644 ide/2.0.8/Phalcon/Text.php create mode 100644 ide/2.0.8/Phalcon/Translate.php create mode 100644 ide/2.0.8/Phalcon/Validation.php create mode 100644 ide/2.0.8/Phalcon/Version.php create mode 100644 ide/2.0.8/Phalcon/acl/Adapter.php create mode 100644 ide/2.0.8/Phalcon/acl/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/acl/Exception.php create mode 100644 ide/2.0.8/Phalcon/acl/Resource.php create mode 100644 ide/2.0.8/Phalcon/acl/ResourceInterface.php create mode 100644 ide/2.0.8/Phalcon/acl/Role.php create mode 100644 ide/2.0.8/Phalcon/acl/RoleInterface.php create mode 100644 ide/2.0.8/Phalcon/acl/adapter/Memory.php create mode 100644 ide/2.0.8/Phalcon/annotations/Adapter.php create mode 100644 ide/2.0.8/Phalcon/annotations/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/annotations/Annotation.php create mode 100644 ide/2.0.8/Phalcon/annotations/Collection.php create mode 100644 ide/2.0.8/Phalcon/annotations/Exception.php create mode 100644 ide/2.0.8/Phalcon/annotations/Reader.php create mode 100644 ide/2.0.8/Phalcon/annotations/ReaderInterface.php create mode 100644 ide/2.0.8/Phalcon/annotations/Reflection.php create mode 100644 ide/2.0.8/Phalcon/annotations/adapter/Apc.php create mode 100644 ide/2.0.8/Phalcon/annotations/adapter/Files.php create mode 100644 ide/2.0.8/Phalcon/annotations/adapter/Memory.php create mode 100644 ide/2.0.8/Phalcon/annotations/adapter/Xcache.php create mode 100644 ide/2.0.8/Phalcon/assets/Collection.php create mode 100644 ide/2.0.8/Phalcon/assets/Exception.php create mode 100644 ide/2.0.8/Phalcon/assets/FilterInterface.php create mode 100644 ide/2.0.8/Phalcon/assets/Inline.php create mode 100644 ide/2.0.8/Phalcon/assets/Manager.php create mode 100644 ide/2.0.8/Phalcon/assets/Resource.php create mode 100644 ide/2.0.8/Phalcon/assets/filters/Cssmin.php create mode 100644 ide/2.0.8/Phalcon/assets/filters/Jsmin.php create mode 100644 ide/2.0.8/Phalcon/assets/filters/None.php create mode 100644 ide/2.0.8/Phalcon/assets/inline/Css.php create mode 100644 ide/2.0.8/Phalcon/assets/inline/Js.php create mode 100644 ide/2.0.8/Phalcon/assets/resource/Css.php create mode 100644 ide/2.0.8/Phalcon/assets/resource/Js.php create mode 100644 ide/2.0.8/Phalcon/cache/Backend.php create mode 100644 ide/2.0.8/Phalcon/cache/BackendInterface.php create mode 100644 ide/2.0.8/Phalcon/cache/Exception.php create mode 100644 ide/2.0.8/Phalcon/cache/FrontendInterface.php create mode 100644 ide/2.0.8/Phalcon/cache/Multiple.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Apc.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/File.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Libmemcached.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Memcache.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Memory.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Mongo.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Redis.php create mode 100644 ide/2.0.8/Phalcon/cache/backend/Xcache.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/Base64.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/Data.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/Igbinary.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/Json.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/None.php create mode 100644 ide/2.0.8/Phalcon/cache/frontend/Output.php create mode 100644 ide/2.0.8/Phalcon/cli/Console.php create mode 100644 ide/2.0.8/Phalcon/cli/Dispatcher.php create mode 100644 ide/2.0.8/Phalcon/cli/Router.php create mode 100644 ide/2.0.8/Phalcon/cli/Task.php create mode 100644 ide/2.0.8/Phalcon/cli/console/Exception.php create mode 100644 ide/2.0.8/Phalcon/cli/dispatcher/Exception.php create mode 100644 ide/2.0.8/Phalcon/cli/router/Exception.php create mode 100644 ide/2.0.8/Phalcon/cli/router/Route.php create mode 100644 ide/2.0.8/Phalcon/config/Exception.php create mode 100644 ide/2.0.8/Phalcon/config/adapter/Ini.php create mode 100644 ide/2.0.8/Phalcon/config/adapter/Json.php create mode 100644 ide/2.0.8/Phalcon/config/adapter/Php.php create mode 100644 ide/2.0.8/Phalcon/config/adapter/Yaml.php create mode 100644 ide/2.0.8/Phalcon/crypt/Exception.php create mode 100644 ide/2.0.8/Phalcon/db/Adapter.php create mode 100644 ide/2.0.8/Phalcon/db/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/db/Column.php create mode 100644 ide/2.0.8/Phalcon/db/ColumnInterface.php create mode 100644 ide/2.0.8/Phalcon/db/Dialect.php create mode 100644 ide/2.0.8/Phalcon/db/DialectInterface.php create mode 100644 ide/2.0.8/Phalcon/db/Exception.php create mode 100644 ide/2.0.8/Phalcon/db/Index.php create mode 100644 ide/2.0.8/Phalcon/db/IndexInterface.php create mode 100644 ide/2.0.8/Phalcon/db/Profiler.php create mode 100644 ide/2.0.8/Phalcon/db/RawValue.php create mode 100644 ide/2.0.8/Phalcon/db/Reference.php create mode 100644 ide/2.0.8/Phalcon/db/ReferenceInterface.php create mode 100644 ide/2.0.8/Phalcon/db/ResultInterface.php create mode 100644 ide/2.0.8/Phalcon/db/adapter/Pdo.php create mode 100644 ide/2.0.8/Phalcon/db/adapter/pdo/Mysql.php create mode 100644 ide/2.0.8/Phalcon/db/adapter/pdo/Oracle.php create mode 100644 ide/2.0.8/Phalcon/db/adapter/pdo/Postgresql.php create mode 100644 ide/2.0.8/Phalcon/db/adapter/pdo/Sqlite.php create mode 100644 ide/2.0.8/Phalcon/db/dialect/MySQL.php create mode 100644 ide/2.0.8/Phalcon/db/dialect/Oracle.php create mode 100644 ide/2.0.8/Phalcon/db/dialect/Postgresql.php create mode 100644 ide/2.0.8/Phalcon/db/dialect/Sqlite.php create mode 100644 ide/2.0.8/Phalcon/db/profiler/Item.php create mode 100644 ide/2.0.8/Phalcon/db/result/Pdo.php create mode 100644 ide/2.0.8/Phalcon/debug/Dump.php create mode 100644 ide/2.0.8/Phalcon/debug/Exception.php create mode 100644 ide/2.0.8/Phalcon/di/Exception.php create mode 100644 ide/2.0.8/Phalcon/di/FactoryDefault.php create mode 100644 ide/2.0.8/Phalcon/di/Injectable.php create mode 100644 ide/2.0.8/Phalcon/di/InjectionAwareInterface.php create mode 100644 ide/2.0.8/Phalcon/di/Service.php create mode 100644 ide/2.0.8/Phalcon/di/ServiceInterface.php create mode 100644 ide/2.0.8/Phalcon/di/factorydefault/Cli.php create mode 100644 ide/2.0.8/Phalcon/di/service/Builder.php create mode 100644 ide/2.0.8/Phalcon/escaper/Exception.php create mode 100644 ide/2.0.8/Phalcon/events/Event.php create mode 100644 ide/2.0.8/Phalcon/events/EventsAwareInterface.php create mode 100644 ide/2.0.8/Phalcon/events/Exception.php create mode 100644 ide/2.0.8/Phalcon/events/Manager.php create mode 100644 ide/2.0.8/Phalcon/events/ManagerInterface.php create mode 100644 ide/2.0.8/Phalcon/filter/Exception.php create mode 100644 ide/2.0.8/Phalcon/filter/UserFilterInterface.php create mode 100644 ide/2.0.8/Phalcon/flash/Direct.php create mode 100644 ide/2.0.8/Phalcon/flash/Exception.php create mode 100644 ide/2.0.8/Phalcon/flash/Session.php create mode 100644 ide/2.0.8/Phalcon/forms/Element.php create mode 100644 ide/2.0.8/Phalcon/forms/ElementInterface.php create mode 100644 ide/2.0.8/Phalcon/forms/Exception.php create mode 100644 ide/2.0.8/Phalcon/forms/Form.php create mode 100644 ide/2.0.8/Phalcon/forms/Manager.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Check.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Date.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Email.php create mode 100644 ide/2.0.8/Phalcon/forms/element/File.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Hidden.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Numeric.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Password.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Radio.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Select.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Submit.php create mode 100644 ide/2.0.8/Phalcon/forms/element/Text.php create mode 100644 ide/2.0.8/Phalcon/forms/element/TextArea.php create mode 100644 ide/2.0.8/Phalcon/http/Cookie.php create mode 100644 ide/2.0.8/Phalcon/http/CookieInterface.php create mode 100644 ide/2.0.8/Phalcon/http/Request.php create mode 100644 ide/2.0.8/Phalcon/http/RequestInterface.php create mode 100644 ide/2.0.8/Phalcon/http/Response.php create mode 100644 ide/2.0.8/Phalcon/http/ResponseInterface.php create mode 100644 ide/2.0.8/Phalcon/http/cookie/Exception.php create mode 100644 ide/2.0.8/Phalcon/http/request/Exception.php create mode 100644 ide/2.0.8/Phalcon/http/request/File.php create mode 100644 ide/2.0.8/Phalcon/http/request/FileInterface.php create mode 100644 ide/2.0.8/Phalcon/http/response/Cookies.php create mode 100644 ide/2.0.8/Phalcon/http/response/CookiesInterface.php create mode 100644 ide/2.0.8/Phalcon/http/response/Exception.php create mode 100644 ide/2.0.8/Phalcon/http/response/Headers.php create mode 100644 ide/2.0.8/Phalcon/http/response/HeadersInterface.php create mode 100644 ide/2.0.8/Phalcon/image/Adapter.php create mode 100644 ide/2.0.8/Phalcon/image/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/image/Exception.php create mode 100644 ide/2.0.8/Phalcon/image/adapter/Gd.php create mode 100644 ide/2.0.8/Phalcon/image/adapter/Imagick.php create mode 100644 ide/2.0.8/Phalcon/loader/Exception.php create mode 100644 ide/2.0.8/Phalcon/logger/Adapter.php create mode 100644 ide/2.0.8/Phalcon/logger/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/logger/Exception.php create mode 100644 ide/2.0.8/Phalcon/logger/Formatter.php create mode 100644 ide/2.0.8/Phalcon/logger/FormatterInterface.php create mode 100644 ide/2.0.8/Phalcon/logger/Item.php create mode 100644 ide/2.0.8/Phalcon/logger/Multiple.php create mode 100644 ide/2.0.8/Phalcon/logger/adapter/File.php create mode 100644 ide/2.0.8/Phalcon/logger/adapter/Firephp.php create mode 100644 ide/2.0.8/Phalcon/logger/adapter/Stream.php create mode 100644 ide/2.0.8/Phalcon/logger/adapter/Syslog.php create mode 100644 ide/2.0.8/Phalcon/logger/formatter/Firephp.php create mode 100644 ide/2.0.8/Phalcon/logger/formatter/Json.php create mode 100644 ide/2.0.8/Phalcon/logger/formatter/Line.php create mode 100644 ide/2.0.8/Phalcon/logger/formatter/Syslog.php create mode 100644 ide/2.0.8/Phalcon/mvc/Application.php create mode 100644 ide/2.0.8/Phalcon/mvc/Collection.php create mode 100644 ide/2.0.8/Phalcon/mvc/CollectionInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/Controller.php create mode 100644 ide/2.0.8/Phalcon/mvc/ControllerInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/Dispatcher.php create mode 100644 ide/2.0.8/Phalcon/mvc/DispatcherInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/EntityInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/Micro.php create mode 100644 ide/2.0.8/Phalcon/mvc/Model.php create mode 100644 ide/2.0.8/Phalcon/mvc/ModelInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/ModuleDefinitionInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/Router.php create mode 100644 ide/2.0.8/Phalcon/mvc/RouterInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/Url.php create mode 100644 ide/2.0.8/Phalcon/mvc/UrlInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/View.php create mode 100644 ide/2.0.8/Phalcon/mvc/ViewBaseInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/ViewInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/application/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/Behavior.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/BehaviorInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/Document.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/Manager.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/ManagerInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/behavior/SoftDelete.php create mode 100644 ide/2.0.8/Phalcon/mvc/collection/behavior/Timestampable.php create mode 100644 ide/2.0.8/Phalcon/mvc/dispatcher/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/micro/Collection.php create mode 100644 ide/2.0.8/Phalcon/mvc/micro/CollectionInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/micro/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/micro/LazyLoader.php create mode 100644 ide/2.0.8/Phalcon/mvc/micro/MiddlewareInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Behavior.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/BehaviorInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Criteria.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/CriteriaInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Manager.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/ManagerInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Message.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/MessageInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/MetaData.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/MetaDataInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Query.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/QueryInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Relation.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/RelationInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/ResultInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Resultset.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/ResultsetInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Row.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Transaction.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/TransactionInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/ValidationFailed.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/Validator.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/ValidatorInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/behavior/SoftDelete.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/behavior/Timestampable.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Apc.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Files.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Libmemcached.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Memcache.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Memory.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Redis.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Session.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/StrategyInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/Xcache.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/strategy/Annotations.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/metadata/strategy/Introspection.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/query/Builder.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/query/BuilderInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/query/Lang.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/query/Status.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/query/StatusInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/resultset/Complex.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/resultset/Simple.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/transaction/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/transaction/Failed.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/transaction/Manager.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/transaction/ManagerInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Email.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Exclusionin.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Inclusionin.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Ip.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Numericality.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/PresenceOf.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Regex.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/StringLength.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Uniqueness.php create mode 100644 ide/2.0.8/Phalcon/mvc/model/validator/Url.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/Annotations.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/Group.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/GroupInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/Route.php create mode 100644 ide/2.0.8/Phalcon/mvc/router/RouteInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/url/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/user/Component.php create mode 100644 ide/2.0.8/Phalcon/mvc/user/Module.php create mode 100644 ide/2.0.8/Phalcon/mvc/user/Plugin.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/Engine.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/EngineInterface.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/Exception.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/Simple.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/engine/Php.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/engine/Volt.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/engine/volt/Compiler.php create mode 100644 ide/2.0.8/Phalcon/mvc/view/engine/volt/Exception.php create mode 100644 ide/2.0.8/Phalcon/paginator/Adapter.php create mode 100644 ide/2.0.8/Phalcon/paginator/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/paginator/Exception.php create mode 100644 ide/2.0.8/Phalcon/paginator/adapter/Model.php create mode 100644 ide/2.0.8/Phalcon/paginator/adapter/NativeArray.php create mode 100644 ide/2.0.8/Phalcon/paginator/adapter/QueryBuilder.php create mode 100644 ide/2.0.8/Phalcon/queue/Beanstalk.php create mode 100644 ide/2.0.8/Phalcon/queue/beanstalk/Job.php create mode 100644 ide/2.0.8/Phalcon/security/Exception.php create mode 100644 ide/2.0.8/Phalcon/security/Random.php create mode 100644 ide/2.0.8/Phalcon/session/Adapter.php create mode 100644 ide/2.0.8/Phalcon/session/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/session/Bag.php create mode 100644 ide/2.0.8/Phalcon/session/BagInterface.php create mode 100644 ide/2.0.8/Phalcon/session/Exception.php create mode 100644 ide/2.0.8/Phalcon/session/adapter/Files.php create mode 100644 ide/2.0.8/Phalcon/session/adapter/Libmemcached.php create mode 100644 ide/2.0.8/Phalcon/session/adapter/Memcache.php create mode 100644 ide/2.0.8/Phalcon/session/adapter/Redis.php create mode 100644 ide/2.0.8/Phalcon/tag/Exception.php create mode 100644 ide/2.0.8/Phalcon/tag/Select.php create mode 100644 ide/2.0.8/Phalcon/translate/Adapter.php create mode 100644 ide/2.0.8/Phalcon/translate/AdapterInterface.php create mode 100644 ide/2.0.8/Phalcon/translate/Exception.php create mode 100644 ide/2.0.8/Phalcon/translate/InterpolatorInterface.php create mode 100644 ide/2.0.8/Phalcon/translate/adapter/Csv.php create mode 100644 ide/2.0.8/Phalcon/translate/adapter/Gettext.php create mode 100644 ide/2.0.8/Phalcon/translate/adapter/NativeArray.php create mode 100644 ide/2.0.8/Phalcon/translate/interpolator/AssociativeArray.php create mode 100644 ide/2.0.8/Phalcon/translate/interpolator/IndexedArray.php create mode 100644 ide/2.0.8/Phalcon/validation/Exception.php create mode 100644 ide/2.0.8/Phalcon/validation/Message.php create mode 100644 ide/2.0.8/Phalcon/validation/MessageInterface.php create mode 100644 ide/2.0.8/Phalcon/validation/Validator.php create mode 100644 ide/2.0.8/Phalcon/validation/ValidatorInterface.php create mode 100644 ide/2.0.8/Phalcon/validation/message/Group.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Alnum.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Alpha.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Between.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Confirmation.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/CreditCard.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Digit.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Email.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/ExclusionIn.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/File.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Identical.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/InclusionIn.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Numericality.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/PresenceOf.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Regex.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/StringLength.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Uniqueness.php create mode 100644 ide/2.0.8/Phalcon/validation/validator/Url.php diff --git a/ide/2.0.8/Phalcon/Acl.php b/ide/2.0.8/Phalcon/Acl.php new file mode 100644 index 000000000..54a8d3549 --- /dev/null +++ b/ide/2.0.8/Phalcon/Acl.php @@ -0,0 +1,45 @@ + + * $acl = new \Phalcon\Acl\Adapter\Memory(); + * //Default action is deny access + * $acl->setDefaultAction(\Phalcon\Acl::DENY); + * //Create some roles + * $roleAdmins = new \Phalcon\Acl\Role('Administrators', 'Super-User role'); + * $roleGuests = new \Phalcon\Acl\Role('Guests'); + * //Add "Guests" role to acl + * $acl->addRole($roleGuests); + * //Add "Designers" role to acl + * $acl->addRole('Designers'); + * //Define the "Customers" resource + * $customersResource = new \Phalcon\Acl\Resource('Customers', 'Customers management'); + * //Add "customers" resource with a couple of operations + * $acl->addResource($customersResource, 'search'); + * $acl->addResource($customersResource, array('create', 'update')); + * //Set access level for roles into resources + * $acl->allow('Guests', 'Customers', 'search'); + * $acl->allow('Guests', 'Customers', 'create'); + * $acl->deny('Guests', 'Customers', 'update'); + * //Check whether role has access to the operations + * $acl->isAllowed('Guests', 'Customers', 'edit'); //Returns 0 + * $acl->isAllowed('Guests', 'Customers', 'search'); //Returns 1 + * $acl->isAllowed('Guests', 'Customers', 'create'); //Returns 1 + * + */ +abstract class Acl +{ + + const ALLOW = 1; + + + const DENY = 0; + + +} diff --git a/ide/2.0.8/Phalcon/Config.php b/ide/2.0.8/Phalcon/Config.php new file mode 100644 index 000000000..b3112b0da --- /dev/null +++ b/ide/2.0.8/Phalcon/Config.php @@ -0,0 +1,145 @@ + + * $config = new \Phalcon\Config(array( + * "database" => array( + * "adapter" => "Mysql", + * "host" => "localhost", + * "username" => "scott", + * "password" => "cheetah", + * "dbname" => "test_db" + * ), + * "phalcon" => array( + * "controllersDir" => "../app/controllers/", + * "modelsDir" => "../app/models/", + * "viewsDir" => "../app/views/" + * ) + * )); + * + */ +class Config implements \ArrayAccess, \Countable +{ + + /** + * Phalcon\Config constructor + * + * @param array $arrayConfig + */ + public function __construct($arrayConfig = null) {} + + /** + * Allows to check whether an attribute is defined using the array-syntax + * + * var_dump(isset($config['database'])); + * + * + * @param mixed $index + * @return bool + */ + public function offsetExists($index) {} + + /** + * Gets an attribute from the configuration, if the attribute isn't defined returns null + * If the value is exactly null or is not defined the default value will be used instead + * + * echo $config->get('controllersDir', '../app/controllers/'); + * + * + * @param mixed $index + * @param mixed $defaultValue + */ + public function get($index, $defaultValue = null) {} + + /** + * Gets an attribute using the array-syntax + * + * print_r($config['database']); + * + * + * @param mixed $index + * @return string + */ + public function offsetGet($index) {} + + /** + * Sets an attribute using the array-syntax + * + * $config['database'] = array('type' => 'Sqlite'); + * + * + * @param mixed $index + * @param mixed $value + */ + public function offsetSet($index, $value) {} + + /** + * Unsets an attribute using the array-syntax + * + * unset($config['database']); + * + * + * @param mixed $index + */ + public function offsetUnset($index) {} + + /** + * Merges a configuration into the current one + * + * $appConfig = new \Phalcon\Config(array('database' => array('host' => 'localhost'))); + * $globalConfig->merge($config2); + * + * + * @param mixed $config + * @return Config + */ + public function merge(Config $config) {} + + /** + * Converts recursively the object to an array + * + * print_r($config->toArray()); + * + * + * @return array + */ + public function toArray() {} + + /** + * Returns the count of properties set in the config + * + * print count($config); + * + * or + * + * print $config->count(); + * + * + * @return int + */ + public function count() {} + + /** + * Restores the state of a Phalcon\Config object + * + * @param array $data + * @return Config + */ + public static function __set_state($data) {} + + /** + * Helper method for merge configs (forwarding nested config instance) + * + * @param Config $config + * @param Config $instance = null + * @return Config config + */ + protected final function _merge(Config $config, $instance = null) {} + +} diff --git a/ide/2.0.8/Phalcon/Crypt.php b/ide/2.0.8/Phalcon/Crypt.php new file mode 100644 index 000000000..a2c8d1c49 --- /dev/null +++ b/ide/2.0.8/Phalcon/Crypt.php @@ -0,0 +1,190 @@ + + * $crypt = new \Phalcon\Crypt(); + * $key = 'le password'; + * $text = 'This is a secret text'; + * $encrypted = $crypt->encrypt($text, $key); + * echo $crypt->decrypt($encrypted, $key); + * + */ +class Crypt implements \Phalcon\CryptInterface +{ + + const PADDING_DEFAULT = 0; + + + const PADDING_ANSI_X_923 = 1; + + + const PADDING_PKCS7 = 2; + + + const PADDING_ISO_10126 = 3; + + + const PADDING_ISO_IEC_7816_4 = 4; + + + const PADDING_ZERO = 5; + + + const PADDING_SPACE = 6; + + + protected $_key; + + + protected $_padding = 0; + + + protected $_mode = "cbc"; + + + protected $_cipher = "rijndael-256"; + + + /** + * Changes the padding scheme used + * + * @param int $scheme + * @return \Phalcon\CryptInterface + */ + public function setPadding($scheme) {} + + /** + * Sets the cipher algorithm + * + * @param string $cipher + * @return Crypt + */ + public function setCipher($cipher) {} + + /** + * Returns the current cipher + * + * @return string + */ + public function getCipher() {} + + /** + * Sets the encrypt/decrypt mode + * + * @param string $mode + * @return Crypt + */ + public function setMode($mode) {} + + /** + * Returns the current encryption mode + * + * @return string + */ + public function getMode() {} + + /** + * Sets the encryption key + * + * @param string $key + * @return Crypt + */ + public function setKey($key) {} + + /** + * Returns the encryption key + * + * @return string + */ + public function getKey() {} + + /** + * Pads texts before encryption + * + * @see http://www.di-mgt.com.au/cryptopad.html + * @param string $text + * @param string $mode + * @param int $blockSize + * @param int $paddingType + */ + protected function _cryptPadText($text, $mode, $blockSize, $paddingType) {} + + /** + * Removes padding @a padding_type from @a text + * If the function detects that the text was not padded, it will return it unmodified + * + * @param string $text + * @param string $mode + * @param int $blockSize + * @param int $paddingType + * @param return_value $Result, possibly unpadded + * @param text $Message to be unpadded + * @param mode $Encryption mode; unpadding is applied only in CBC or ECB mode + * @param block_size $Cipher block size + * @param padding_type $Padding scheme + */ + protected function _cryptUnpadText($text, $mode, $blockSize, $paddingType) {} + + /** + * Encrypts a text + * + * $encrypted = $crypt->encrypt("Ultra-secret text", "encrypt password"); + * + * + * @param string $text + * @param string $key + * @return string + */ + public function encrypt($text, $key = null) {} + + /** + * Decrypts an encrypted text + * + * echo $crypt->decrypt($encrypted, "decrypt password"); + * + * + * @param string $text + * @param mixed $key + * @return string + */ + public function decrypt($text, $key = null) {} + + /** + * Encrypts a text returning the result as a base64 string + * + * @param string $text + * @param mixed $key + * @param bool $safe + * @return string + */ + public function encryptBase64($text, $key = null, $safe = false) {} + + /** + * Decrypt a text that is coded as a base64 string + * + * @param string $text + * @param mixed $key + * @param bool $safe + * @return string + */ + public function decryptBase64($text, $key = null, $safe = false) {} + + /** + * Returns a list of available cyphers + * + * @return array + */ + public function getAvailableCiphers() {} + + /** + * Returns a list of available modes + * + * @return array + */ + public function getAvailableModes() {} + +} diff --git a/ide/2.0.8/Phalcon/CryptInterface.php b/ide/2.0.8/Phalcon/CryptInterface.php new file mode 100644 index 000000000..529103de4 --- /dev/null +++ b/ide/2.0.8/Phalcon/CryptInterface.php @@ -0,0 +1,107 @@ + + * use Phalcon\Db; + * use Phalcon\Db\Exception; + * use Phalcon\Db\Adapter\Pdo\Mysql as MysqlConnection; + * try { + * $connection = new MysqlConnection(array( + * 'host' => '192.168.0.11', + * 'username' => 'sigma', + * 'password' => 'secret', + * 'dbname' => 'blog', + * 'port' => '3306', + * )); + * $result = $connection->query("SELECTFROM robots LIMIT 5"); + * $result->setFetchMode(Db::FETCH_NUM); + * while ($robot = $result->fetch()) { + * print_r($robot); + * } + * } catch (Exception $e) { + * echo $e->getMessage(), PHP_EOL; + * } + * + */ +abstract class Db +{ + + const FETCH_LAZY = 1; + + + const FETCH_ASSOC = 2; + + + const FETCH_NAMED = 11; + + + const FETCH_NUM = 3; + + + const FETCH_BOTH = 4; + + + const FETCH_OBJ = 5; + + + const FETCH_BOUND = 6; + + + const FETCH_COLUMN = 7; + + + const FETCH_CLASS = 8; + + + const FETCH_INTO = 9; + + + const FETCH_FUNC = 10; + + + const FETCH_GROUP = 65536; + + + const FETCH_UNIQUE = 196608; + + + const FETCH_KEY_PAIR = 12; + + + const FETCH_CLASSTYPE = 262144; + + + const FETCH_SERIALIZE = 524288; + + + const FETCH_PROPS_LATE = 1048576; + + + /** + * Enables/disables options in the Database component + * + * @param array $options + */ + public static function setup($options) {} + +} diff --git a/ide/2.0.8/Phalcon/Debug.php b/ide/2.0.8/Phalcon/Debug.php new file mode 100644 index 000000000..a99a489f8 --- /dev/null +++ b/ide/2.0.8/Phalcon/Debug.php @@ -0,0 +1,192 @@ + + * $di = new \Phalcon\Di(); + * //Using a string definition + * $di->set("request", "Phalcon\Http\Request", true); + * //Using an anonymous function + * $di->set("request", function(){ + * return new \Phalcon\Http\Request(); + * }, true); + * $request = $di->getRequest(); + * + */ +class Di implements \Phalcon\DiInterface +{ + /** + * List of registered services + */ + protected $_services; + + /** + * List of shared instances + */ + protected $_sharedInstances; + + /** + * To know if the latest resolved instance was shared or not + */ + protected $_freshInstance = false; + + /** + * Events Manager + * + * @var \Phalcon\Events\ManagerInterface + */ + protected $_eventsManager; + + /** + * Latest DI build + */ + static protected $_default; + + + /** + * Phalcon\Di constructor + */ + public function __construct() {} + + /** + * Sets the internal event manager + * + * @param mixed $eventsManager + */ + public function setInternalEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the internal event manager + * + * @return \Phalcon\Events\ManagerInterface + */ + public function getInternalEventsManager() {} + + /** + * Registers a service in the services container + * + * @param string $name + * @param mixed $definition + * @param bool $shared + * @return \Phalcon\Di\ServiceInterface + */ + public function set($name, $definition, $shared = false) {} + + /** + * Registers an "always shared" service in the services container + * + * @param string $name + * @param mixed $definition + * @return \Phalcon\Di\ServiceInterface + */ + public function setShared($name, $definition) {} + + /** + * Removes a service in the services container + * It also removes any shared instance created for the service + * + * @param string $name + */ + public function remove($name) {} + + /** + * Attempts to register a service in the services container + * Only is successful if a service hasn't been registered previously + * with the same name + * + * @param string $name + * @param mixed $definition + * @param bool $shared + * @return bool|\Phalcon\Di\ServiceInterface + */ + public function attempt($name, $definition, $shared = false) {} + + /** + * Sets a service using a raw Phalcon\Di\Service definition + * + * @param string $name + * @param mixed $rawDefinition + * @return \Phalcon\Di\ServiceInterface + */ + public function setRaw($name, \Phalcon\Di\ServiceInterface $rawDefinition) {} + + /** + * Returns a service definition without resolving + * + * @param string $name + */ + public function getRaw($name) {} + + /** + * Returns a Phalcon\Di\Service instance + * + * @param string $name + * @return \Phalcon\Di\ServiceInterface + */ + public function getService($name) {} + + /** + * Resolves the service based on its configuration + * + * @returm mixed + * @param string $name + * @param mixed $parameters + */ + public function get($name, $parameters = null) {} + + /** + * Resolves a service, the resolved service is stored in the DI, subsequent requests for this service will return the same instance + * + * @param string $name + * @param array $parameters + * @return mixed + */ + public function getShared($name, $parameters = null) {} + + /** + * Check whether the DI contains a service by a name + * + * @param string $name + * @return bool + */ + public function has($name) {} + + /** + * Check whether the last service obtained via getShared produced a fresh instance or an existing one + * + * @return bool + */ + public function wasFreshInstance() {} + + /** + * Return the services registered in the DI + * + * @return \Phalcon\Di\Service + */ + public function getServices() {} + + /** + * Check if a service is registered using the array syntax + * + * @param string $name + * @return bool + */ + public function offsetExists($name) {} + + /** + * Allows to register a shared service using the array syntax + * + * $di["request"] = new \Phalcon\Http\Request(); + * + * + * @param string $name + * @param mixed $definition + * @return boolean + */ + public function offsetSet($name, $definition) {} + + /** + * Allows to obtain a shared service using the array syntax + * + * var_dump($di["request"]); + * + * + * @param string $name + * @return mixed + */ + public function offsetGet($name) {} + + /** + * Removes a service from the services container using the array syntax + * + * @param string $name + * @return bool + */ + public function offsetUnset($name) {} + + /** + * Magic method to get or set services using setters/getters + * + * @param string $method + * @param array $arguments + * @return mixed + */ + public function __call($method, $arguments = null) {} + + /** + * Set a default dependency injection container to be obtained into static methods + * + * @param mixed $dependencyInjector + */ + public static function setDefault(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Return the lastest DI created + * + * @return \Phalcon\DiInterface + */ + public static function getDefault() {} + + /** + * Resets the internal default DI + */ + public static function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/DiInterface.php b/ide/2.0.8/Phalcon/DiInterface.php new file mode 100644 index 000000000..53e5de99d --- /dev/null +++ b/ide/2.0.8/Phalcon/DiInterface.php @@ -0,0 +1,134 @@ + + * $this->dispatcher->forward(array("controller" => "posts", "action" => "index")); + * + * + * @param array $forward + */ + public function forward($forward) {} + + /** + * Check if the current executed action was forwarded by another one + * + * @return bool + */ + public function wasForwarded() {} + + /** + * Possible class name that will be located to dispatch the request + * + * @return string + */ + public function getHandlerClass() {} + + /** + * Set empty properties to their defaults (where defaults are available) + */ + protected function _resolveEmptyProperties() {} + +} diff --git a/ide/2.0.8/Phalcon/DispatcherInterface.php b/ide/2.0.8/Phalcon/DispatcherInterface.php new file mode 100644 index 000000000..1b5a292cc --- /dev/null +++ b/ide/2.0.8/Phalcon/DispatcherInterface.php @@ -0,0 +1,120 @@ + + * $escaper = new \Phalcon\Escaper(); + * $escaped = $escaper->escapeCss("font-family: "); + * echo $escaped; // font\2D family\3A \20 \3C Verdana\3E + * + */ +class Escaper implements \Phalcon\EscaperInterface +{ + + protected $_encoding = "utf-8"; + + + protected $_htmlEscapeMap = null; + + + protected $_htmlQuoteType = 3; + + + /** + * Sets the encoding to be used by the escaper + * + * $escaper->setEncoding('utf-8'); + * + * + * @param string $encoding + */ + public function setEncoding($encoding) {} + + /** + * Returns the internal encoding used by the escaper + * + * @return string + */ + public function getEncoding() {} + + /** + * Sets the HTML quoting type for htmlspecialchars + * + * $escaper->setHtmlQuoteType(ENT_XHTML); + * + * + * @param int $quoteType + */ + public function setHtmlQuoteType($quoteType) {} + + /** + * Detect the character encoding of a string to be handled by an encoder + * Special-handling for chr(172) and chr(128) to chr(159) which fail to be detected by mb_detect_encoding() + * + * @param string $str + * @return string|null + */ + public final function detectEncoding($str) {} + + /** + * Utility to normalize a string's encoding to UTF-32. + * + * @param string $str + * @return string + */ + public final function normalizeEncoding($str) {} + + /** + * Escapes a HTML string. Internally uses htmlspecialchars + * + * @param string $text + * @return string + */ + public function escapeHtml($text) {} + + /** + * Escapes a HTML attribute string + * + * @param string $attribute + * @return string + */ + public function escapeHtmlAttr($attribute) {} + + /** + * Escape CSS strings by replacing non-alphanumeric chars by their hexadecimal escaped representation + * + * @param string $css + * @return string + */ + public function escapeCss($css) {} + + /** + * Escape javascript strings by replacing non-alphanumeric chars by their hexadecimal escaped representation + * + * @param string $js + * @return string + */ + public function escapeJs($js) {} + + /** + * Escapes a URL. Internally uses rawurlencode + * + * @param string $url + * @return string + */ + public function escapeUrl($url) {} + +} diff --git a/ide/2.0.8/Phalcon/EscaperInterface.php b/ide/2.0.8/Phalcon/EscaperInterface.php new file mode 100644 index 000000000..e8718dea2 --- /dev/null +++ b/ide/2.0.8/Phalcon/EscaperInterface.php @@ -0,0 +1,73 @@ + + * $filter = new \Phalcon\Filter(); + * $filter->sanitize("some(one)@exa\\mple.com", "email"); // returns "someone@example.com" + * $filter->sanitize("hello<<", "string"); // returns "hello" + * $filter->sanitize("!100a019", "int"); // returns "100019" + * $filter->sanitize("!100a019.01a", "float"); // returns "100019.01" + * + */ +class Filter implements \Phalcon\FilterInterface +{ + + const FILTER_EMAIL = "email"; + + + const FILTER_ABSINT = "absint"; + + + const FILTER_INT = "int"; + + + const FILTER_INT_CAST = "int!"; + + + const FILTER_STRING = "string"; + + + const FILTER_FLOAT = "float"; + + + const FILTER_FLOAT_CAST = "float!"; + + + const FILTER_ALPHANUM = "alphanum"; + + + const FILTER_TRIM = "trim"; + + + const FILTER_STRIPTAGS = "striptags"; + + + const FILTER_LOWER = "lower"; + + + const FILTER_UPPER = "upper"; + + + protected $_filters; + + + /** + * Adds a user-defined filter + * + * @param string $name + * @param mixed $handler + * @return Filter + */ + public function add($name, $handler) {} + + /** + * Sanitizes a value with a specified single or set of filters + * + * @param mixed $value + * @param mixed $filters + * @param bool $noRecursive + */ + public function sanitize($value, $filters, $noRecursive = false) {} + + /** + * Internal sanitize wrapper to filter_var + * + * @param mixed $value + * @param string $filter + */ + protected function _sanitize($value, $filter) {} + + /** + * Return the user-defined filters in the instance + * + * @return array + */ + public function getFilters() {} + +} diff --git a/ide/2.0.8/Phalcon/FilterInterface.php b/ide/2.0.8/Phalcon/FilterInterface.php new file mode 100644 index 000000000..459b8b42b --- /dev/null +++ b/ide/2.0.8/Phalcon/FilterInterface.php @@ -0,0 +1,37 @@ + + * $flash->success("The record was successfully deleted"); + * $flash->error("Cannot open the file"); + * + */ +abstract class Flash +{ + + protected $_cssClasses; + + + protected $_implicitFlush = true; + + + protected $_automaticHtml = true; + + + protected $_messages; + + + /** + * Phalcon\Flash constructor + * + * @param mixed $cssClasses + */ + public function __construct($cssClasses = null) {} + + /** + * Set whether the output must be implicitly flushed to the output or returned as string + * + * @param bool $implicitFlush + * @return \Phalcon\FlashInterface + */ + public function setImplicitFlush($implicitFlush) {} + + /** + * Set if the output must be implicitly formatted with HTML + * + * @param bool $automaticHtml + * @return \Phalcon\FlashInterface + */ + public function setAutomaticHtml($automaticHtml) {} + + /** + * Set an array with CSS classes to format the messages + * + * @param array $cssClasses + * @return \Phalcon\FlashInterface + */ + public function setCssClasses($cssClasses) {} + + /** + * Shows a HTML error message + * + * $flash->error('This is an error'); + * + * + * @param mixed $message + * @return string + */ + public function error($message) {} + + /** + * Shows a HTML notice/information message + * + * $flash->notice('This is an information'); + * + * + * @param mixed $message + * @return string + */ + public function notice($message) {} + + /** + * Shows a HTML success message + * + * $flash->success('The process was finished successfully'); + * + * + * @param string $message + * @return string + */ + public function success($message) {} + + /** + * Shows a HTML warning message + * + * $flash->warning('Hey, this is important'); + * + * + * @param mixed $message + * @return string + */ + public function warning($message) {} + + /** + * Outputs a message formatting it with HTML + * + * $flash->outputMessage('error', message); + * + * + * @param string $type + * @param string|array $message + */ + public function outputMessage($type, $message) {} + + /** + * Clears accumulated messages when implicit flush is disabled + */ + public function clear() {} + +} diff --git a/ide/2.0.8/Phalcon/FlashInterface.php b/ide/2.0.8/Phalcon/FlashInterface.php new file mode 100644 index 000000000..86ca19753 --- /dev/null +++ b/ide/2.0.8/Phalcon/FlashInterface.php @@ -0,0 +1,48 @@ + + * //Creates the autoloader + * $loader = new Loader(); + * //Register some namespaces + * $loader->registerNamespaces(array( + * 'Example\Base' => 'vendor/example/base/', + * 'Example\Adapter' => 'vendor/example/adapter/', + * 'Example' => 'vendor/example/' + * )); + * //register autoloader + * $loader->register(); + * //Requiring this class will automatically include file vendor/example/adapter/Some.php + * $adapter = Example\Adapter\Some(); + * + */ +class Loader implements \Phalcon\Events\EventsAwareInterface +{ + + protected $_eventsManager = null; + + + protected $_foundPath = null; + + + protected $_checkedPath = null; + + + protected $_prefixes = null; + + + protected $_classes = null; + + + protected $_extensions; + + + protected $_namespaces = null; + + + protected $_directories = null; + + + protected $_registered = false; + + + /** + * Phalcon\Loader constructor + */ + public function __construct() {} + + /** + * Sets the events manager + * + * @param mixed $eventsManager + */ + public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the internal event manager + * + * @return \Phalcon\Events\ManagerInterface + */ + public function getEventsManager() {} + + /** + * Sets an array of file extensions that the loader must try in each attempt to locate the file + * + * @param array $extensions + * @return Loader + */ + public function setExtensions($extensions) {} + + /** + * Returns the file extensions registered in the loader + * + * @return array + */ + public function getExtensions() {} + + /** + * Register namespaces and their related directories + * + * @param array $namespaces + * @param bool $merge + * @return Loader + */ + public function registerNamespaces($namespaces, $merge = false) {} + + /** + * Returns the namespaces currently registered in the autoloader + * + * @return array + */ + public function getNamespaces() {} + + /** + * Register directories in which "not found" classes could be found + * + * @deprecated From Phalcon 2.1.0 version has been removed support for prefixes strategy + * @param array $prefixes + * @param bool $merge + * @return Loader + */ + public function registerPrefixes($prefixes, $merge = false) {} + + /** + * Returns the prefixes currently registered in the autoloader + * + * @deprecated From Phalcon 2.1.0 version has been removed support for prefixes strategy + * @return array + */ + public function getPrefixes() {} + + /** + * Register directories in which "not found" classes could be found + * + * @param array $directories + * @param bool $merge + * @return Loader + */ + public function registerDirs($directories, $merge = false) {} + + /** + * Returns the directories currently registered in the autoloader + * + * @return array + */ + public function getDirs() {} + + /** + * Register classes and their locations + * + * @param array $classes + * @param bool $merge + * @return Loader + */ + public function registerClasses($classes, $merge = false) {} + + /** + * Returns the class-map currently registered in the autoloader + * + * @return array + */ + public function getClasses() {} + + /** + * Register the autoload method + * + * @return Loader + */ + public function register() {} + + /** + * Unregister the autoload method + * + * @return Loader + */ + public function unregister() {} + + /** + * Autoloads the registered classes + * + * @param string $className + * @return bool + */ + public function autoLoad($className) {} + + /** + * Get the path when a class was found + * + * @return string + */ + public function getFoundPath() {} + + /** + * Get the path the loader is checking for a path + * + * @return string + */ + public function getCheckedPath() {} + +} diff --git a/ide/2.0.8/Phalcon/Logger.php b/ide/2.0.8/Phalcon/Logger.php new file mode 100644 index 000000000..6ea41067c --- /dev/null +++ b/ide/2.0.8/Phalcon/Logger.php @@ -0,0 +1,53 @@ + + * $logger = new \Phalcon\Logger\Adapter\File("app/logs/test.log"); + * $logger->log("This is a message"); + * $logger->log("This is an error", Phalcon\Logger::ERROR); + * $logger->error("This is another error"); + * + */ +abstract class Logger +{ + + const SPECIAL = 9; + + + const CUSTOM = 8; + + + const DEBUG = 7; + + + const INFO = 6; + + + const NOTICE = 5; + + + const WARNING = 4; + + + const ERROR = 3; + + + const ALERT = 2; + + + const CRITICAL = 1; + + + const EMERGENCE = 0; + + + const EMERGENCY = 0; + + +} diff --git a/ide/2.0.8/Phalcon/Registry.php b/ide/2.0.8/Phalcon/Registry.php new file mode 100644 index 000000000..1e5a4c2c7 --- /dev/null +++ b/ide/2.0.8/Phalcon/Registry.php @@ -0,0 +1,150 @@ + + * $registry = new \Phalcon\Registry(); + * // Set value + * $registry->something = 'something'; + * // or + * $registry['something'] = 'something'; + * // Get value + * $value = $registry->something; + * // or + * $value = $registry['something']; + * // Check if the key exists + * $exists = isset($registry->something); + * // or + * $exists = isset($registry['something']); + * // Unset + * unset($registry->something); + * // or + * unset($registry['something']); + * + * In addition to ArrayAccess, Phalcon\Registry also implements Countable + * (count($registry) will return the number of elements in the registry), + * Serializable and Iterator (you can iterate over the registry + * using a foreach loop) interfaces. For PHP 5.4 and higher, JsonSerializable + * interface is implemented. + * Phalcon\Registry is very fast (it is typically faster than any userspace + * implementation of the registry); however, this comes at a price: + * Phalcon\Registry is a final class and cannot be inherited from. + * Though Phalcon\Registry exposes methods like __get(), offsetGet(), count() etc, + * it is not recommended to invoke them manually (these methods exist mainly to + * match the interfaces the registry implements): $registry->__get('property') + * is several times slower than $registry->property. + * Internally all the magic methods (and interfaces except JsonSerializable) + * are implemented using object handlers or similar techniques: this allows + * to bypass relatively slow method calls. + */ +final class Registry implements \ArrayAccess, \Countable, \Iterator +{ + + protected $_data; + + + /** + * Registry constructor + */ + public final function __construct() {} + + /** + * Checks if the element is present in the registry + * + * @param string $offset + * @return bool + */ + public final function offsetExists($offset) {} + + /** + * Returns an index in the registry + * + * @param string $offset + * @return mixed + */ + public final function offsetGet($offset) {} + + /** + * Sets an element in the registry + * + * @param string $offset + * @param mixed $value + */ + public final function offsetSet($offset, $value) {} + + /** + * Unsets an element in the registry + * + * @param string $offset + */ + public final function offsetUnset($offset) {} + + /** + * Checks how many elements are in the register + * + * @return int + */ + public final function count() {} + + /** + * Moves cursor to next row in the registry + */ + public final function next() {} + + /** + * Gets pointer number of active row in the registry + * + * @return int + */ + public final function key() {} + + /** + * Rewinds the registry cursor to its beginning + */ + public final function rewind() {} + + /** + * Checks if the iterator is valid + * + * @return bool + */ + public function valid() {} + + /** + * Obtains the current value in the internal iterator + */ + public function current() {} + + /** + * Sets an element in the registry + * + * @param string $key + * @param mixed $value + */ + public final function __set($key, $value) {} + + /** + * Returns an index in the registry + * + * @param string $key + * @return mixed + */ + public final function __get($key) {} + + /** + * @param string $key + * @return bool + */ + public final function __isset($key) {} + + /** + * @param string $key + */ + public final function __unset($key) {} + +} diff --git a/ide/2.0.8/Phalcon/Security.php b/ide/2.0.8/Phalcon/Security.php new file mode 100644 index 000000000..0a44a9e35 --- /dev/null +++ b/ide/2.0.8/Phalcon/Security.php @@ -0,0 +1,201 @@ + + * $login = $this->request->getPost('login'); + * $password = $this->request->getPost('password'); + * $user = Users::findFirstByLogin($login); + * if ($user) { + * if ($this->security->checkHash($password, $user->password)) { + * //The password is valid + * } + * } + * + */ +class Security implements \Phalcon\Di\InjectionAwareInterface +{ + + const CRYPT_DEFAULT = 0; + + + const CRYPT_STD_DES = 1; + + + const CRYPT_EXT_DES = 2; + + + const CRYPT_MD5 = 3; + + + const CRYPT_BLOWFISH = 4; + + + const CRYPT_BLOWFISH_X = 5; + + + const CRYPT_BLOWFISH_Y = 6; + + + const CRYPT_SHA256 = 7; + + + const CRYPT_SHA512 = 8; + + + protected $_dependencyInjector; + + + protected $_workFactor = 8; + + + protected $_numberBytes = 16; + + + protected $_tokenKeySessionID = "$PHALCON/CSRF/KEY$"; + + + protected $_tokenValueSessionID = "$PHALCON/CSRF$"; + + + protected $_csrf; + + + protected $_defaultHash; + + + /** + * @param mixed $workFactor + */ + public function setWorkFactor($workFactor) {} + + + public function getWorkFactor() {} + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets a number of bytes to be generated by the openssl pseudo random generator + * + * @param long $randomBytes + */ + public function setRandomBytes($randomBytes) {} + + /** + * Returns a number of bytes to be generated by the openssl pseudo random generator + * + * @return string + */ + public function getRandomBytes() {} + + /** + * Generate a >22-length pseudo random string to be used as salt for passwords + * + * @param int $numberBytes + * @return string + */ + public function getSaltBytes($numberBytes = 0) {} + + /** + * Creates a password hash using bcrypt with a pseudo random salt + * + * @param string $password + * @param int $workFactor + * @return string + */ + public function hash($password, $workFactor = 0) {} + + /** + * Checks a plain text password and its hash version to check if the password matches + * + * @param string $password + * @param string $passwordHash + * @param int $maxPassLength + * @return bool + */ + public function checkHash($password, $passwordHash, $maxPassLength = 0) {} + + /** + * Checks if a password hash is a valid bcrypt's hash + * + * @param string $passwordHash + * @return bool + */ + public function isLegacyHash($passwordHash) {} + + /** + * Generates a pseudo random token key to be used as input's name in a CSRF check + * + * @param int $numberBytes + * @return string + */ + public function getTokenKey($numberBytes = null) {} + + /** + * Generates a pseudo random token value to be used as input's value in a CSRF check + * + * @param int $numberBytes + * @return string + */ + public function getToken($numberBytes = null) {} + + /** + * Check if the CSRF token sent in the request is the same that the current in session + * + * @param mixed $tokenKey + * @param mixed $tokenValue + * @param bool $destroyIfValid + * @return bool + */ + public function checkToken($tokenKey = null, $tokenValue = null, $destroyIfValid = true) {} + + /** + * Returns the value of the CSRF token in session + * + * @return string + */ + public function getSessionToken() {} + + /** + * Removes the value of the CSRF token and key from session + */ + public function destroyToken() {} + + /** + * Computes a HMAC + * + * @param string $data + * @param string $key + * @param string $algo + * @param boolean $raw + */ + public function computeHmac($data, $key, $algo, $raw = false) {} + + /** + * Sets the default hash + * + * @param mixed $defaultHash + */ + public function setDefaultHash($defaultHash) {} + + /** + * Sets the default hash + */ + public function getDefaultHash() {} + +} diff --git a/ide/2.0.8/Phalcon/Session.php b/ide/2.0.8/Phalcon/Session.php new file mode 100644 index 000000000..76e72cff4 --- /dev/null +++ b/ide/2.0.8/Phalcon/Session.php @@ -0,0 +1,23 @@ + + * $session = new \Phalcon\Session\Adapter\Files(array( + * 'uniqueId' => 'my-private-app' + * )); + * $session->start(); + * $session->set('var', 'some-value'); + * echo $session->get('var'); + * + */ +abstract class Session +{ + +} diff --git a/ide/2.0.8/Phalcon/Tag.php b/ide/2.0.8/Phalcon/Tag.php new file mode 100644 index 000000000..6e420778b --- /dev/null +++ b/ide/2.0.8/Phalcon/Tag.php @@ -0,0 +1,718 @@ + + * //Assigning "peter" to "name" component + * Phalcon\Tag::setDefault("name", "peter"); + * //Later in the view + * echo Phalcon\Tag::textField("name"); //Will have the value "peter" by default + * + * + * @param string $id + * @param string $value + */ + public static function setDefault($id, $value) {} + + /** + * Assigns default values to generated tags by helpers + * + * //Assigning "peter" to "name" component + * Phalcon\Tag::setDefaults(array("name" => "peter")); + * //Later in the view + * echo Phalcon\Tag::textField("name"); //Will have the value "peter" by default + * + * + * @param array $values + * @param bool $merge + */ + public static function setDefaults($values, $merge = false) {} + + /** + * Alias of Phalcon\Tag::setDefault + * + * @param string $id + * @param string $value + */ + public static function displayTo($id, $value) {} + + /** + * Check if a helper has a default value set using Phalcon\Tag::setDefault or value from _POST + * + * @param string $name + * @return boolean + */ + public static function hasValue($name) {} + + /** + * Every helper calls this function to check whether a component has a predefined + * value using Phalcon\Tag::setDefault or value from _POST + * + * @param string $name + * @param array $params + * @return mixed + */ + public static function getValue($name, $params = null) {} + + /** + * Resets the request and internal values to avoid those fields will have any default value + */ + public static function resetInput() {} + + /** + * Builds a HTML A tag using framework conventions + * + * echo Phalcon\Tag::linkTo("signup/register", "Register Here!"); + * echo Phalcon\Tag::linkTo(array("signup/register", "Register Here!")); + * echo Phalcon\Tag::linkTo(array("signup/register", "Register Here!", "class" => "btn-primary")); + * echo Phalcon\Tag::linkTo("http://phalconphp.com/", "Phalcon", FALSE); + * echo Phalcon\Tag::linkTo(array("http://phalconphp.com/", "Phalcon Home", FALSE)); + * echo Phalcon\Tag::linkTo(array("http://phalconphp.com/", "Phalcon Home", "local" =>FALSE)); + * + * + * @param array|string $parameters + * @param string $text + * @param boolean $local + * @return string + */ + public static function linkTo($parameters, $text = null, $local = true) {} + + /** + * Builds generic INPUT tags + * + * @param array parameters + * @return string + * @param string $type + * @param mixed $parameters + * @param bool $asValue + * @param $boolean asValue + * @return string + */ + static protected final function _inputField($type, $parameters, $asValue = false) {} + + /** + * Builds INPUT tags that implements the checked attribute + * + * @param array parameters + * @return string + * @param string $type + * @param mixed $parameters + * @return string + */ + static protected final function _inputFieldChecked($type, $parameters) {} + + /** + * Builds a HTML input[type="color"] tag + * + * @param array $parameters + * @return string + */ + public static function colorField($parameters) {} + + /** + * Builds a HTML input[type="text"] tag + * + * echo Phalcon\Tag::textField(array("name", "size" => 30)); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function textField($parameters) {} + + /** + * Builds a HTML input[type="number"] tag + * + * echo Phalcon\Tag::numericField(array("price", "min" => "1", "max" => "5")); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function numericField($parameters) {} + + /** + * Builds a HTML input[type="range"] tag + * + * @param array $parameters + * @return string + */ + public static function rangeField($parameters) {} + + /** + * Builds a HTML input[type="email"] tag + * + * echo Phalcon\Tag::emailField("email"); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function emailField($parameters) {} + + /** + * Builds a HTML input[type="date"] tag + * + * echo Phalcon\Tag::dateField(array("born", "value" => "14-12-1980")) + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function dateField($parameters) {} + + /** + * Builds a HTML input[type="datetime"] tag + * + * @param array $parameters + * @return string + */ + public static function dateTimeField($parameters) {} + + /** + * Builds a HTML input[type="datetime-local"] tag + * + * @param array $parameters + * @return string + */ + public static function dateTimeLocalField($parameters) {} + + /** + * Builds a HTML input[type="month"] tag + * + * @param array $parameters + * @return string + */ + public static function monthField($parameters) {} + + /** + * Builds a HTML input[type="time"] tag + * + * @param array $parameters + * @return string + */ + public static function timeField($parameters) {} + + /** + * Builds a HTML input[type="week"] tag + * + * @param array $parameters + * @return string + */ + public static function weekField($parameters) {} + + /** + * Builds a HTML input[type="password"] tag + * + * echo Phalcon\Tag::passwordField(array("name", "size" => 30)); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function passwordField($parameters) {} + + /** + * Builds a HTML input[type="hidden"] tag + * + * echo Phalcon\Tag::hiddenField(array("name", "value" => "mike")); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function hiddenField($parameters) {} + + /** + * Builds a HTML input[type="file"] tag + * + * echo Phalcon\Tag::fileField("file"); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function fileField($parameters) {} + + /** + * Builds a HTML input[type="search"] tag + * + * @param array $parameters + * @return string + */ + public static function searchField($parameters) {} + + /** + * Builds a HTML input[type="tel"] tag + * + * @param array $parameters + * @return string + */ + public static function telField($parameters) {} + + /** + * Builds a HTML input[type="url"] tag + * + * @param array $parameters + * @return string + */ + public static function urlField($parameters) {} + + /** + * Builds a HTML input[type="check"] tag + * + * echo Phalcon\Tag::checkField(array("terms", "value" => "Y")); + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function checkField($parameters) {} + + /** + * Builds a HTML input[type="radio"] tag + * + * echo Phalcon\Tag::radioField(array("weather", "value" => "hot")) + * + * Volt syntax: + * + * {{ radio_field("Save") }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function radioField($parameters) {} + + /** + * Builds a HTML input[type="image"] tag + * + * echo Phalcon\Tag::imageInput(array("src" => "/img/button.png")); + * + * Volt syntax: + * + * {{ image_input("src": "/img/button.png") }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function imageInput($parameters) {} + + /** + * Builds a HTML input[type="submit"] tag + * + * echo Phalcon\Tag::submitButton("Save") + * + * Volt syntax: + * + * {{ submit_button("Save") }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function submitButton($parameters) {} + + /** + * Builds a HTML SELECT tag using a PHP array for options + * + * echo Phalcon\Tag::selectStatic("status", array("A" => "Active", "I" => "Inactive")) + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @param array $data + * @return string + */ + public static function selectStatic($parameters, $data = null) {} + + /** + * Builds a HTML SELECT tag using a Phalcon\Mvc\Model resultset as options + * + * echo Phalcon\Tag::select(array( + * "robotId", + * Robots::find("type = "mechanical""), + * "using" => array("id", "name") + * )); + * + * Volt syntax: + * + * {{ select("robotId", robots, "using": ["id", "name"]) }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @param array $data + * @return string + */ + public static function select($parameters, $data = null) {} + + /** + * Builds a HTML TEXTAREA tag + * + * echo Phalcon\Tag::textArea(array("comments", "cols" => 10, "rows" => 4)) + * + * Volt syntax: + * + * {{ text_area("comments", "cols": 10, "rows": 4) }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @return string + */ + public static function textArea($parameters) {} + + /** + * Builds a HTML FORM tag + * + * echo Phalcon\Tag::form("posts/save"); + * echo Phalcon\Tag::form(array("posts/save", "method" => "post")); + * + * Volt syntax: + * + * {{ form("posts/save") }} + * {{ form("posts/save", "method": "post") }} + * + * + * @param array $parameters + * @return string + */ + public static function form($parameters) {} + + /** + * Builds a HTML close FORM tag + * + * @return string + */ + public static function endForm() {} + + /** + * Set the title of view content + * + * Phalcon\Tag::setTitle("Welcome to my Page"); + * + * + * @param string $title + */ + public static function setTitle($title) {} + + /** + * Set the title separator of view content + * + * Phalcon\Tag::setTitleSeparator("-"); + * + * + * @param string $titleSeparator + */ + public static function setTitleSeparator($titleSeparator) {} + + /** + * Appends a text to current document title + * + * @param string $title + */ + public static function appendTitle($title) {} + + /** + * Prepends a text to current document title + * + * @param string $title + */ + public static function prependTitle($title) {} + + /** + * Gets the current document title + * + * echo Phalcon\Tag::getTitle(); + * + * + * {{ get_title() }} + * + * + * @param bool $tags + * @return string + */ + public static function getTitle($tags = true) {} + + /** + * Gets the current document title separator + * + * echo Phalcon\Tag::getTitleSeparator(); + * + * + * {{ get_title_separator() }} + * + * + * @return string + */ + public static function getTitleSeparator() {} + + /** + * Builds a LINK[rel="stylesheet"] tag + * + * echo Phalcon\Tag::stylesheetLink("http://fonts.googleapis.com/css?family=Rosario", false); + * echo Phalcon\Tag::stylesheetLink("css/style.css"); + * + * Volt Syntax: + * + * {{ stylesheet_link("http://fonts.googleapis.com/css?family=Rosario", false) }} + * {{ stylesheet_link("css/style.css") }} + * + * + * @param array parameters + * @return string + * @param mixed $parameters + * @param boolean $local + * @return string + */ + public static function stylesheetLink($parameters = null, $local = true) {} + + /** + * Builds a SCRIPT[type="javascript"] tag + * + * echo Phalcon\Tag::javascriptInclude("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false); + * echo Phalcon\Tag::javascriptInclude("javascript/jquery.js"); + * + * Volt syntax: + * + * {{ javascript_include("http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false) }} + * {{ javascript_include("javascript/jquery.js") }} + * + * + * @param array $parameters + * @param boolean $local + * @return string + */ + public static function javascriptInclude($parameters = null, $local = true) {} + + /** + * Builds HTML IMG tags + * + * echo Phalcon\Tag::image("img/bg.png"); + * echo Phalcon\Tag::image(array("img/photo.jpg", "alt" => "Some Photo")); + * + * Volt Syntax: + * + * {{ image("img/bg.png") }} + * {{ image("img/photo.jpg", "alt": "Some Photo") }} + * {{ image("http://static.mywebsite.com/img/bg.png", false) }} + * + * + * @param array $parameters + * @param boolean $local + * @return string + */ + public static function image($parameters = null, $local = true) {} + + /** + * Converts texts into URL-friendly titles + * + * echo Phalcon\Tag::friendlyTitle("These are big important news", "-") + * + * + * @param string $text + * @param string $separator + * @param boolean $lowercase + * @param mixed $replace + * @return string + */ + public static function friendlyTitle($text, $separator = "-", $lowercase = true, $replace = null) {} + + /** + * Set the document type of content + * + * @param int $doctype + */ + public static function setDocType($doctype) {} + + /** + * Get the document type declaration of content + * + * @return string + */ + public static function getDocType() {} + + /** + * Builds a HTML tag + * + * echo Phalcon\Tag::tagHtml(name, parameters, selfClose, onlyStart, eol); + * + * + * @param string $tagName + * @param array $parameters + * @param boolean $selfClose + * @param boolean $onlyStart + * @param boolean $useEol + * @return string + */ + public static function tagHtml($tagName, $parameters = null, $selfClose = false, $onlyStart = false, $useEol = false) {} + + /** + * Builds a HTML tag closing tag + * + * echo Phalcon\Tag::tagHtmlClose("script", true) + * + * + * @param string $tagName + * @param bool $useEol + * @return string + */ + public static function tagHtmlClose($tagName, $useEol = false) {} + +} diff --git a/ide/2.0.8/Phalcon/Text.php b/ide/2.0.8/Phalcon/Text.php new file mode 100644 index 000000000..a52350252 --- /dev/null +++ b/ide/2.0.8/Phalcon/Text.php @@ -0,0 +1,171 @@ + + * echo Phalcon\Text::camelize('coco_bongo'); //CocoBongo + * + * + * @param string $str + * @return string + */ + public static function camelize($str) {} + + /** + * Uncamelize strings which are camelized + * + * echo Phalcon\Text::uncamelize('CocoBongo'); //coco_bongo + * + * + * @param string $str + * @return string + */ + public static function uncamelize($str) {} + + /** + * Adds a number to a string or increment that number if it already is defined + * + * echo Phalcon\Text::increment("a"); // "a_1" + * echo Phalcon\Text::increment("a_1"); // "a_2" + * + * + * @param string $str + * @param string $separator + * @return string + */ + public static function increment($str, $separator = "_") {} + + /** + * Generates a random string based on the given type. Type is one of the RANDOM_* constants + * + * echo Phalcon\Text::random(Phalcon\Text::RANDOM_ALNUM); //"aloiwkqz" + * + * + * @param int $type + * @param long $length + * @return string + */ + public static function random($type = 0, $length = 8) {} + + /** + * Check if a string starts with a given string + * + * echo Phalcon\Text::startsWith("Hello", "He"); // true + * echo Phalcon\Text::startsWith("Hello", "he", false); // false + * echo Phalcon\Text::startsWith("Hello", "he"); // true + * + * + * @param string $str + * @param string $start + * @param bool $ignoreCase + * @return bool + */ + public static function startsWith($str, $start, $ignoreCase = true) {} + + /** + * Check if a string ends with a given string + * + * echo Phalcon\Text::endsWith("Hello", "llo"); // true + * echo Phalcon\Text::endsWith("Hello", "LLO", false); // false + * echo Phalcon\Text::endsWith("Hello", "LLO"); // true + * + * + * @param string $str + * @param string $end + * @param bool $ignoreCase + * @return bool + */ + public static function endsWith($str, $end, $ignoreCase = true) {} + + /** + * Lowercases a string, this function makes use of the mbstring extension if available + * + * echo Phalcon\Text::lower("HELLO"); // hello + * + * + * @param string $str + * @param string $encoding + * @return string + */ + public static function lower($str, $encoding = "UTF-8") {} + + /** + * Uppercases a string, this function makes use of the mbstring extension if available + * + * echo Phalcon\Text::upper("hello"); // HELLO + * + * + * @param string $str + * @param string $encoding + * @return string + */ + public static function upper($str, $encoding = "UTF-8") {} + + /** + * Reduces multiple slashes in a string to single slashes + * + * echo Phalcon\Text::reduceSlashes("foo//bar/baz"); // foo/bar/baz + * echo Phalcon\Text::reduceSlashes("http://foo.bar///baz/buz"); // http://foo.bar/baz/buz + * + * + * @param string $str + * @return string + */ + public static function reduceSlashes($str) {} + + /** + * Concatenates strings using the separator only once without duplication in places concatenation + * + * $str = Phalcon\Text::concat("/", "/tmp/", "/folder_1/", "/folder_2", "folder_3/"); + * echo $str; // /tmp/folder_1/folder_2/folder_3/ + * + * + * @param string $separator + * @param string $a + * @param string $b + * @param string $...N + * @return string + */ + public static function concat() {} + + /** + * Generates random text in accordance with the template + * + * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Bob + * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hi my name is a Jon + * echo Phalcon\Text::dynamic("{Hi|Hello}, my name is a {Bob|Mark|Jon}!"); // Hello my name is a Bob + * + * + * @param string $text + * @param string $leftDelimiter + * @param string $rightDelimiter + * @param string $separator + * @return string + */ + public static function dynamic($text, $leftDelimiter = "{", $rightDelimiter = "}", $separator = "|") {} + +} diff --git a/ide/2.0.8/Phalcon/Translate.php b/ide/2.0.8/Phalcon/Translate.php new file mode 100644 index 000000000..e0cf39581 --- /dev/null +++ b/ide/2.0.8/Phalcon/Translate.php @@ -0,0 +1,13 @@ + + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_MAJOR); + * + */ + const VERSION_MAJOR = 0; + + /** + * The constant referencing the major version. Returns 1 + * + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_MEDIUM); + * + */ + const VERSION_MEDIUM = 1; + + /** + * The constant referencing the major version. Returns 2 + * + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_MINOR); + * + */ + const VERSION_MINOR = 2; + + /** + * The constant referencing the major version. Returns 3 + * + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_SPECIAL); + * + */ + const VERSION_SPECIAL = 3; + + /** + * The constant referencing the major version. Returns 4 + * + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_SPECIAL_NUMBER); + * + */ + const VERSION_SPECIAL_NUMBER = 4; + + + /** + * Area where the version number is set. The format is as follows: + * ABBCCDE + * A - Major version + * B - Med version (two digits) + * C - Min version (two digits) + * D - Special release: 1 = Alpha, 2 = Beta, 3 = RC, 4 = Stable + * E - Special release version i.e. RC1, Beta2 etc. + * + * @return array + */ + protected static function _getVersion() {} + + /** + * Translates a number to a special release + * If Special release = 1 this function will return ALPHA + * + * @param int $special + * @return string + */ + protected final static function _getSpecial($special) {} + + /** + * Returns the active version (string) + * + * echo Phalcon\Version::get(); + * + * + * @return string + */ + public static function get() {} + + /** + * Returns the numeric active version + * + * echo Phalcon\Version::getId(); + * + * + * @return string + */ + public static function getId() {} + + /** + * Returns a specific part of the version. If the wrong parameter is passed + * it will return the full version + * + * echo Phalcon\Version::getPart(Phalcon\Version::VERSION_MAJOR); + * + * + * @param int $part + * @return string + */ + public static function getPart($part) {} + +} diff --git a/ide/2.0.8/Phalcon/acl/Adapter.php b/ide/2.0.8/Phalcon/acl/Adapter.php new file mode 100644 index 000000000..d261e1917 --- /dev/null +++ b/ide/2.0.8/Phalcon/acl/Adapter.php @@ -0,0 +1,103 @@ + + * $acl = new \Phalcon\Acl\Adapter\Memory(); + * $acl->setDefaultAction(Phalcon\Acl::DENY); + * //Register roles + * $roles = array( + * 'users' => new \Phalcon\Acl\Role('Users'), + * 'guests' => new \Phalcon\Acl\Role('Guests') + * ); + * foreach ($roles as $role) { + * $acl->addRole($role); + * } + * //Private area resources + * $privateResources = array( + * 'companies' => array('index', 'search', 'new', 'edit', 'save', 'create', 'delete'), + * 'products' => array('index', 'search', 'new', 'edit', 'save', 'create', 'delete'), + * 'invoices' => array('index', 'profile') + * ); + * foreach ($privateResources as $resource => $actions) { + * $acl->addResource(new Phalcon\Acl\Resource($resource), $actions); + * } + * //Public area resources + * $publicResources = array( + * 'index' => array('index'), + * 'about' => array('index'), + * 'session' => array('index', 'register', 'start', 'end'), + * 'contact' => array('index', 'send') + * ); + * foreach ($publicResources as $resource => $actions) { + * $acl->addResource(new Phalcon\Acl\Resource($resource), $actions); + * } + * //Grant access to public areas to both users and guests + * foreach ($roles as $role){ + * foreach ($publicResources as $resource => $actions) { + * $acl->allow($role->getName(), $resource, '*'); + * } + * } + * //Grant access to private area to role Users + * foreach ($privateResources as $resource => $actions) { + * foreach ($actions as $action) { + * $acl->allow('Users', $resource, $action); + * } + * } + * + */ +class Memory extends \Phalcon\Acl\Adapter +{ + /** + * Roles Names + * + * @var mixed + */ + protected $_rolesNames; + + /** + * Roles + * + * @var mixed + */ + protected $_roles; + + /** + * Resource Names + * + * @var mixed + */ + protected $_resourcesNames; + + /** + * Resources + * + * @var mixed + */ + protected $_resources; + + /** + * Access + * + * @var mixed + */ + protected $_access; + + /** + * Role Inherits + * + * @var mixed + */ + protected $_roleInherits; + + /** + * Access List + * + * @var mixed + */ + protected $_accessList; + + + /** + * Phalcon\Acl\Adapter\Memory constructor + */ + public function __construct() {} + + /** + * Adds a role to the ACL list. Second parameter allows inheriting access data from other existing role + * Example: + * + * $acl->addRole(new Phalcon\Acl\Role('administrator'), 'consultant'); + * $acl->addRole('administrator', 'consultant'); + * + * + * @param mixed $role + * @param array|string $accessInherits + * @return bool + */ + public function addRole($role, $accessInherits = null) {} + + /** + * Do a role inherit from another existing role + * + * @param string $roleName + * @param mixed $roleToInherit + * @return bool + */ + public function addInherit($roleName, $roleToInherit) {} + + /** + * Check whether role exist in the roles list + * + * @param string $roleName + * @return bool + */ + public function isRole($roleName) {} + + /** + * Check whether resource exist in the resources list + * + * @param string $resourceName + * @return bool + */ + public function isResource($resourceName) {} + + /** + * Adds a resource to the ACL list + * Access names can be a particular action, by example + * search, update, delete, etc or a list of them + * Example: + * + * //Add a resource to the the list allowing access to an action + * $acl->addResource(new Phalcon\Acl\Resource('customers'), 'search'); + * $acl->addResource('customers', 'search'); + * //Add a resource with an access list + * $acl->addResource(new Phalcon\Acl\Resource('customers'), array('create', 'search')); + * $acl->addResource('customers', array('create', 'search')); + * + * + * @param \Phalcon\Acl\Resource|string $resourceValue + * @param array|string $accessList + * @return bool + */ + public function addResource($resourceValue, $accessList) {} + + /** + * Adds access to resources + * + * @param string $resourceName + * @param array|string $accessList + * @return bool + */ + public function addResourceAccess($resourceName, $accessList) {} + + /** + * Removes an access from a resource + * + * @param string $resourceName + * @param array|string $accessList + */ + public function dropResourceAccess($resourceName, $accessList) {} + + /** + * Checks if a role has access to a resource + * + * @param string $roleName + * @param string $resourceName + * @param mixed $access + * @param mixed $action + */ + protected function _allowOrDeny($roleName, $resourceName, $access, $action) {} + + /** + * Allow access to a role on a resource + * You can use '*' as wildcard + * Example: + * + * //Allow access to guests to search on customers + * $acl->allow('guests', 'customers', 'search'); + * //Allow access to guests to search or create on customers + * $acl->allow('guests', 'customers', array('search', 'create')); + * //Allow access to any role to browse on products + * $acl->allow('*', 'products', 'browse'); + * //Allow access to any role to browse on any resource + * $acl->allow('*', '*', 'browse'); + * + * + * @param string $roleName + * @param string $resourceName + * @param mixed $access + */ + public function allow($roleName, $resourceName, $access) {} + + /** + * Deny access to a role on a resource + * You can use '*' as wildcard + * Example: + * + * //Deny access to guests to search on customers + * $acl->deny('guests', 'customers', 'search'); + * //Deny access to guests to search or create on customers + * $acl->deny('guests', 'customers', array('search', 'create')); + * //Deny access to any role to browse on products + * $acl->deny('*', 'products', 'browse'); + * //Deny access to any role to browse on any resource + * $acl->deny('*', '*', 'browse'); + * + * + * @param string $roleName + * @param string $resourceName + * @param mixed $access + */ + public function deny($roleName, $resourceName, $access) {} + + /** + * Check whether a role is allowed to access an action from a resource + * + * //Does andres have access to the customers resource to create? + * $acl->isAllowed('andres', 'Products', 'create'); + * //Do guests have access to any resource to edit? + * $acl->isAllowed('guests', '*', 'edit'); + * + * + * @param string $roleName + * @param string $resourceName + * @param string $access + * @return bool + */ + public function isAllowed($roleName, $resourceName, $access) {} + + /** + * Return an array with every role registered in the list + * + * @return \Phalcon\Acl\Role + */ + public function getRoles() {} + + /** + * Return an array with every resource registered in the list + * + * @return \Phalcon\Acl\Resource + */ + public function getResources() {} + +} diff --git a/ide/2.0.8/Phalcon/annotations/Adapter.php b/ide/2.0.8/Phalcon/annotations/Adapter.php new file mode 100644 index 000000000..19b67c0aa --- /dev/null +++ b/ide/2.0.8/Phalcon/annotations/Adapter.php @@ -0,0 +1,74 @@ + + * //Traverse annotations + * foreach ($classAnnotations as $annotation) { + * echo 'Name=', $annotation->getName(), PHP_EOL; + * } + * //Check if the annotations has a specific + * var_dump($classAnnotations->has('Cacheable')); + * //Get an specific annotation in the collection + * $annotation = $classAnnotations->get('Cacheable'); + * + */ +class Collection implements \Iterator, \Countable +{ + + protected $_position = 0; + + + protected $_annotations; + + + /** + * Phalcon\Annotations\Collection constructor + * + * @param array $reflectionData + */ + public function __construct($reflectionData = null) {} + + /** + * Returns the number of annotations in the collection + * + * @return int + */ + public function count() {} + + /** + * Rewinds the internal iterator + */ + public function rewind() {} + + /** + * Returns the current annotation in the iterator + * + * @return \Phalcon\Annotations\Annotation + */ + public function current() {} + + /** + * Returns the current position/key in the iterator + * + * @return int + */ + public function key() {} + + /** + * Moves the internal iteration pointer to the next position + */ + public function next() {} + + /** + * Check if the current annotation in the iterator is valid + * + * @return bool + */ + public function valid() {} + + /** + * Returns the internal annotations as an array + * + * @return \Phalcon\Annotations\Annotation + */ + public function getAnnotations() {} + + /** + * Returns the first annotation that match a name + * + * @param string $name + * @return \Phalcon\Annotations\Annotation + */ + public function get($name) {} + + /** + * Returns all the annotations that match a name + * + * @param string $name + * @return \Phalcon\Annotations\Annotation + */ + public function getAll($name) {} + + /** + * Check if an annotation exists in a collection + * + * @param string $name + * @return bool + */ + public function has($name) {} + +} diff --git a/ide/2.0.8/Phalcon/annotations/Exception.php b/ide/2.0.8/Phalcon/annotations/Exception.php new file mode 100644 index 000000000..973db2530 --- /dev/null +++ b/ide/2.0.8/Phalcon/annotations/Exception.php @@ -0,0 +1,9 @@ + + * use Phalcon\Annotations\Reader; + * use Phalcon\Annotations\Reflection; + * // Parse the annotations in a class + * $reader = new Reader(); + * $parsing = reader->parse('MyComponent'); + * // Create the reflection + * $reflection = new Reflection($parsing); + * // Get the annotations in the class docblock + * $classAnnotations = reflection->getClassAnnotations(); + * + */ +class Reflection +{ + + protected $_reflectionData; + + + protected $_classAnnotations; + + + protected $_methodAnnotations; + + + protected $_propertyAnnotations; + + + /** + * Phalcon\Annotations\Reflection constructor + * + * @param array $reflectionData + */ + public function __construct($reflectionData = null) {} + + /** + * Returns the annotations found in the class docblock + * + * @return bool|\Phalcon\Annotations\Collection + */ + public function getClassAnnotations() {} + + /** + * Returns the annotations found in the methods' docblocks + * + * @return bool|\Phalcon\Annotations\Collection + */ + public function getMethodsAnnotations() {} + + /** + * Returns the annotations found in the properties' docblocks + * + * @return bool|\Phalcon\Annotations\Collection + */ + public function getPropertiesAnnotations() {} + + /** + * Returns the raw parsing intermediate definitions used to construct the reflection + * + * @return array + */ + public function getReflectionData() {} + + /** + * Restores the state of a Phalcon\Annotations\Reflection variable export + * + * @param mixed $data + * @return array + */ + public static function __set_state($data) {} + +} diff --git a/ide/2.0.8/Phalcon/annotations/adapter/Apc.php b/ide/2.0.8/Phalcon/annotations/adapter/Apc.php new file mode 100644 index 000000000..822c0c8a8 --- /dev/null +++ b/ide/2.0.8/Phalcon/annotations/adapter/Apc.php @@ -0,0 +1,44 @@ + + * $annotations = new \Phalcon\Annotations\Adapter\Apc(); + * + */ +class Apc extends \Phalcon\Annotations\Adapter implements \Phalcon\Annotations\AdapterInterface +{ + + protected $_prefix = ""; + + + protected $_ttl = 172800; + + + /** + * Phalcon\Annotations\Adapter\Apc constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads parsed annotations from APC + * + * @param string $key + * @return \Phalcon\Annotations\Reflection + */ + public function read($key) {} + + /** + * Writes parsed annotations to APC + * + * @param string $key + * @param mixed $data + */ + public function write($key, \Phalcon\Annotations\Reflection $data) {} + +} diff --git a/ide/2.0.8/Phalcon/annotations/adapter/Files.php b/ide/2.0.8/Phalcon/annotations/adapter/Files.php new file mode 100644 index 000000000..9115c2b35 --- /dev/null +++ b/ide/2.0.8/Phalcon/annotations/adapter/Files.php @@ -0,0 +1,43 @@ + + * $annotations = new \Phalcon\Annotations\Adapter\Files(array( + * 'annotationsDir' => 'app/cache/annotations/' + * )); + * + */ +class Files extends \Phalcon\Annotations\Adapter implements \Phalcon\Annotations\AdapterInterface +{ + + protected $_annotationsDir = "./"; + + + /** + * Phalcon\Annotations\Adapter\Files constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads parsed annotations from files + * + * @param string $key + * @return \Phalcon\Annotations\Reflection + */ + public function read($key) {} + + /** + * Writes parsed annotations to files + * + * @param string $key + * @param mixed $data + */ + public function write($key, \Phalcon\Annotations\Reflection $data) {} + +} diff --git a/ide/2.0.8/Phalcon/annotations/adapter/Memory.php b/ide/2.0.8/Phalcon/annotations/adapter/Memory.php new file mode 100644 index 000000000..84ad80c8c --- /dev/null +++ b/ide/2.0.8/Phalcon/annotations/adapter/Memory.php @@ -0,0 +1,35 @@ + + * $annotations = new \Phalcon\Annotations\Adapter\Xcache(); + * + */ +class Xcache extends \Phalcon\Annotations\Adapter implements \Phalcon\Annotations\AdapterInterface +{ + + /** + * Reads parsed annotations from XCache + * + * @param string $key + * @return \Phalcon\Annotations\Reflection + */ + public function read($key) {} + + /** + * Writes parsed annotations to XCache + * + * @param string $key + * @param mixed $data + */ + public function write($key, \Phalcon\Annotations\Reflection $data) {} + +} diff --git a/ide/2.0.8/Phalcon/assets/Collection.php b/ide/2.0.8/Phalcon/assets/Collection.php new file mode 100644 index 000000000..ea2bd2a1c --- /dev/null +++ b/ide/2.0.8/Phalcon/assets/Collection.php @@ -0,0 +1,268 @@ + + * $inline = new \Phalcon\Assets\Inline('js', 'alert("hello world");'); + * + */ +class Inline +{ + + protected $_type; + + + protected $_content; + + + protected $_filter; + + + protected $_attributes; + + + + public function getType() {} + + + public function getContent() {} + + + public function getFilter() {} + + + public function getAttributes() {} + + /** + * Phalcon\Assets\Inline constructor + * + * @param string $type + * @param string $content + * @param boolean $filter + * @param array $attributes + */ + public function __construct($type, $content, $filter = true, $attributes = null) {} + + /** + * Sets the inline's type + * + * @param string $type + * @return Inline + */ + public function setType($type) {} + + /** + * Sets if the resource must be filtered or not + * + * @param bool $filter + * @return Inline + */ + public function setFilter($filter) {} + + /** + * Sets extra HTML attributes + * + * @param array $attributes + * @return Inline + */ + public function setAttributes($attributes) {} + +} diff --git a/ide/2.0.8/Phalcon/assets/Manager.php b/ide/2.0.8/Phalcon/assets/Manager.php new file mode 100644 index 000000000..b2c0e7625 --- /dev/null +++ b/ide/2.0.8/Phalcon/assets/Manager.php @@ -0,0 +1,242 @@ + + * $assets->addCss('css/bootstrap.css'); + * $assets->addCss('http://bootstrap.my-cdn.com/style.css', false); + * + * + * @param string $path + * @param mixed $local + * @param mixed $filter + * @param mixed $attributes + * @return Manager + */ + public function addCss($path, $local = true, $filter = true, $attributes = null) {} + + /** + * Adds a inline Css to the 'css' collection + * + * @param string $content + * @param mixed $filter + * @param mixed $attributes + * @return Manager + */ + public function addInlineCss($content, $filter = true, $attributes = null) {} + + /** + * Adds a javascript resource to the 'js' collection + * + * $assets->addJs('scripts/jquery.js'); + * $assets->addJs('http://jquery.my-cdn.com/jquery.js', false); + * + * + * @param string $path + * @param mixed $local + * @param mixed $filter + * @param mixed $attributes + * @return Manager + */ + public function addJs($path, $local = true, $filter = true, $attributes = null) {} + + /** + * Adds a inline javascript to the 'js' collection + * + * @param string $content + * @param mixed $filter + * @param mixed $attributes + * @return Manager + */ + public function addInlineJs($content, $filter = true, $attributes = null) {} + + /** + * Adds a resource by its type + * + * $assets->addResourceByType('css', new \Phalcon\Assets\Resource\Css('css/style.css')); + * + * + * @param string $type + * @param mixed $resource + * @return Manager + */ + public function addResourceByType($type, \Phalcon\Assets\Resource $resource) {} + + /** + * Adds a inline code by its type + * + * @param string $type + * @param mixed $code + * @return Manager + */ + public function addInlineCodeByType($type, Inline $code) {} + + /** + * Adds a raw resource to the manager + * + * $assets->addResource(new Phalcon\Assets\Resource('css', 'css/style.css')); + * + * + * @param mixed $resource + * @return Manager + */ + public function addResource(\Phalcon\Assets\Resource $resource) {} + + /** + * Adds a raw inline code to the manager + * + * @param mixed $code + * @return Manager + */ + public function addInlineCode(Inline $code) {} + + /** + * Sets a collection in the Assets Manager + * + * $assets->set('js', $collection); + * + * + * @param string $id + * @param mixed $collection + * @return Manager + */ + public function set($id, \Phalcon\Assets\Collection $collection) {} + + /** + * Returns a collection by its id + * + * $scripts = $assets->get('js'); + * + * + * @param string $id + * @return \Phalcon\Assets\Collection + */ + public function get($id) {} + + /** + * Returns the CSS collection of assets + * + * @return \Phalcon\Assets\Collection + */ + public function getCss() {} + + /** + * Returns the CSS collection of assets + * + * @return \Phalcon\Assets\Collection + */ + public function getJs() {} + + /** + * Creates/Returns a collection of resources + * + * @param string $name + * @return \Phalcon\Assets\Collection + */ + public function collection($name) {} + + /** + * Traverses a collection calling the callback to generate its HTML + * + * @param \Phalcon\Assets\Collection $collection + * @param callback $callback + * @param string $type + */ + public function output(\Phalcon\Assets\Collection $collection, $callback, $type) {} + + /** + * Traverses a collection and generate its HTML + * + * @param \Phalcon\Assets\Collection $collection + * @param string $type + */ + public function outputInline(\Phalcon\Assets\Collection $collection, $type) {} + + /** + * Prints the HTML for CSS resources + * + * @param string $collectionName + */ + public function outputCss($collectionName = null) {} + + /** + * Prints the HTML for inline CSS + * + * @param string $collectionName + */ + public function outputInlineCss($collectionName = null) {} + + /** + * Prints the HTML for JS resources + * + * @param string $collectionName + */ + public function outputJs($collectionName = null) {} + + /** + * Prints the HTML for inline JS + * + * @param string $collectionName + */ + public function outputInlineJs($collectionName = null) {} + + /** + * Returns existing collections in the manager + * + * @return \Phalcon\Assets\Collection + */ + public function getCollections() {} + +} diff --git a/ide/2.0.8/Phalcon/assets/Resource.php b/ide/2.0.8/Phalcon/assets/Resource.php new file mode 100644 index 000000000..e2013640d --- /dev/null +++ b/ide/2.0.8/Phalcon/assets/Resource.php @@ -0,0 +1,170 @@ + + * $resource = new \Phalcon\Assets\Resource('js', 'javascripts/jquery.js'); + * + */ +class Resource +{ + + protected $_type; + + + protected $_path; + + + protected $_local; + + + protected $_filter; + + + protected $_attributes; + + + protected $_sourcePath; + + + protected $_targetPath; + + + protected $_targetUri; + + + + public function getType() {} + + + public function getPath() {} + + + public function getLocal() {} + + + public function getFilter() {} + + + public function getAttributes() {} + + + public function getSourcePath() {} + + + public function getTargetPath() {} + + + public function getTargetUri() {} + + /** + * Phalcon\Assets\Resource constructor + * + * @param string $type + * @param string $path + * @param boolean $local + * @param boolean $filter + * @param array $attributes + */ + public function __construct($type, $path, $local = true, $filter = true, $attributes = null) {} + + /** + * Sets the resource's type + * + * @param string $type + * @return Resource + */ + public function setType($type) {} + + /** + * Sets the resource's path + * + * @param string $path + * @return Resource + */ + public function setPath($path) {} + + /** + * Sets if the resource is local or external + * + * @param bool $local + * @return Resource + */ + public function setLocal($local) {} + + /** + * Sets if the resource must be filtered or not + * + * @param bool $filter + * @return Resource + */ + public function setFilter($filter) {} + + /** + * Sets extra HTML attributes + * + * @param array $attributes + * @return Resource + */ + public function setAttributes($attributes) {} + + /** + * Sets a target uri for the generated HTML + * + * @param string $targetUri + * @return Resource + */ + public function setTargetUri($targetUri) {} + + /** + * Sets the resource's source path + * + * @param string $sourcePath + * @return Resource + */ + public function setSourcePath($sourcePath) {} + + /** + * Sets the resource's target path + * + * @param string $targetPath + * @return Resource + */ + public function setTargetPath($targetPath) {} + + /** + * Returns the content of the resource as an string + * Optionally a base path where the resource is located can be set + * + * @param string $basePath + * @return string + */ + public function getContent($basePath = null) {} + + /** + * Returns the real target uri for the generated HTML + * + * @return string + */ + public function getRealTargetUri() {} + + /** + * Returns the complete location where the resource is located + * + * @param string $basePath + * @return string + */ + public function getRealSourcePath($basePath = null) {} + + /** + * Returns the complete location where the resource must be written + * + * @param string $basePath + * @return string + */ + public function getRealTargetPath($basePath = null) {} + +} diff --git a/ide/2.0.8/Phalcon/assets/filters/Cssmin.php b/ide/2.0.8/Phalcon/assets/filters/Cssmin.php new file mode 100644 index 000000000..7071441f5 --- /dev/null +++ b/ide/2.0.8/Phalcon/assets/filters/Cssmin.php @@ -0,0 +1,22 @@ + + * use Phalcon\Cache\Frontend\Data as DataFrontend, + * Phalcon\Cache\Multiple, + * Phalcon\Cache\Backend\Apc as ApcCache, + * Phalcon\Cache\Backend\Memcache as MemcacheCache, + * Phalcon\Cache\Backend\File as FileCache; + * $ultraFastFrontend = new DataFrontend(array( + * "lifetime" => 3600 + * )); + * $fastFrontend = new DataFrontend(array( + * "lifetime" => 86400 + * )); + * $slowFrontend = new DataFrontend(array( + * "lifetime" => 604800 + * )); + * //Backends are registered from the fastest to the slower + * $cache = new Multiple(array( + * new ApcCache($ultraFastFrontend, array( + * "prefix" => 'cache', + * )), + * new MemcacheCache($fastFrontend, array( + * "prefix" => 'cache', + * "host" => "localhost", + * "port" => "11211" + * )), + * new FileCache($slowFrontend, array( + * "prefix" => 'cache', + * "cacheDir" => "../app/cache/" + * )) + * )); + * //Save, saves in every backend + * $cache->save('my-key', $data); + * + */ +class Multiple +{ + + protected $_backends; + + + /** + * Phalcon\Cache\Multiple constructor + * + * @param Phalcon\Cache\BackendInterface[] backends + * @param mixed $backends + */ + public function __construct($backends = null) {} + + /** + * Adds a backend + * + * @param mixed $backend + * @return Multiple + */ + public function push(\Phalcon\Cache\BackendInterface $backend) {} + + /** + * Returns a cached content reading the internal backends + * + * @param mixed $keyName + * @param long $lifetime + * @param $string|int keyName + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Starts every backend + * + * @param string|int $keyName + * @param long $lifetime + */ + public function start($keyName, $lifetime = null) {} + + /** + * Stores cached content into all backends and stops the frontend + * + * @param string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = null) {} + + /** + * Deletes a value from each backend + * + * @param string|int $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Checks if cache exists in at least one backend + * + * @param string|int $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Flush all backend(s) + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Apc.php b/ide/2.0.8/Phalcon/cache/backend/Apc.php new file mode 100644 index 000000000..8e6f53d83 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Apc.php @@ -0,0 +1,95 @@ + + * //Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Data(array( + * 'lifetime' => 172800 + * )); + * $cache = new \Phalcon\Cache\Backend\Apc($frontCache, array( + * 'prefix' => 'app-data' + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Apc extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + /** + * Returns a cached content + * + * @param string $keyName + * @param long $lifetime + * @param $string|long keyName + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the APC backend and stops the frontend + * + * @param string|long $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Increment of a given key, by number $value + * + * @param string $keyName + * @param long $value + * @return mixed + */ + public function increment($keyName = null, $value = 1) {} + + /** + * Decrement of a given key, by number $value + * + * @param string $keyName + * @param long $value + * @return mixed + */ + public function decrement($keyName = null, $value = 1) {} + + /** + * Deletes a value from the cache by its key + * + * @param string $keyName + * @return bool + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it hasn't expired + * + * @param string|long $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/File.php b/ide/2.0.8/Phalcon/cache/backend/File.php new file mode 100644 index 000000000..44e4a87c0 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/File.php @@ -0,0 +1,135 @@ + + * //Cache the file for 2 days + * $frontendOptions = array( + * 'lifetime' => 172800 + * ); + * //Create a output cache + * $frontCache = \Phalcon\Cache\Frontend\Output($frontOptions); + * //Set the cache directory + * $backendOptions = array( + * 'cacheDir' => '../app/cache/' + * ); + * //Create the File backend + * $cache = new \Phalcon\Cache\Backend\File($frontCache, $backendOptions); + * $content = $cache->start('my-cache'); + * if ($content === null) { + * echo '

', time(), '

'; + * $cache->save(); + * } else { + * echo $content; + * } + * + */ +class File extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + /** + * Default to false for backwards compatibility + * + * @var boolean + */ + private $_useSafeKey = false; + + + /** + * Phalcon\Cache\Backend\File constructor + * + * @param Phalcon\Cache\FrontendInterface frontend + * @param array options + * @param mixed $frontend + * @param mixed $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param int $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param int $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string|int $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string|int $keyName + * @param int $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Increment of a given key, by number $value + * + * @param string|int $keyName + * @param int $value + * @return mixed + */ + public function increment($keyName = null, $value = 1) {} + + /** + * Decrement of a given key, by number $value + * + * @param string|int $keyName + * @param int $value + * @return mixed + */ + public function decrement($keyName = null, $value = 1) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + + /** + * Return a file-system safe identifier for a given key + * + * @param mixed $key + * @return string + */ + public function getKey($key) {} + + /** + * Set whether to use the safekey or not + * + * @param bool $useSafeKey + * @return this + */ + public function useSafeKey($useSafeKey) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Libmemcached.php b/ide/2.0.8/Phalcon/cache/backend/Libmemcached.php new file mode 100644 index 000000000..6c309c077 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Libmemcached.php @@ -0,0 +1,123 @@ + + * // Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Data(array( + * "lifetime" => 172800 + * )); + * //Create the Cache setting memcached connection options + * $cache = new \Phalcon\Cache\Backend\Libmemcached($frontCache, array( + * "servers" => array( + * array('host' => 'localhost', + * 'port' => 11211, + * 'weight' => 1), + * ), + * "client" => array( + * Memcached::OPT_HASH => Memcached::HASH_MD5, + * Memcached::OPT_PREFIX_KEY => 'prefix.', + * ) + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Libmemcached extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + protected $_memcache = null; + + + /** + * Phalcon\Cache\Backend\Memcache constructor + * + * @param Phalcon\Cache\FrontendInterface frontend + * @param array options + * @param mixed $frontend + * @param mixed $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Create internal connection to memcached + */ + public function _connect() {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param long $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Increment of given $keyName by $value + * + * @param string $keyName + * @param mixed $value + * @param long $lifetime + * @return long + */ + public function increment($keyName = null, $value = null) {} + + /** + * Decrement of $keyName by given $value + * + * @param string $keyName + * @param long $value + * @return long + */ + public function decrement($keyName = null, $value = null) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Memcache.php b/ide/2.0.8/Phalcon/cache/backend/Memcache.php new file mode 100644 index 000000000..c8fbb69e7 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Memcache.php @@ -0,0 +1,117 @@ + + * // Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Data(array( + * "lifetime" => 172800 + * )); + * //Create the Cache setting memcached connection options + * $cache = new \Phalcon\Cache\Backend\Memcache($frontCache, array( + * 'host' => 'localhost', + * 'port' => 11211, + * 'persistent' => false + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Memcache extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + protected $_memcache = null; + + + /** + * Phalcon\Cache\Backend\Memcache constructor + * + * @param Phalcon\Cache\FrontendInterface frontend + * @param array options + * @param mixed $frontend + * @param mixed $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Create internal connection to memcached + */ + public function _connect() {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param long $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Increment of given $keyName by $value + * + * @param string $keyName + * @param mixed $value + * @param long $lifetime + * @return long + */ + public function increment($keyName = null, $value = null) {} + + /** + * Decrement of $keyName by given $value + * + * @param string $keyName + * @param long $value + * @return long + */ + public function decrement($keyName = null, $value = null) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Memory.php b/ide/2.0.8/Phalcon/cache/backend/Memory.php new file mode 100644 index 000000000..3c9ae6720 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Memory.php @@ -0,0 +1,109 @@ + + * //Cache data + * $frontCache = new \Phalcon\Cache\Frontend\Data(); + * $cache = new \Phalcon\Cache\Backend\Memory($frontCache); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Memory extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface, \Serializable +{ + + protected $_data; + + + /** + * Returns a cached content + * + * @param mixed $keyName + * @param long $lifetime + * @param $string keyName + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the backend and stops the frontend + * + * @param string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string|int $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it hasn't expired + * + * @param string|int $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Increment of given $keyName by $value + * + * @param string $keyName + * @param mixed $value + * @param long $lifetime + * @return long + */ + public function increment($keyName = null, $value = null) {} + + /** + * Decrement of $keyName by given $value + * + * @param string $keyName + * @param long $value + * @return long + */ + public function decrement($keyName = null, $value = null) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + + /** + * Required for interface \Serializable + * + * @return string + */ + public function serialize() {} + + /** + * Required for interface \Serializable + * + * @param mixed $data + */ + public function unserialize($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Mongo.php b/ide/2.0.8/Phalcon/cache/backend/Mongo.php new file mode 100644 index 000000000..8f4549815 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Mongo.php @@ -0,0 +1,124 @@ + + * // Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Base64(array( + * "lifetime" => 172800 + * )); + * //Create a MongoDB cache + * $cache = new \Phalcon\Cache\Backend\Mongo($frontCache, array( + * 'server' => "mongodb://localhost", + * 'db' => 'caches', + * 'collection' => 'images' + * )); + * //Cache arbitrary data + * $cache->save('my-data', file_get_contents('some-image.jpg')); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Mongo extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + protected $_collection = null; + + + /** + * Phalcon\Cache\Backend\Mongo constructor + * + * @param \Phalcon\Cache\FrontendInterface $frontend + * @param array $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Returns a MongoDb collection based on the backend parameters + * + * @return MongoCollection + */ + protected final function _getCollection() {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param long $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * gc + * + * @return collection->remove(...) + */ + public function gc() {} + + /** + * Increment of a given key by $value + * + * @param int|string $keyName + * @param long $value + * @return mixed + */ + public function increment($keyName, $value = 1) {} + + /** + * Decrement of a given key by $value + * + * @param mixed $keyName + * @param mixed $value + * @param int|string $$keyName + * @param long $$value + * @return mixed + */ + public function decrement($keyName, $value = 1) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Redis.php b/ide/2.0.8/Phalcon/cache/backend/Redis.php new file mode 100644 index 000000000..0b17db6a5 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Redis.php @@ -0,0 +1,118 @@ + + * // Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Data(array( + * "lifetime" => 172800 + * )); + * //Create the Cache setting redis connection options + * $cache = new Phalcon\Cache\Backend\Redis($frontCache, array( + * 'host' => 'localhost', + * 'port' => 6379, + * 'auth' => 'foobared', + * 'persistent' => false + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Redis extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + protected $_redis = null; + + + /** + * Phalcon\Cache\Backend\Redis constructor + * + * @param Phalcon\Cache\FrontendInterface frontend + * @param array options + * @param mixed $frontend + * @param mixed $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Create internal connection to redis + */ + public function _connect() {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param long $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Increment of given $keyName by $value + * + * @param string $keyName + * @param mixed $value + * @param long $lifetime + * @return long + */ + public function increment($keyName = null, $value = null) {} + + /** + * Decrement of $keyName by given $value + * + * @param string $keyName + * @param long $value + * @return long + */ + public function decrement($keyName = null, $value = null) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/backend/Xcache.php b/ide/2.0.8/Phalcon/cache/backend/Xcache.php new file mode 100644 index 000000000..137c2ccfa --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/backend/Xcache.php @@ -0,0 +1,102 @@ + + * //Cache data for 2 days + * $frontCache = new \Phalcon\Cache\Frontend\Data(array( + * 'lifetime' => 172800 + * )); + * $cache = new \Phalcon\Cache\Backend\Xcache($frontCache, array( + * 'prefix' => 'app-data' + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Xcache extends \Phalcon\Cache\Backend implements \Phalcon\Cache\BackendInterface +{ + + /** + * Phalcon\Cache\Backend\Xcache constructor + * + * @param \Phalcon\Cache\FrontendInterface $frontend + * @param array $options + */ + public function __construct(\Phalcon\Cache\FrontendInterface $frontend, $options = null) {} + + /** + * Returns a cached content + * + * @param int|string $keyName + * @param long $lifetime + * @return mixed + */ + public function get($keyName, $lifetime = null) {} + + /** + * Stores cached content into the file backend and stops the frontend + * + * @param int|string $keyName + * @param string $content + * @param long $lifetime + * @param boolean $stopBuffer + */ + public function save($keyName = null, $content = null, $lifetime = null, $stopBuffer = true) {} + + /** + * Deletes a value from the cache by its key + * + * @param int|string $keyName + * @return boolean + */ + public function delete($keyName) {} + + /** + * Query the existing cached keys + * + * @param string $prefix + * @return array + */ + public function queryKeys($prefix = null) {} + + /** + * Checks if cache exists and it isn't expired + * + * @param string $keyName + * @param long $lifetime + * @return boolean + */ + public function exists($keyName = null, $lifetime = null) {} + + /** + * Atomic increment of a given key, by number $value + * + * @param string $keyName + * @param long $value + * @return mixed + */ + public function increment($keyName, $value = 1) {} + + /** + * Atomic decrement of a given key, by number $value + * + * @param string $keyName + * @param long $value + * @return mixed + */ + public function decrement($keyName, $value = 1) {} + + /** + * Immediately invalidates all existing items. + * + * @return bool + */ + public function flush() {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/Base64.php b/ide/2.0.8/Phalcon/cache/frontend/Base64.php new file mode 100644 index 000000000..f20e10ece --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/Base64.php @@ -0,0 +1,92 @@ + + * 172800 + * )); + * //Create a MongoDB cache + * $cache = new \Phalcon\Cache\Backend\Mongo($frontCache, array( + * 'server' => "mongodb://localhost", + * 'db' => 'caches', + * 'collection' => 'images' + * )); + * // Try to get cached image + * $cacheKey = 'some-image.jpg.cache'; + * $image = $cache->get($cacheKey); + * if ($image === null) { + * // Store the image in the cache + * $cache->save($cacheKey, file_get_contents('tmp-dir/some-image.jpg')); + * } + * header('Content-Type: image/jpeg'); + * echo $image; + * + */ +class Base64 implements \Phalcon\Cache\FrontendInterface +{ + + protected $_frontendOptions; + + + /** + * Phalcon\Cache\Frontend\Base64 constructor + * + * @param array $frontendOptions + */ + public function __construct($frontendOptions = null) {} + + /** + * Returns the cache lifetime + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend. Actually, does nothing in this adapter + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Serializes data before storing them + * + * @param mixed $data + * @return string + */ + public function beforeStore($data) {} + + /** + * Unserializes data after retrieval + * + * @param mixed $data + * @return mixed + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/Data.php b/ide/2.0.8/Phalcon/cache/frontend/Data.php new file mode 100644 index 000000000..8ac044397 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/Data.php @@ -0,0 +1,94 @@ + + * 172800 + * )); + * // Create the component that will cache "Data" to a "File" backend + * // Set the cache file directory - important to keep the "/" at the end of + * // of the value for the folder + * $cache = new \Phalcon\Cache\Backend\File($frontCache, array( + * "cacheDir" => "../app/cache/" + * )); + * // Try to get cached records + * $cacheKey = 'robots_order_id.cache'; + * $robots = $cache->get($cacheKey); + * if ($robots === null) { + * // $robots is null due to cache expiration or data does not exist + * // Make the database call and populate the variable + * $robots = Robots::find(array("order" => "id")); + * // Store it in the cache + * $cache->save($cacheKey, $robots); + * } + * // Use $robots :) + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * + */ +class Data implements \Phalcon\Cache\FrontendInterface +{ + + protected $_frontendOptions; + + + /** + * Phalcon\Cache\Frontend\Data constructor + * + * @param array $frontendOptions + */ + public function __construct($frontendOptions = null) {} + + /** + * Returns the cache lifetime + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend. Actually, does nothing + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Serializes data before storing them + * + * @param mixed $data + */ + public function beforeStore($data) {} + + /** + * Unserializes data after retrieval + * + * @param mixed $data + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/Igbinary.php b/ide/2.0.8/Phalcon/cache/frontend/Igbinary.php new file mode 100644 index 000000000..87c6e7b08 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/Igbinary.php @@ -0,0 +1,92 @@ + + * // Cache the files for 2 days using Igbinary frontend + * $frontCache = new \Phalcon\Cache\Frontend\Igbinary(array( + * "lifetime" => 172800 + * )); + * // Create the component that will cache "Igbinary" to a "File" backend + * // Set the cache file directory - important to keep the "/" at the end of + * // of the value for the folder + * $cache = new \Phalcon\Cache\Backend\File($frontCache, array( + * "cacheDir" => "../app/cache/" + * )); + * // Try to get cached records + * $cacheKey = 'robots_order_id.cache'; + * $robots = $cache->get($cacheKey); + * if ($robots === null) { + * // $robots is null due to cache expiration or data do not exist + * // Make the database call and populate the variable + * $robots = Robots::find(array("order" => "id")); + * // Store it in the cache + * $cache->save($cacheKey, $robots); + * } + * // Use $robots :) + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * + */ +class Igbinary extends \Phalcon\Cache\Frontend\Data implements \Phalcon\Cache\FrontendInterface +{ + + /** + * Phalcon\Cache\Frontend\Data constructor + * + * @param array $frontendOptions + */ + public function __construct($frontendOptions = null) {} + + /** + * Returns the cache lifetime + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend. Actually, does nothing + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Serializes data before storing them + * + * @param mixed $data + * @return string + */ + public function beforeStore($data) {} + + /** + * Unserializes data after retrieval + * + * @param mixed $data + * @return mixed + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/Json.php b/ide/2.0.8/Phalcon/cache/frontend/Json.php new file mode 100644 index 000000000..15661195f --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/Json.php @@ -0,0 +1,89 @@ + + * 172800 + * )); + * //Create the Cache setting memcached connection options + * $cache = new \Phalcon\Cache\Backend\Memcache($frontCache, array( + * 'host' => 'localhost', + * 'port' => 11211, + * 'persistent' => false + * )); + * //Cache arbitrary data + * $cache->save('my-data', array(1, 2, 3, 4, 5)); + * //Get data + * $data = $cache->get('my-data'); + * + */ +class Json implements \Phalcon\Cache\FrontendInterface +{ + + protected $_frontendOptions; + + + /** + * Phalcon\Cache\Frontend\Base64 constructor + * + * @param array $frontendOptions + */ + public function __construct($frontendOptions = null) {} + + /** + * Returns the cache lifetime + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend. Actually, does nothing + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Serializes data before storing them + * + * @param mixed $data + * @return string + */ + public function beforeStore($data) {} + + /** + * Unserializes data after retrieval + * + * @param mixed $data + * @return mixed + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/None.php b/ide/2.0.8/Phalcon/cache/frontend/None.php new file mode 100644 index 000000000..503971960 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/None.php @@ -0,0 +1,83 @@ + + * "localhost", + * "port" => "11211" + * )); + * // This Frontend always return the data as it's returned by the backend + * $cacheKey = 'robots_order_id.cache'; + * $robots = $cache->get($cacheKey); + * if ($robots === null) { + * // This cache doesn't perform any expiration checking, so the data is always expired + * // Make the database call and populate the variable + * $robots = Robots::find(array("order" => "id")); + * $cache->save($cacheKey, $robots); + * } + * // Use $robots :) + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * + */ +class None implements \Phalcon\Cache\FrontendInterface +{ + + /** + * Returns cache lifetime, always one second expiring content + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output, always false + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Prepare data to be stored + * + * @param mixed $data + * @param mixed $$data + */ + public function beforeStore($data) {} + + /** + * Prepares data to be retrieved to user + * + * @param mixed $data + * @param mixed $$data + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cache/frontend/Output.php b/ide/2.0.8/Phalcon/cache/frontend/Output.php new file mode 100644 index 000000000..2c368bb07 --- /dev/null +++ b/ide/2.0.8/Phalcon/cache/frontend/Output.php @@ -0,0 +1,105 @@ + + * 172800 + * )); + * // Create the component that will cache from the "Output" to a "File" backend + * // Set the cache file directory - it's important to keep the "/" at the end of + * // the value for the folder + * $cache = new \Phalcon\Cache\Backend\File($frontCache, array( + * "cacheDir" => "../app/cache/" + * )); + * // Get/Set the cache file to ../app/cache/my-cache.html + * $content = $cache->start("my-cache.html"); + * // If $content is null then the content will be generated for the cache + * if ($content === null) { + * //Print date and time + * echo date("r"); + * //Generate a link to the sign-up action + * echo Phalcon\Tag::linkTo( + * array( + * "user/signup", + * "Sign Up", + * "class" => "signup-button" + * ) + * ); + * // Store the output into the cache file + * $cache->save(); + * } else { + * // Echo the cached output + * echo $content; + * } + * + */ +class Output implements \Phalcon\Cache\FrontendInterface +{ + + protected $_buffering = false; + + + protected $_frontendOptions; + + + /** + * Phalcon\Cache\Frontend\Output constructor + * + * @param array $frontendOptions + */ + public function __construct($frontendOptions = null) {} + + /** + * Returns the cache lifetime + * + * @return int + */ + public function getLifetime() {} + + /** + * Check whether if frontend is buffering output + * + * @return bool + */ + public function isBuffering() {} + + /** + * Starts output frontend. Currently, does nothing + */ + public function start() {} + + /** + * Returns output cached content + * + * @return string + */ + public function getContent() {} + + /** + * Stops output frontend + */ + public function stop() {} + + /** + * Serializes data before storing them + * + * @param mixed $data + * @return string + */ + public function beforeStore($data) {} + + /** + * Unserializes data after retrieval + * + * @param mixed $data + * @return mixed + */ + public function afterRetrieve($data) {} + +} diff --git a/ide/2.0.8/Phalcon/cli/Console.php b/ide/2.0.8/Phalcon/cli/Console.php new file mode 100644 index 000000000..34ff3f6c6 --- /dev/null +++ b/ide/2.0.8/Phalcon/cli/Console.php @@ -0,0 +1,123 @@ + + * $application->registerModules(array( + * 'frontend' => array( + * 'className' => 'Multiple\Frontend\Module', + * 'path' => '../apps/frontend/Module.php' + * ), + * 'backend' => array( + * 'className' => 'Multiple\Backend\Module', + * 'path' => '../apps/backend/Module.php' + * ) + * )); + * + * + * @param array $modules + */ + public function registerModules($modules) {} + + /** + * Merge modules with the existing ones + * + * application->addModules(array( + * 'admin' => array( + * 'className' => 'Multiple\Admin\Module', + * 'path' => '../apps/admin/Module.php' + * ) + * )); + * + * + * @param array $modules + */ + public function addModules($modules) {} + + /** + * Return the modules registered in the console + * + * @return array + */ + public function getModules() {} + + /** + * Handle the whole command-line tasks + * + * @param array $arguments + */ + public function handle($arguments = null) {} + + /** + * Set an specific argument + * + * @param array $arguments + * @param bool $str + * @param bool $shift + * @return Console + */ + public function setArgument($arguments = null, $str = true, $shift = true) {} + +} diff --git a/ide/2.0.8/Phalcon/cli/Dispatcher.php b/ide/2.0.8/Phalcon/cli/Dispatcher.php new file mode 100644 index 000000000..9af6c4e3f --- /dev/null +++ b/ide/2.0.8/Phalcon/cli/Dispatcher.php @@ -0,0 +1,111 @@ + + * $di = new \Phalcon\Di(); + * $dispatcher = new \Phalcon\Cli\Dispatcher(); + * $dispatcher->setDi(di); + * $dispatcher->setTaskName('posts'); + * $dispatcher->setActionName('index'); + * $dispatcher->setParams(array()); + * $handle = dispatcher->dispatch(); + * + */ +class Dispatcher extends \Phalcon\Dispatcher +{ + + protected $_handlerSuffix = "Task"; + + + protected $_defaultHandler = "main"; + + + protected $_defaultAction = "main"; + + + protected $_options; + + + /** + * Phalcon\Cli\Dispatcher constructor + */ + public function __construct() {} + + /** + * Sets the default task suffix + * + * @param string $taskSuffix + */ + public function setTaskSuffix($taskSuffix) {} + + /** + * Sets the default task name + * + * @param string $taskName + */ + public function setDefaultTask($taskName) {} + + /** + * Sets the task name to be dispatched + * + * @param string $taskName + */ + public function setTaskName($taskName) {} + + /** + * Gets last dispatched task name + * + * @return string + */ + public function getTaskName() {} + + /** + * Throws an internal exception + * + * @param string $message + * @param int $exceptionCode + */ + protected function _throwDispatchException($message, $exceptionCode = 0) {} + + /** + * Handles a user exception + * + * @param mixed $exception + */ + protected function _handleException(\Exception $exception) {} + + /** + * Returns the lastest dispatched controller + * + * @return \Phalcon\Cli\Task + */ + public function getLastTask() {} + + /** + * Returns the active task in the dispatcher + * + * @return \Phalcon\Cli\Task + */ + public function getActiveTask() {} + + /** + * Set the options to be dispatched + * + * @param array $options + */ + public function setOptions($options) {} + + /** + * Get dispatched options + * + * @return array + */ + public function getOptions() {} + +} diff --git a/ide/2.0.8/Phalcon/cli/Router.php b/ide/2.0.8/Phalcon/cli/Router.php new file mode 100644 index 000000000..57c6a3f88 --- /dev/null +++ b/ide/2.0.8/Phalcon/cli/Router.php @@ -0,0 +1,211 @@ +Phalcon\Cli\Router is the standard framework router. Routing is the + * process of taking a command-line arguments and + * decomposing it into parameters to determine which module, task, and + * action of that task should receive the request

+ * + * $router = new \Phalcon\Cli\Router(); + * $router->handle(array( + * 'module' => 'main', + * 'task' => 'videos', + * 'action' => 'process' + * )); + * echo $router->getTaskName(); + * + */ +class Router implements \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_module; + + + protected $_task; + + + protected $_action; + + + protected $_params; + + + protected $_defaultModule = null; + + + protected $_defaultTask = null; + + + protected $_defaultAction = null; + + + protected $_defaultParams; + + + protected $_routes; + + + protected $_matchedRoute; + + + protected $_matches; + + + protected $_wasMatched = false; + + + /** + * Phalcon\Cli\Router constructor + * + * @param bool $defaultRoutes + */ + public function __construct($defaultRoutes = true) {} + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the name of the default module + * + * @param string $moduleName + */ + public function setDefaultModule($moduleName) {} + + /** + * Sets the default controller name + * + * @param string $taskName + */ + public function setDefaultTask($taskName) {} + + /** + * Sets the default action name + * + * @param string $actionName + */ + public function setDefaultAction($actionName) {} + + /** + * Sets an array of default paths. If a route is missing a path the router will use the defined here + * This method must not be used to set a 404 route + * + * $router->setDefaults(array( + * 'module' => 'common', + * 'action' => 'index' + * )); + * + * + * @param array $defaults + * @return Router + */ + public function setDefaults($defaults) {} + + /** + * Handles routing information received from command-line arguments + * + * @param array $arguments + */ + public function handle($arguments = null) {} + + /** + * Adds a route to the router + * + * $router->add('/about', 'About::main'); + * + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Cli\Router\Route + */ + public function add($pattern, $paths = null) {} + + /** + * Returns proccesed module name + * + * @return string + */ + public function getModuleName() {} + + /** + * Returns proccesed task name + * + * @return string + */ + public function getTaskName() {} + + /** + * Returns proccesed action name + * + * @return string + */ + public function getActionName() {} + + /** + * Returns proccesed extra params + * + * @return array + */ + public function getParams() {} + + /** + * Returns the route that matchs the handled URI + * + * @return \Phalcon\Cli\Router\Route + */ + public function getMatchedRoute() {} + + /** + * Returns the sub expressions in the regular expression matched + * + * @return array + */ + public function getMatches() {} + + /** + * Checks if the router macthes any of the defined routes + * + * @return bool + */ + public function wasMatched() {} + + /** + * Returns all the routes defined in the router + * + * @return \Phalcon\Cli\Router\Route + */ + public function getRoutes() {} + + /** + * Returns a route object by its id + * + * @param int $id + * @return \Phalcon\Cli\Router\Route + */ + public function getRouteById($id) {} + + /** + * Returns a route object by its name + * + * @param string $name + * @return bool|\Phalcon\Cli\Router\Route + */ + public function getRouteByName($name) {} + +} diff --git a/ide/2.0.8/Phalcon/cli/Task.php b/ide/2.0.8/Phalcon/cli/Task.php new file mode 100644 index 000000000..5a8d068e5 --- /dev/null +++ b/ide/2.0.8/Phalcon/cli/Task.php @@ -0,0 +1,31 @@ + + * class HelloTask extends \Phalcon\Cli\Task + * { + * //This action will be executed by default + * public function mainAction() + * { + * } + * public function findAction() + * { + * } + * } + * + */ +class Task extends \Phalcon\Di\Injectable +{ + + /** + * Phalcon\Cli\Task constructor + */ + public final function __construct() {} + +} diff --git a/ide/2.0.8/Phalcon/cli/console/Exception.php b/ide/2.0.8/Phalcon/cli/console/Exception.php new file mode 100644 index 000000000..91718714c --- /dev/null +++ b/ide/2.0.8/Phalcon/cli/console/Exception.php @@ -0,0 +1,12 @@ + + * $router->add('/about', array( + * 'controller' => 'about' + * ))->setName('about'); + * + * + * @param string $name + * @return Route + */ + public function setName($name) {} + + /** + * Sets a callback that is called if the route is matched. + * The developer can implement any arbitrary conditions here + * If the callback returns false the route is treated as not matched + * + * @param callback $callback + * @return \Phalcon\Cli\Router\Route + */ + public function beforeMatch($callback) {} + + /** + * Returns the 'before match' callback if any + * + * @return mixed + */ + public function getBeforeMatch() {} + + /** + * Returns the route's id + * + * @return string + */ + public function getRouteId() {} + + /** + * Returns the route's pattern + * + * @return string + */ + public function getPattern() {} + + /** + * Returns the route's compiled pattern + * + * @return string + */ + public function getCompiledPattern() {} + + /** + * Returns the paths + * + * @return array + */ + public function getPaths() {} + + /** + * Returns the paths using positions as keys and names as values + * + * @return array + */ + public function getReversedPaths() {} + + /** + * Adds a converter to perform an additional transformation for certain parameter + * + * @param string $name + * @param callable $converter + * @return \Phalcon\Cli\Router\Route + */ + public function convert($name, $converter) {} + + /** + * Returns the router converter + * + * @return array + */ + public function getConverters() {} + + /** + * Resets the internal route id generator + */ + public static function reset() {} + + /** + * Set the routing delimiter + * + * @param string $delimiter + */ + public static function delimiter($delimiter = null) {} + + /** + * Get routing delimiter + * + * @return string + */ + public static function getDelimiter() {} + +} diff --git a/ide/2.0.8/Phalcon/config/Exception.php b/ide/2.0.8/Phalcon/config/Exception.php new file mode 100644 index 000000000..a6f27ac66 --- /dev/null +++ b/ide/2.0.8/Phalcon/config/Exception.php @@ -0,0 +1,12 @@ + + * [database] + * adapter = Mysql + * host = localhost + * username = scott + * password = cheetah + * dbname = test_db + * [phalcon] + * controllersDir = "../app/controllers/" + * modelsDir = "../app/models/" + * viewsDir = "../app/views/" + * + * You can read it as follows: + * + * $config = new Phalcon\Config\Adapter\Ini("path/config.ini"); + * echo $config->phalcon->controllersDir; + * echo $config->database->username; + * + */ +class Ini extends \Phalcon\Config +{ + + /** + * Phalcon\Config\Adapter\Ini constructor + * + * @param string $filePath + */ + public function __construct($filePath) {} + + /** + * Build multidimensional array from string + * + * $this->_parseIniString('path.hello.world', 'value for last key'); + * // result + * [ + * 'path' => [ + * 'hello' => [ + * 'world' => 'value for last key', + * ], + * ], + * ]; + * + * + * @param string $path + * @param mixed $value + * @return array + */ + protected function _parseIniString($path, $value) {} + +} diff --git a/ide/2.0.8/Phalcon/config/adapter/Json.php b/ide/2.0.8/Phalcon/config/adapter/Json.php new file mode 100644 index 000000000..5ee81e9f3 --- /dev/null +++ b/ide/2.0.8/Phalcon/config/adapter/Json.php @@ -0,0 +1,29 @@ + + * {"phalcon":{"baseuri":"\/phalcon\/"},"models":{"metadata":"memory"}} + * + * You can read it as follows: + * + * $config = new Phalcon\Config\Adapter\Json("path/config.json"); + * echo $config->phalcon->baseuri; + * echo $config->models->metadata; + * + */ +class Json extends \Phalcon\Config +{ + + /** + * Phalcon\Config\Adapter\Json constructor + * + * @param string $filePath + */ + public function __construct($filePath) {} + +} diff --git a/ide/2.0.8/Phalcon/config/adapter/Php.php b/ide/2.0.8/Phalcon/config/adapter/Php.php new file mode 100644 index 000000000..1627f9246 --- /dev/null +++ b/ide/2.0.8/Phalcon/config/adapter/Php.php @@ -0,0 +1,42 @@ + + * array( + * 'adapter' => 'Mysql', + * 'host' => 'localhost', + * 'username' => 'scott', + * 'password' => 'cheetah', + * 'dbname' => 'test_db' + * ), + * 'phalcon' => array( + * 'controllersDir' => '../app/controllers/', + * 'modelsDir' => '../app/models/', + * 'viewsDir' => '../app/views/' + * )); + * + * You can read it as follows: + * + * $config = new Phalcon\Config\Adapter\Php("path/config.php"); + * echo $config->phalcon->controllersDir; + * echo $config->database->username; + * + */ +class Php extends \Phalcon\Config +{ + + /** + * Phalcon\Config\Adapter\Php constructor + * + * @param string $filePath + */ + public function __construct($filePath) {} + +} diff --git a/ide/2.0.8/Phalcon/config/adapter/Yaml.php b/ide/2.0.8/Phalcon/config/adapter/Yaml.php new file mode 100644 index 000000000..b822f3380 --- /dev/null +++ b/ide/2.0.8/Phalcon/config/adapter/Yaml.php @@ -0,0 +1,41 @@ + + * phalcon: + * baseuri: /phalcon/ + * controllersDir: !approot /app/controllers/ + * models: + * metadata: memory + * + * You can read it as follows: + * + * define('APPROOT', dirname(__DIR__)); + * $config = new Phalcon\Config\Adapter\Yaml("path/config.yaml", [ + * '!approot' => function($value) { + * return APPROOT . $value; + * } + * ]); + * echo $config->phalcon->controllersDir; + * echo $config->phalcon->baseuri; + * echo $config->models->metadata; + * + */ +class Yaml extends \Phalcon\Config +{ + + /** + * Phalcon\Config\Adapter\Yaml constructor + * + * @throws \Phalcon\Config\Exception + * @param string $filePath + * @param array $callbacks + */ + public function __construct($filePath, $callbacks = null) {} + +} diff --git a/ide/2.0.8/Phalcon/crypt/Exception.php b/ide/2.0.8/Phalcon/crypt/Exception.php new file mode 100644 index 000000000..5af7d614f --- /dev/null +++ b/ide/2.0.8/Phalcon/crypt/Exception.php @@ -0,0 +1,12 @@ + + * //Getting first robot + * $robot = $connection->fetchOne("SELECTFROM robots"); + * print_r($robot); + * //Getting first robot with associative indexes only + * $robot = $connection->fetchOne("SELECTFROM robots", Phalcon\Db::FETCH_ASSOC); + * print_r($robot); + * + * + * @param string $sqlQuery + * @param mixed $fetchMode + * @param mixed $bindParams + * @param mixed $bindTypes + * @return array + */ + public function fetchOne($sqlQuery, $fetchMode = Db::FETCH_ASSOC, $bindParams = null, $bindTypes = null) {} + + /** + * Dumps the complete result of a query into an array + * + * //Getting all robots with associative indexes only + * $robots = $connection->fetchAll("SELECTFROM robots", Phalcon\Db::FETCH_ASSOC); + * foreach ($robots as $robot) { + * print_r($robot); + * } + * //Getting all robots that contains word "robot" withing the name + * $robots = $connection->fetchAll("SELECTFROM robots WHERE name LIKE :name", + * Phalcon\Db::FETCH_ASSOC, + * array('name' => '%robot%') + * ); + * foreach($robots as $robot){ + * print_r($robot); + * } + * + * + * @param string $sqlQuery + * @param int $fetchMode + * @param array $bindParams + * @param array $bindTypes + * @return array + */ + public function fetchAll($sqlQuery, $fetchMode = Db::FETCH_ASSOC, $bindParams = null, $bindTypes = null) {} + + /** + * Returns the n'th field of first row in a SQL query result + * + * //Getting count of robots + * $robotsCount = $connection->fetchColumn("SELECT count(*) FROM robots"); + * print_r($robotsCount); + * //Getting name of last edited robot + * $robot = $connection->fetchColumn("SELECT id, name FROM robots order by modified desc", 1); + * print_r($robot); + * + * + * @param string $sqlQuery + * @param array $placeholders + * @param int|string $column + * @return string| + */ + public function fetchColumn($sqlQuery, $placeholders = null, $column = 0) {} + + /** + * Inserts data into a table using custom RBDM SQL syntax + * + * // Inserting a new robot + * $success = $connection->insert( + * "robots", + * array("Astro Boy", 1952), + * array("name", "year") + * ); + * // Next SQL sentence is sent to the database system + * INSERT INTO `robots` (`name`, `year`) VALUES ("Astro boy", 1952); + * + * + * @param string|array $table + * @param array $values + * @param mixed $fields + * @param mixed $dataTypes + * @param $array dataTypes + * @return + */ + public function insert($table, $values, $fields = null, $dataTypes = null) {} + + /** + * Inserts data into a table using custom RBDM SQL syntax + * + * //Inserting a new robot + * $success = $connection->insertAsDict( + * "robots", + * array( + * "name" => "Astro Boy", + * "year" => 1952 + * ) + * ); + * //Next SQL sentence is sent to the database system + * INSERT INTO `robots` (`name`, `year`) VALUES ("Astro boy", 1952); + * + * + * @param mixed $table + * @param mixed $data + * @param mixed $dataTypes + * @param $string table + * @param $array dataTypes + * @return + */ + public function insertAsDict($table, $data, $dataTypes = null) {} + + /** + * Updates data on a table using custom RBDM SQL syntax + * + * //Updating existing robot + * $success = $connection->update( + * "robots", + * array("name"), + * array("New Astro Boy"), + * "id = 101" + * ); + * //Next SQL sentence is sent to the database system + * UPDATE `robots` SET `name` = "Astro boy" WHERE id = 101 + * //Updating existing robot with array condition and $dataTypes + * $success = $connection->update( + * "robots", + * array("name"), + * array("New Astro Boy"), + * array( + * 'conditions' => "id = ?", + * 'bind' => array($some_unsafe_id), + * 'bindTypes' => array(PDO::PARAM_INT) //use only if you use $dataTypes param + * ), + * array(PDO::PARAM_STR) + * ); + * + * Warning! If $whereCondition is string it not escaped. + * + * @param string|array $table + * @param mixed $fields + * @param mixed $values + * @param mixed $whereCondition + * @param mixed $dataTypes + * @param $array dataTypes + * @param $string|array whereCondition + * @return + */ + public function update($table, $fields, $values, $whereCondition = null, $dataTypes = null) {} + + /** + * Updates data on a table using custom RBDM SQL syntax + * Another, more convenient syntax + * + * //Updating existing robot + * $success = $connection->update( + * "robots", + * array( + * "name" => "New Astro Boy" + * ), + * "id = 101" + * ); + * //Next SQL sentence is sent to the database system + * UPDATE `robots` SET `name` = "Astro boy" WHERE id = 101 + * + * + * @param mixed $table + * @param mixed $data + * @param mixed $whereCondition + * @param mixed $dataTypes + * @param $string whereCondition + * @param $array dataTypes + * @return + */ + public function updateAsDict($table, $data, $whereCondition = null, $dataTypes = null) {} + + /** + * Deletes data from a table using custom RBDM SQL syntax + * + * //Deleting existing robot + * $success = $connection->delete( + * "robots", + * "id = 101" + * ); + * //Next SQL sentence is generated + * DELETE FROM `robots` WHERE `id` = 101 + * + * + * @param string|array $table + * @param string $whereCondition + * @param array $placeholders + * @param array $dataTypes + * @return boolean + */ + public function delete($table, $whereCondition = null, $placeholders = null, $dataTypes = null) {} + + /** + * Gets a list of columns + * + * @param array columnList + * @return string + * @param mixed $columnList + * @return string + */ + public function getColumnList($columnList) {} + + /** + * Appends a LIMIT clause to $sqlQuery argument + * + * echo $connection->limit("SELECTFROM robots", 5); + * + * + * @param string $sqlQuery + * @param int $number + * @return string + */ + public function limit($sqlQuery, $number) {} + + /** + * Generates SQL checking for the existence of a schema.table + * + * var_dump($connection->tableExists("blog", "posts")); + * + * + * @param string $tableName + * @param string $schemaName + * @return bool + */ + public function tableExists($tableName, $schemaName = null) {} + + /** + * Generates SQL checking for the existence of a schema.view + * + * var_dump($connection->viewExists("active_users", "posts")); + * + * + * @param string $viewName + * @param string $schemaName + * @return bool + */ + public function viewExists($viewName, $schemaName = null) {} + + /** + * Returns a SQL modified with a FOR UPDATE clause + * + * @param string $sqlQuery + * @return string + */ + public function forUpdate($sqlQuery) {} + + /** + * Returns a SQL modified with a LOCK IN SHARE MODE clause + * + * @param string $sqlQuery + * @return string + */ + public function sharedLock($sqlQuery) {} + + /** + * Creates a table + * + * @param string $tableName + * @param string $schemaName + * @param array $definition + * @return bool + */ + public function createTable($tableName, $schemaName, $definition) {} + + /** + * Drops a table from a schema/database + * + * @param string $tableName + * @param string $schemaName + * @param bool $ifExists + * @return bool + */ + public function dropTable($tableName, $schemaName = null, $ifExists = true) {} + + /** + * Creates a view + * + * @param string $viewName + * @param array $definition + * @param mixed $schemaName + * @return bool + */ + public function createView($viewName, $definition, $schemaName = null) {} + + /** + * Drops a view + * + * @param string $viewName + * @param string $schemaName + * @param bool $ifExists + * @return bool + */ + public function dropView($viewName, $schemaName = null, $ifExists = true) {} + + /** + * Adds a column to a table + * + * @param string $tableName + * @param string $schemaName + * @param mixed $column + * @return bool + */ + public function addColumn($tableName, $schemaName, \Phalcon\Db\ColumnInterface $column) {} + + /** + * Modifies a table column based on a definition + * + * @param string $tableName + * @param string $schemaName + * @param mixed $column + * @param mixed $currentColumn + * @return bool + */ + public function modifyColumn($tableName, $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null) {} + + /** + * Drops a column from a table + * + * @param string $tableName + * @param string $schemaName + * @param string $columnName + * @return bool + */ + public function dropColumn($tableName, $schemaName, $columnName) {} + + /** + * Adds an index to a table + * + * @param string $tableName + * @param string $schemaName + * @param mixed $index + * @return bool + */ + public function addIndex($tableName, $schemaName, IndexInterface $index) {} + + /** + * Drop an index from a table + * + * @param string $tableName + * @param string $schemaName + * @param mixed $indexName + * @return bool + */ + public function dropIndex($tableName, $schemaName, $indexName) {} + + /** + * Adds a primary key to a table + * + * @param string $tableName + * @param string $schemaName + * @param mixed $index + * @return bool + */ + public function addPrimaryKey($tableName, $schemaName, IndexInterface $index) {} + + /** + * Drops a table's primary key + * + * @param string $tableName + * @param string $schemaName + * @return bool + */ + public function dropPrimaryKey($tableName, $schemaName) {} + + /** + * Adds a foreign key to a table + * + * @param string $tableName + * @param string $schemaName + * @param mixed $reference + * @return bool + */ + public function addForeignKey($tableName, $schemaName, ReferenceInterface $reference) {} + + /** + * Drops a foreign key from a table + * + * @param string $tableName + * @param string $schemaName + * @param string $referenceName + * @return bool + */ + public function dropForeignKey($tableName, $schemaName, $referenceName) {} + + /** + * Returns the SQL column definition from a column + * + * @param mixed $column + * @return string + */ + public function getColumnDefinition(\Phalcon\Db\ColumnInterface $column) {} + + /** + * List all tables on a database + * + * print_r($connection->listTables("blog")); + * + * + * @param string $schemaName + * @return array + */ + public function listTables($schemaName = null) {} + + /** + * List all views on a database + * + * print_r($connection->listViews("blog")); + * + * + * @param string $schemaName + * @return array + */ + public function listViews($schemaName = null) {} + + /** + * Lists table indexes + * + * print_r($connection->describeIndexes('robots_parts')); + * + * + * @param string table + * @param string schema + * @return Phalcon\Db\Index[] + * @param string $table + * @param mixed $schema + * @return Index + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Lists table references + * + * print_r($connection->describeReferences('robots_parts')); + * + * + * @param string $table + * @param string $schema + * @return Reference + */ + public function describeReferences($table, $schema = null) {} + + /** + * Gets creation options from a table + * + * print_r($connection->tableOptions('robots')); + * + * + * @param string $tableName + * @param string $schemaName + * @return array + */ + public function tableOptions($tableName, $schemaName = null) {} + + /** + * Creates a new savepoint + * + * @param string $name + * @return bool + */ + public function createSavepoint($name) {} + + /** + * Releases given savepoint + * + * @param string $name + * @return bool + */ + public function releaseSavepoint($name) {} + + /** + * Rollbacks given savepoint + * + * @param string $name + * @return bool + */ + public function rollbackSavepoint($name) {} + + /** + * Set if nested transactions should use savepoints + * + * @param bool $nestedTransactionsWithSavepoints + * @return AdapterInterface + */ + public function setNestedTransactionsWithSavepoints($nestedTransactionsWithSavepoints) {} + + /** + * Returns if nested transactions should use savepoints + * + * @return bool + */ + public function isNestedTransactionsWithSavepoints() {} + + /** + * Returns the savepoint name to use for nested transactions + * + * @return string + */ + public function getNestedTransactionSavepointName() {} + + /** + * Returns the default identity value to be inserted in an identity column + * + * //Inserting a new robot with a valid default value for the column 'id' + * $success = $connection->insert( + * "robots", + * array($connection->getDefaultIdValue(), "Astro Boy", 1952), + * array("id", "name", "year") + * ); + * + * + * @return RawValue + */ + public function getDefaultIdValue() {} + + /** + * Returns the default value to make the RBDM use the default value declared in the table definition + * + * //Inserting a new robot with a valid default value for the column 'year' + * $success = $connection->insert( + * "robots", + * array("Astro Boy", $connection->getDefaultValue()), + * array("name", "year") + * ); + * + * + * @return RawValue + */ + public function getDefaultValue() {} + + /** + * Check whether the database system requires a sequence to produce auto-numeric values + * + * @return bool + */ + public function supportSequences() {} + + /** + * Check whether the database system requires an explicit value for identity columns + * + * @return bool + */ + public function useExplicitIdValue() {} + + /** + * Return descriptor used to connect to the active database + * + * @return array + */ + public function getDescriptor() {} + + /** + * Gets the active connection unique identifier + * + * @return string + */ + public function getConnectionId() {} + + /** + * Active SQL statement in the object + * + * @return string + */ + public function getSQLStatement() {} + + /** + * Active SQL statement in the object without replace bound paramters + * + * @return string + */ + public function getRealSQLStatement() {} + + /** + * Active SQL statement in the object + * + * @return array + */ + public function getSQLBindTypes() {} + +} diff --git a/ide/2.0.8/Phalcon/db/AdapterInterface.php b/ide/2.0.8/Phalcon/db/AdapterInterface.php new file mode 100644 index 000000000..7726f24de --- /dev/null +++ b/ide/2.0.8/Phalcon/db/AdapterInterface.php @@ -0,0 +1,559 @@ + + * use Phalcon\Db\Column as Column; + * //column definition + * $column = new Column("id", array( + * "type" => Column::TYPE_INTEGER, + * "size" => 10, + * "unsigned" => true, + * "notNull" => true, + * "autoIncrement" => true, + * "first" => true + * )); + * //add column to existing table + * $connection->addColumn("robots", null, $column); + * + */ +class Column implements \Phalcon\Db\ColumnInterface +{ + /** + * Integer abstract type + */ + const TYPE_INTEGER = 0; + + /** + * Date abstract type + */ + const TYPE_DATE = 1; + + /** + * Varchar abstract type + */ + const TYPE_VARCHAR = 2; + + /** + * Decimal abstract type + */ + const TYPE_DECIMAL = 3; + + /** + * Datetime abstract type + */ + const TYPE_DATETIME = 4; + + /** + * Char abstract type + */ + const TYPE_CHAR = 5; + + /** + * Text abstract data type + */ + const TYPE_TEXT = 6; + + /** + * Float abstract data type + */ + const TYPE_FLOAT = 7; + + /** + * Boolean abstract data type + */ + const TYPE_BOOLEAN = 8; + + /** + * Double abstract data type + */ + const TYPE_DOUBLE = 9; + + /** + * Tinyblob abstract data type + */ + const TYPE_TINYBLOB = 10; + + /** + * Blob abstract data type + */ + const TYPE_BLOB = 11; + + /** + * Mediumblob abstract data type + */ + const TYPE_MEDIUMBLOB = 12; + + /** + * Longblob abstract data type + */ + const TYPE_LONGBLOB = 13; + + /** + * Big integer abstract type + */ + const TYPE_BIGINTEGER = 14; + + /** + * Json abstract type + */ + const TYPE_JSON = 15; + + /** + * Jsonb abstract type + */ + const TYPE_JSONB = 16; + + /** + * Datetime abstract type + */ + const TYPE_TIMESTAMP = 17; + + /** + * Bind Type Null + */ + const BIND_PARAM_NULL = 0; + + /** + * Bind Type Integer + */ + const BIND_PARAM_INT = 1; + + /** + * Bind Type String + */ + const BIND_PARAM_STR = 2; + + /** + * Bind Type Blob + */ + const BIND_PARAM_BLOB = 3; + + /** + * Bind Type Bool + */ + const BIND_PARAM_BOOL = 5; + + /** + * Bind Type Decimal + */ + const BIND_PARAM_DECIMAL = 32; + + /** + * Skip binding by type + */ + const BIND_SKIP = 1024; + + /** + * Column's name + * + * @var string + */ + protected $_name; + + /** + * Schema which table related is + * + * @var string + */ + protected $_schemaName; + + /** + * Column data type + * + * @var int|string + */ + protected $_type; + + /** + * Column data type reference + * + * @var int + */ + protected $_typeReference; + + /** + * Column data type values + * + * @var array|string + */ + protected $_typeValues; + + /** + * The column have some numeric type? + */ + protected $_isNumeric = false; + + /** + * Integer column size + * + * @var int + */ + protected $_size = 0; + + /** + * Integer column number scale + * + * @var int + */ + protected $_scale = 0; + + /** + * Default column value + */ + protected $_default = null; + + /** + * Integer column unsigned? + * + * @var boolean + */ + protected $_unsigned = false; + + /** + * Column not nullable? + * + * @var boolean + */ + protected $_notNull = false; + + /** + * Column is part of the primary key? + */ + protected $_primary = false; + + /** + * Column is autoIncrement? + * + * @var boolean + */ + protected $_autoIncrement = false; + + /** + * Position is first + * + * @var boolean + */ + protected $_first = false; + + /** + * Column Position + * + * @var string + */ + protected $_after; + + /** + * Bind Type + */ + protected $_bindType = 2; + + + /** + * Column's name + * + * @return string + */ + public function getName() {} + + /** + * Schema which table related is + * + * @return string + */ + public function getSchemaName() {} + + /** + * Column data type + * + * @return int|string + */ + public function getType() {} + + /** + * Column data type reference + * + * @return int + */ + public function getTypeReference() {} + + /** + * Column data type values + * + * @return array|string + */ + public function getTypeValues() {} + + /** + * Integer column size + * + * @return int + */ + public function getSize() {} + + /** + * Integer column number scale + * + * @return int + */ + public function getScale() {} + + /** + * Default column value + */ + public function getDefault() {} + + /** + * Phalcon\Db\Column constructor + * + * @param string $name + * @param array $definition + */ + public function __construct($name, $definition) {} + + /** + * Returns true if number column is unsigned + * + * @return bool + */ + public function isUnsigned() {} + + /** + * Not null + * + * @return bool + */ + public function isNotNull() {} + + /** + * Column is part of the primary key? + * + * @return bool + */ + public function isPrimary() {} + + /** + * Auto-Increment + * + * @return bool + */ + public function isAutoIncrement() {} + + /** + * Check whether column have an numeric type + * + * @return bool + */ + public function isNumeric() {} + + /** + * Check whether column have first position in table + * + * @return bool + */ + public function isFirst() {} + + /** + * Check whether field absolute to position in table + * + * @return string + */ + public function getAfterPosition() {} + + /** + * Returns the type of bind handling + * + * @return int + */ + public function getBindType() {} + + /** + * Restores the internal state of a Phalcon\Db\Column object + * + * @param array $data + * @return Column + */ + public static function __set_state($data) {} + + /** + * Check whether column has default value + * + * @return bool + */ + public function hasDefault() {} + +} diff --git a/ide/2.0.8/Phalcon/db/ColumnInterface.php b/ide/2.0.8/Phalcon/db/ColumnInterface.php new file mode 100644 index 000000000..eedb016d7 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/ColumnInterface.php @@ -0,0 +1,147 @@ + + * $sql = $dialect->limit('SELECTFROM robots', 10); + * echo $sql; // SELECTFROM robots LIMIT 10 + * $sql = $dialect->limit('SELECTFROM robots', [10, 50]); + * echo $sql; // SELECTFROM robots LIMIT 10 OFFSET 50 + * + * + * @param string $sqlQuery + * @param mixed $number + * @return string + */ + public function limit($sqlQuery, $number) {} + + /** + * Returns a SQL modified with a FOR UPDATE clause + * + * $sql = $dialect->forUpdate('SELECTFROM robots'); + * echo $sql; // SELECTFROM robots FOR UPDATE + * + * + * @param string $sqlQuery + * @return string + */ + public function forUpdate($sqlQuery) {} + + /** + * Returns a SQL modified with a LOCK IN SHARE MODE clause + * + * $sql = $dialect->sharedLock('SELECTFROM robots'); + * echo $sql; // SELECTFROM robots LOCK IN SHARE MODE + * + * + * @param string $sqlQuery + * @return string + */ + public function sharedLock($sqlQuery) {} + + /** + * Gets a list of columns with escaped identifiers + * + * echo $dialect->getColumnList(array('column1', 'column')); + * + * + * @param array $columnList + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + public final function getColumnList($columnList, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve Column expressions + * + * @param mixed $column + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + public final function getSqlColumn($column, $escapeChar = null, $bindCounts = null) {} + + /** + * Transforms an intermediate representation for a expression into a database system valid expression + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + public function getSqlExpression($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Transform an intermediate representation of a schema/table into a database system valid expression + * + * @param mixed $table + * @param string $escapeChar + * @return string + */ + public final function getSqlTable($table, $escapeChar = null) {} + + /** + * Builds a SELECT statement + * + * @param array $definition + * @return string + */ + public function select($definition) {} + + /** + * Checks whether the platform supports savepoints + * + * @return bool + */ + public function supportsSavepoints() {} + + /** + * Checks whether the platform supports releasing savepoints. + * + * @return bool + */ + public function supportsReleaseSavepoints() {} + + /** + * Generate SQL to create a new savepoint + * + * @param string $name + * @return string + */ + public function createSavepoint($name) {} + + /** + * Generate SQL to release a savepoint + * + * @param string $name + * @return string + */ + public function releaseSavepoint($name) {} + + /** + * Generate SQL to rollback a savepoint + * + * @param string $name + * @return string + */ + public function rollbackSavepoint($name) {} + + /** + * Resolve Column expressions + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionScalar($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve object expressions + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionObject($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve qualified expressions + * + * @param array $expression + * @param string $escapeChar + * @return string + */ + protected final function getSqlExpressionQualified($expression, $escapeChar = null) {} + + /** + * Resolve binary operations expressions + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionBinaryOperations($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve unary operations expressions + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionUnaryOperations($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve function calls + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionFunctionCall($expression, $escapeChar = null, $bindCounts) {} + + /** + * Resolve Lists + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionList($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve + * + * @param array $expression + * @param string $escapeChar + * @return string + */ + protected final function getSqlExpressionAll($expression, $escapeChar = null) {} + + /** + * Resolve CAST of values + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionCastValue($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve CONVERT of values encodings + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionConvertValue($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve CASE expressions + * + * @param array $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionCase($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a FROM clause + * + * @param mixed $expression + * @param string $escapeChar + * @return string + */ + protected final function getSqlExpressionFrom($expression, $escapeChar = null) {} + + /** + * Resolve a JOINs clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionJoins($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a WHERE clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionWhere($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a GROUP BY clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionGroupBy($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a HAVING clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionHaving($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a ORDER BY clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionOrderBy($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Resolve a LIMIT clause + * + * @param mixed $expression + * @param string $escapeChar + * @param mixed $bindCounts + * @return string + */ + protected final function getSqlExpressionLimit($expression, $escapeChar = null, $bindCounts = null) {} + + /** + * Prepares column for this RDBMS + * + * @param string $qualified + * @param string $alias + * @param string $escapeChar + * @return string + */ + protected function prepareColumnAlias($qualified, $alias = null, $escapeChar = null) {} + + /** + * Prepares table for this RDBMS + * + * @param string $table + * @param string $schema + * @param string $alias + * @param string $escapeChar + * @return string + */ + protected function prepareTable($table, $schema = null, $alias = null, $escapeChar = null) {} + + /** + * Prepares qualified for this RDBMS + * + * @param string $column + * @param string $domain + * @param string $escapeChar + * @return string + */ + protected function prepareQualified($column, $domain = null, $escapeChar = null) {} + +} diff --git a/ide/2.0.8/Phalcon/db/DialectInterface.php b/ide/2.0.8/Phalcon/db/DialectInterface.php new file mode 100644 index 000000000..a1deb6019 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/DialectInterface.php @@ -0,0 +1,290 @@ + + * $profiler = new \Phalcon\Db\Profiler(); + * //Set the connection profiler + * $connection->setProfiler($profiler); + * $sql = "SELECT buyer_name, quantity, product_name + * FROM buyers LEFT JOIN products ON + * buyers.pid=products.id"; + * //Execute a SQL statement + * $connection->query($sql); + * //Get the last profile in the profiler + * $profile = $profiler->getLastProfile(); + * echo "SQL Statement: ", $profile->getSQLStatement(), "\n"; + * echo "Start Time: ", $profile->getInitialTime(), "\n"; + * echo "Final Time: ", $profile->getFinalTime(), "\n"; + * echo "Total Elapsed Time: ", $profile->getTotalElapsedSeconds(), "\n"; + * + */ +class Profiler +{ + /** + * All the Phalcon\Db\Profiler\Item in the active profile + * + * @var \Phalcon\Db\Profiler\Item[] + */ + protected $_allProfiles; + + /** + * Active Phalcon\Db\Profiler\Item + * + * @var Phalcon\Db\Profiler\Item + */ + protected $_activeProfile; + + /** + * Total time spent by all profiles to complete + * + * @var float + */ + protected $_totalSeconds = 0; + + + /** + * Starts the profile of a SQL sentence + * + * @param string $sqlStatement + * @param mixed $sqlVariables + * @param mixed $sqlBindTypes + * @return \Phalcon\Db\Profiler + */ + public function startProfile($sqlStatement, $sqlVariables = null, $sqlBindTypes = null) {} + + /** + * Stops the active profile + * + * @return Profiler + */ + public function stopProfile() {} + + /** + * Returns the total number of SQL statements processed + * + * @return int + */ + public function getNumberTotalStatements() {} + + /** + * Returns the total time in seconds spent by the profiles + * + * @return double + */ + public function getTotalElapsedSeconds() {} + + /** + * Returns all the processed profiles + * + * @return \Phalcon\Db\Profiler\Item + */ + public function getProfiles() {} + + /** + * Resets the profiler, cleaning up all the profiles + * + * @return Profiler + */ + public function reset() {} + + /** + * Returns the last profile executed in the profiler + * + * @return \Phalcon\Db\Profiler\Item + */ + public function getLastProfile() {} + +} diff --git a/ide/2.0.8/Phalcon/db/RawValue.php b/ide/2.0.8/Phalcon/db/RawValue.php new file mode 100644 index 000000000..e2e13798f --- /dev/null +++ b/ide/2.0.8/Phalcon/db/RawValue.php @@ -0,0 +1,47 @@ + + * $subscriber = new Subscribers(); + * $subscriber->email = 'andres@phalconphp.com'; + * $subscriber->createdAt = new \Phalcon\Db\RawValue('now()'); + * $subscriber->save(); + * + */ +class RawValue +{ + /** + * Raw value without quoting or formating + * + * @var string + */ + protected $_value; + + + /** + * Raw value without quoting or formating + * + * @return string + */ + public function getValue() {} + + /** + * Raw value without quoting or formating + * + * @return string + */ + public function __toString() {} + + /** + * Phalcon\Db\RawValue constructor + * + * @param mixed $value + */ + public function __construct($value) {} + +} diff --git a/ide/2.0.8/Phalcon/db/Reference.php b/ide/2.0.8/Phalcon/db/Reference.php new file mode 100644 index 000000000..ad0ca1f80 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/Reference.php @@ -0,0 +1,132 @@ + + * $reference = new \Phalcon\Db\Reference("field_fk", array( + * 'referencedSchema' => "invoicing", + * 'referencedTable' => "products", + * 'columns' => array("product_type", "product_code"), + * 'referencedColumns' => array("type", "code") + * )); + * + */ +class Reference implements \Phalcon\Db\ReferenceInterface +{ + /** + * Constraint name + * + * @var string + */ + protected $_name; + + + protected $_schemaName; + + + protected $_referencedSchema; + + /** + * Referenced Table + * + * @var string + */ + protected $_referencedTable; + + /** + * Local reference columns + * + * @var array + */ + protected $_columns; + + /** + * Referenced Columns + * + * @var array + */ + protected $_referencedColumns; + + /** + * ON DELETE + * + * @var array + */ + protected $_onDelete; + + /** + * ON UPDATE + * + * @var array + */ + protected $_onUpdate; + + + /** + * Constraint name + * + * @return string + */ + public function getName() {} + + + public function getSchemaName() {} + + + public function getReferencedSchema() {} + + /** + * Referenced Table + * + * @return string + */ + public function getReferencedTable() {} + + /** + * Local reference columns + * + * @return array + */ + public function getColumns() {} + + /** + * Referenced Columns + * + * @return array + */ + public function getReferencedColumns() {} + + /** + * ON DELETE + * + * @return array + */ + public function getOnDelete() {} + + /** + * ON UPDATE + * + * @return array + */ + public function getOnUpdate() {} + + /** + * Phalcon\Db\Reference constructor + * + * @param string $name + * @param array $definition + */ + public function __construct($name, $definition) {} + + /** + * Restore a Phalcon\Db\Reference object from export + * + * @param array $data + * @return Reference + */ + public static function __set_state($data) {} + +} diff --git a/ide/2.0.8/Phalcon/db/ReferenceInterface.php b/ide/2.0.8/Phalcon/db/ReferenceInterface.php new file mode 100644 index 000000000..89e52781f --- /dev/null +++ b/ide/2.0.8/Phalcon/db/ReferenceInterface.php @@ -0,0 +1,84 @@ + + * $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array( + * 'host' => '192.168.0.11', + * 'username' => 'sigma', + * 'password' => 'secret', + * 'dbname' => 'blog', + * 'port' => '3306' + * )); + * + */ +abstract class Pdo extends \Phalcon\Db\Adapter +{ + /** + * PDO Handler + */ + protected $_pdo; + + /** + * Last affected rows + */ + protected $_affectedRows; + + + /** + * Constructor for Phalcon\Db\Adapter\Pdo + * + * @param array $descriptor + */ + public function __construct($descriptor) {} + + /** + * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. + * Call it when you need to restore a database connection + * + * //Make a connection + * $connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array( + * 'host' => '192.168.0.11', + * 'username' => 'sigma', + * 'password' => 'secret', + * 'dbname' => 'blog', + * )); + * //Reconnect + * $connection->connect(); + * + * + * @param mixed $descriptor + * @param $array descriptor + * @return + */ + public function connect($descriptor = null) {} + + /** + * Returns a PDO prepared statement to be executed with 'executePrepared' + * + * $statement = $db->prepare('SELECTFROM robots WHERE name = :name'); + * $result = $connection->executePrepared($statement, array('name' => 'Voltron')); + * + * + * @param string $sqlStatement + * @return \PDOStatement + */ + public function prepare($sqlStatement) {} + + /** + * Executes a prepared statement binding. This function uses integer indexes starting from zero + * + * $statement = $db->prepare('SELECTFROM robots WHERE name = :name'); + * $result = $connection->executePrepared($statement, array('name' => 'Voltron')); + * + * + * @param \PDOStatement $statement + * @param array $placeholders + * @param array $dataTypes + * @return \PDOStatement + */ + public function executePrepared(\PDOStatement $statement, $placeholders, $dataTypes) {} + + /** + * Sends SQL statements to the database server returning the success state. + * Use this method only when the SQL statement sent to the server is returning rows + * + * //Querying data + * $resultset = $connection->query("SELECTFROM robots WHERE type='mechanical'"); + * $resultset = $connection->query("SELECTFROM robots WHERE type=?", array("mechanical")); + * + * + * @param string $sqlStatement + * @param mixed $bindParams + * @param mixed $bindTypes + * @return bool|\Phalcon\Db\ResultInterface + */ + public function query($sqlStatement, $bindParams = null, $bindTypes = null) {} + + /** + * Sends SQL statements to the database server returning the success state. + * Use this method only when the SQL statement sent to the server doesn't return any rows + * + * //Inserting data + * $success = $connection->execute("INSERT INTO robots VALUES (1, 'Astro Boy')"); + * $success = $connection->execute("INSERT INTO robots VALUES (?, ?)", array(1, 'Astro Boy')); + * + * + * @param string $sqlStatement + * @param mixed $bindParams + * @param mixed $bindTypes + * @return bool + */ + public function execute($sqlStatement, $bindParams = null, $bindTypes = null) {} + + /** + * Returns the number of affected rows by the lastest INSERT/UPDATE/DELETE executed in the database system + * + * $connection->execute("DELETE FROM robots"); + * echo $connection->affectedRows(), ' were deleted'; + * + * + * @return int + */ + public function affectedRows() {} + + /** + * Closes the active connection returning success. Phalcon automatically closes and destroys + * active connections when the request ends + * + * @return bool + */ + public function close() {} + + /** + * Escapes a column/table/schema name + * + * $escapedTable = $connection->escapeIdentifier('robots'); + * $escapedTable = $connection->escapeIdentifier(array('store', 'robots')); + * + * + * @param string $identifier + * @return string + */ + public function escapeIdentifier($identifier) {} + + /** + * Escapes a value to avoid SQL injections according to the active charset in the connection + * + * $escapedStr = $connection->escapeString('some dangerous value'); + * + * + * @param string $str + * @return string + */ + public function escapeString($str) {} + + /** + * Converts bound parameters such as :name: or ?1 into PDO bind params ? + * + * print_r($connection->convertBoundParams('SELECTFROM robots WHERE name = :name:', array('Bender'))); + * + * + * @param string $sql + * @param array $params + * @return array + */ + public function convertBoundParams($sql, $params = array()) {} + + /** + * Returns the insert id for the auto_increment/serial column inserted in the lastest executed SQL statement + * + * //Inserting a new robot + * $success = $connection->insert( + * "robots", + * array("Astro Boy", 1952), + * array("name", "year") + * ); + * //Getting the generated id + * $id = $connection->lastInsertId(); + * + * + * @param string $sequenceName + * @return int|boolean + */ + public function lastInsertId($sequenceName = null) {} + + /** + * Starts a transaction in the connection + * + * @param bool $nesting + * @return bool + */ + public function begin($nesting = true) {} + + /** + * Rollbacks the active transaction in the connection + * + * @param bool $nesting + * @return bool + */ + public function rollback($nesting = true) {} + + /** + * Commits the active transaction in the connection + * + * @param bool $nesting + * @return bool + */ + public function commit($nesting = true) {} + + /** + * Returns the current transaction nesting level + * + * @return int + */ + public function getTransactionLevel() {} + + /** + * Checks whether the connection is under a transaction + * + * $connection->begin(); + * var_dump($connection->isUnderTransaction()); //true + * + * + * @return bool + */ + public function isUnderTransaction() {} + + /** + * Return internal PDO handler + * + * @return \Pdo + */ + public function getInternalHandler() {} + + /** + * Return the error info, if any + * + * @return array + */ + public function getErrorInfo() {} + +} diff --git a/ide/2.0.8/Phalcon/db/adapter/pdo/Mysql.php b/ide/2.0.8/Phalcon/db/adapter/pdo/Mysql.php new file mode 100644 index 000000000..dec124c0e --- /dev/null +++ b/ide/2.0.8/Phalcon/db/adapter/pdo/Mysql.php @@ -0,0 +1,48 @@ + + * $config = array( + * "host" => "192.168.0.11", + * "dbname" => "blog", + * "port" => 3306, + * "username" => "sigma", + * "password" => "secret" + * ); + * $connection = new \Phalcon\Db\Adapter\Pdo\Mysql($config); + * + */ +class Mysql extends \Phalcon\Db\Adapter\Pdo implements \Phalcon\Db\AdapterInterface +{ + + protected $_type = "mysql"; + + + protected $_dialectType = "mysql"; + + + /** + * Escapes a column/table/schema name + * + * @param string|array $identifier + * @return string + */ + public function escapeIdentifier($identifier) {} + + /** + * Returns an array of Phalcon\Db\Column objects describing a table + * + * print_r($connection->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return \Phalcon\Db\Column + */ + public function describeColumns($table, $schema = null) {} + +} diff --git a/ide/2.0.8/Phalcon/db/adapter/pdo/Oracle.php b/ide/2.0.8/Phalcon/db/adapter/pdo/Oracle.php new file mode 100644 index 000000000..9e45aea25 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/adapter/pdo/Oracle.php @@ -0,0 +1,84 @@ + + * $config = array( + * "dbname" => "//localhost/dbname", + * "username" => "oracle", + * "password" => "oracle" + * ); + * $connection = new \Phalcon\Db\Adapter\Pdo\Oracle($config); + * + */ +class Oracle extends \Phalcon\Db\Adapter\Pdo implements \Phalcon\Db\AdapterInterface +{ + + protected $_type = "oci"; + + + protected $_dialectType = "oracle"; + + + /** + * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. + * Call it when you need to restore a database connection. + * + * @param array $descriptor + * @return boolean + */ + public function connect($descriptor = null) {} + + /** + * Returns an array of Phalcon\Db\Column objects describing a table + * print_r($connection->describeColumns("posts")); ?> + * + * @param string $table + * @param string $schema + * @return \Phalcon\Db\Column + */ + public function describeColumns($table, $schema = null) {} + + /** + * Returns the insert id for the auto_increment/serial column inserted in the lastest executed SQL statement + * + * //Inserting a new robot + * $success = $connection->insert( + * "robots", + * array("Astro Boy", 1952), + * array("name", "year") + * ); + * //Getting the generated id + * $id = $connection->lastInsertId(); + * + * + * @param string $sequenceName + * @return int + */ + public function lastInsertId($sequenceName = null) {} + + /** + * Check whether the database system requires an explicit value for identity columns + * + * @return bool + */ + public function useExplicitIdValue() {} + + /** + * Return the default identity value to insert in an identity column + * + * @return \Phalcon\Db\RawValue + */ + public function getDefaultIdValue() {} + + /** + * Check whether the database system requires a sequence to produce auto-numeric values + * + * @return bool + */ + public function supportSequences() {} + +} diff --git a/ide/2.0.8/Phalcon/db/adapter/pdo/Postgresql.php b/ide/2.0.8/Phalcon/db/adapter/pdo/Postgresql.php new file mode 100644 index 000000000..301ae233c --- /dev/null +++ b/ide/2.0.8/Phalcon/db/adapter/pdo/Postgresql.php @@ -0,0 +1,99 @@ + + * $config = array( + * "host" => "192.168.0.11", + * "dbname" => "blog", + * "username" => "postgres", + * "password" => "" + * ); + * $connection = new \Phalcon\Db\Adapter\Pdo\Postgresql($config); + * + */ +class Postgresql extends \Phalcon\Db\Adapter\Pdo implements \Phalcon\Db\AdapterInterface +{ + + protected $_type = "pgsql"; + + + protected $_dialectType = "postgresql"; + + + /** + * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. + * Call it when you need to restore a database connection. + * + * @param mixed $descriptor + * @param array $$descriptor + * @return boolean + */ + public function connect($descriptor = null) {} + + /** + * Returns an array of Phalcon\Db\Column objects describing a table + * + * print_r($connection->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return \Phalcon\Db\Column + */ + public function describeColumns($table, $schema = null) {} + + /** + * Creates a table + * + * @param string $tableName + * @param string $schemaName + * @param array $definition + * @return bool + */ + public function createTable($tableName, $schemaName, $definition) {} + + /** + * Modifies a table column based on a definition + * + * @param string $tableName + * @param string $schemaName + * @param mixed $column + * @param mixed $currentColumn + * @return bool + */ + public function modifyColumn($tableName, $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null) {} + + /** + * Check whether the database system requires an explicit value for identity columns + * + * @return bool + */ + public function useExplicitIdValue() {} + + /** + * Returns the default identity value to be inserted in an identity column + * + * //Inserting a new robot with a valid default value for the column 'id' + * $success = $connection->insert( + * "robots", + * array($connection->getDefaultIdValue(), "Astro Boy", 1952), + * array("id", "name", "year") + * ); + * + * + * @return \Phalcon\Db\RawValue + */ + public function getDefaultIdValue() {} + + /** + * Check whether the database system requires a sequence to produce auto-numeric values + * + * @return bool + */ + public function supportSequences() {} + +} diff --git a/ide/2.0.8/Phalcon/db/adapter/pdo/Sqlite.php b/ide/2.0.8/Phalcon/db/adapter/pdo/Sqlite.php new file mode 100644 index 000000000..2a89f63eb --- /dev/null +++ b/ide/2.0.8/Phalcon/db/adapter/pdo/Sqlite.php @@ -0,0 +1,92 @@ + + * $config = array( + * "dbname" => "/tmp/test.sqlite" + * ); + * $connection = new \Phalcon\Db\Adapter\Pdo\Sqlite($config); + * + */ +class Sqlite extends \Phalcon\Db\Adapter\Pdo implements \Phalcon\Db\AdapterInterface +{ + + protected $_type = "sqlite"; + + + protected $_dialectType = "sqlite"; + + + /** + * This method is automatically called in Phalcon\Db\Adapter\Pdo constructor. + * Call it when you need to restore a database connection. + * + * @param mixed $descriptor + * @param array $$descriptor + * @return boolean + */ + public function connect($descriptor = null) {} + + /** + * Returns an array of Phalcon\Db\Column objects describing a table + * + * print_r($connection->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return \Phalcon\Db\Column + */ + public function describeColumns($table, $schema = null) {} + + /** + * Lists table indexes + * + * @param string table + * @param string schema + * @return Phalcon\Db\IndexInterface[] + * @param mixed $table + * @param mixed $schema + * @return \Phalcon\Db\IndexInterface + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Lists table references + * + * @param string table + * @param string schema + * @return Phalcon\Db\ReferenceInterface[] + * @param mixed $table + * @param mixed $schema + * @return \Phalcon\Db\ReferenceInterface + */ + public function describeReferences($table, $schema = null) {} + + /** + * Check whether the database system requires an explicit value for identity columns + * + * @return bool + */ + public function useExplicitIdValue() {} + + /** + * Returns the default value to make the RBDM use the default value declared in the table definition + * + * //Inserting a new robot with a valid default value for the column 'year' + * $success = $connection->insert( + * "robots", + * array("Astro Boy", $connection->getDefaultValue()), + * array("name", "year") + * ); + * + * + * @return \Phalcon\Db\RawValue + */ + public function getDefaultValue() {} + +} diff --git a/ide/2.0.8/Phalcon/db/dialect/MySQL.php b/ide/2.0.8/Phalcon/db/dialect/MySQL.php new file mode 100644 index 000000000..6e8af8d16 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/dialect/MySQL.php @@ -0,0 +1,241 @@ + + * echo $dialect->tableExists("posts", "blog"); + * echo $dialect->tableExists("posts"); + * + * + * @param string $tableName + * @param string $schemaName + * @return string + */ + public function tableExists($tableName, $schemaName = null) {} + + /** + * Generates SQL checking for the existence of a schema.view + * + * @param string $viewName + * @param string $schemaName + * @return string + */ + public function viewExists($viewName, $schemaName = null) {} + + /** + * Generates SQL describing a table + * + * print_r($dialect->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeColumns($table, $schema = null) {} + + /** + * List all tables in database + * + * print_r($dialect->listTables("blog")) + * + * + * @param string $schemaName + * @return string + */ + public function listTables($schemaName = null) {} + + /** + * Generates the SQL to list all views of a schema or user + * + * @param string $schemaName + * @return string + */ + public function listViews($schemaName = null) {} + + /** + * Generates SQL to query indexes on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Generates SQL to query foreign keys on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeReferences($table, $schema = null) {} + + /** + * Generates the SQL to describe the table creation options + * + * @param string $table + * @param string $schema + * @return string + */ + public function tableOptions($table, $schema = null) {} + + /** + * Generates SQL to add the table creation options + * + * @param array $definition + * @return string + */ + protected function _getTableOptions($definition) {} + +} diff --git a/ide/2.0.8/Phalcon/db/dialect/Oracle.php b/ide/2.0.8/Phalcon/db/dialect/Oracle.php new file mode 100644 index 000000000..b309e1941 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/dialect/Oracle.php @@ -0,0 +1,268 @@ + + * echo $dialect->tableExists("posts", "blog"); + * echo $dialect->tableExists("posts"); + * + * + * @param string $tableName + * @param string $schemaName + * @return string + */ + public function tableExists($tableName, $schemaName = null) {} + + /** + * Generates SQL describing a table + * + * print_r($dialect->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeColumns($table, $schema = null) {} + + /** + * List all tables in database + * + * print_r($dialect->listTables("blog")) + * + * + * @param string $schemaName + * @return string + */ + public function listTables($schemaName = null) {} + + /** + * Generates SQL to query indexes on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Generates SQL to query foreign keys on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeReferences($table, $schema = null) {} + + /** + * Generates the SQL to describe the table creation options + * + * @param string $table + * @param string $schema + * @return string + */ + public function tableOptions($table, $schema = null) {} + + /** + * Checks whether the platform supports savepoints + * + * @return bool + */ + public function supportsSavepoints() {} + + /** + * Checks whether the platform supports releasing savepoints. + * + * @return bool + */ + public function supportsReleaseSavepoints() {} + + /** + * Prepares table for this RDBMS + * + * @param string $table + * @param string $schema + * @param string $alias + * @param string $escapeChar + * @return string + */ + protected function prepareTable($table, $schema = null, $alias = null, $escapeChar = null) {} + +} diff --git a/ide/2.0.8/Phalcon/db/dialect/Postgresql.php b/ide/2.0.8/Phalcon/db/dialect/Postgresql.php new file mode 100644 index 000000000..0a3b9f37e --- /dev/null +++ b/ide/2.0.8/Phalcon/db/dialect/Postgresql.php @@ -0,0 +1,239 @@ + + * echo $dialect->tableExists("posts", "blog"); + * echo $dialect->tableExists("posts"); + * + * + * @param string $tableName + * @param string $schemaName + * @return string + */ + public function tableExists($tableName, $schemaName = null) {} + + /** + * Generates SQL checking for the existence of a schema.view + * + * @param string $viewName + * @param string $schemaName + * @return string + */ + public function viewExists($viewName, $schemaName = null) {} + + /** + * Generates SQL describing a table + * + * print_r($dialect->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeColumns($table, $schema = null) {} + + /** + * List all tables in database + * + * print_r($dialect->listTables("blog")) + * + * + * @param string $schemaName + * @return string + */ + public function listTables($schemaName = null) {} + + /** + * Generates the SQL to list all views of a schema or user + * + * @param string $schemaName + * @return string + */ + public function listViews($schemaName = null) {} + + /** + * Generates SQL to query indexes on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Generates SQL to query foreign keys on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeReferences($table, $schema = null) {} + + /** + * Generates the SQL to describe the table creation options + * + * @param string $table + * @param string $schema + * @return string + */ + public function tableOptions($table, $schema = null) {} + + /** + * @param array $definition + * @return string + */ + protected function _getTableOptions($definition) {} + +} diff --git a/ide/2.0.8/Phalcon/db/dialect/Sqlite.php b/ide/2.0.8/Phalcon/db/dialect/Sqlite.php new file mode 100644 index 000000000..c606ad0c5 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/dialect/Sqlite.php @@ -0,0 +1,241 @@ + + * echo $dialect->tableExists("posts", "blog"); + * echo $dialect->tableExists("posts"); + * + * + * @param string $tableName + * @param string $schemaName + * @return string + */ + public function tableExists($tableName, $schemaName = null) {} + + /** + * Generates SQL checking for the existence of a schema.view + * + * @param string $viewName + * @param string $schemaName + * @return string + */ + public function viewExists($viewName, $schemaName = null) {} + + /** + * Generates SQL describing a table + * + * print_r($dialect->describeColumns("posts")); + * + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeColumns($table, $schema = null) {} + + /** + * List all tables in database + * + * print_r($dialect->listTables("blog")) + * + * + * @param string $schemaName + * @return string + */ + public function listTables($schemaName = null) {} + + /** + * Generates the SQL to list all views of a schema or user + * + * @param string $schemaName + * @return string + */ + public function listViews($schemaName = null) {} + + /** + * Generates SQL to query indexes on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeIndexes($table, $schema = null) {} + + /** + * Generates SQL to query indexes detail on a table + * + * @param string $index + * @return string + */ + public function describeIndex($index) {} + + /** + * Generates SQL to query foreign keys on a table + * + * @param string $table + * @param string $schema + * @return string + */ + public function describeReferences($table, $schema = null) {} + + /** + * Generates the SQL to describe the table creation options + * + * @param string $table + * @param string $schema + * @return string + */ + public function tableOptions($table, $schema = null) {} + +} diff --git a/ide/2.0.8/Phalcon/db/profiler/Item.php b/ide/2.0.8/Phalcon/db/profiler/Item.php new file mode 100644 index 000000000..79ad83855 --- /dev/null +++ b/ide/2.0.8/Phalcon/db/profiler/Item.php @@ -0,0 +1,124 @@ + + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * $result->setFetchMode(Phalcon\Db::FETCH_NUM); + * while ($robot = $result->fetchArray()) { + * print_r($robot); + * } + * + */ +class Pdo implements \Phalcon\Db\ResultInterface +{ + + protected $_connection; + + + protected $_result; + + /** + * Active fetch mode + */ + protected $_fetchMode = Db::FETCH_OBJ; + + /** + * Internal resultset + * + * @var \PDOStatement + */ + protected $_pdoStatement; + + + protected $_sqlStatement; + + + protected $_bindParams; + + + protected $_bindTypes; + + + protected $_rowCount = false; + + + /** + * Phalcon\Db\Result\Pdo constructor + * + * @param \Phalcon\Db\AdapterInterface $connection + * @param \PDOStatement $result + * @param string $sqlStatement + * @param array $bindParams + * @param array $bindTypes + */ + public function __construct(Db\AdapterInterface $connection, \PDOStatement $result, $sqlStatement = null, $bindParams = null, $bindTypes = null) {} + + /** + * Allows to execute the statement again. Some database systems don't support scrollable cursors, + * So, as cursors are forward only, we need to execute the cursor again to fetch rows from the begining + * + * @return bool + */ + public function execute() {} + + /** + * Fetches an array/object of strings that corresponds to the fetched row, or FALSE if there are no more rows. + * This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode + * + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * $result->setFetchMode(Phalcon\Db::FETCH_OBJ); + * while ($robot = $result->fetch()) { + * echo $robot->name; + * } + * + * + * @param mixed $fetchStyle + * @param mixed $cursorOrientation + * @param mixed $cursorOffset + */ + public function fetch($fetchStyle = null, $cursorOrientation = null, $cursorOffset = null) {} + + /** + * Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. + * This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode + * + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * $result->setFetchMode(Phalcon\Db::FETCH_NUM); + * while ($robot = result->fetchArray()) { + * print_r($robot); + * } + * + */ + public function fetchArray() {} + + /** + * Returns an array of arrays containing all the records in the result + * This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode + * + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * $robots = $result->fetchAll(); + * + * + * @param mixed $fetchStyle + * @param mixed $fetchArgument + * @param mixed $ctorArgs + * @return array + */ + public function fetchAll($fetchStyle = null, $fetchArgument = null, $ctorArgs = null) {} + + /** + * Gets number of rows returned by a resultset + * + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * echo 'There are ', $result->numRows(), ' rows in the resultset'; + * + * + * @return int + */ + public function numRows() {} + + /** + * Moves internal resultset cursor to another position letting us to fetch a certain row + * + * $result = $connection->query("SELECTFROM robots ORDER BY name"); + * $result->dataSeek(2); // Move to third row on result + * $row = $result->fetch(); // Fetch third row + * + * + * @param long $number + */ + public function dataSeek($number) {} + + /** + * Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch() + * + * //Return array with integer indexes + * $result->setFetchMode(\Phalcon\Db::FETCH_NUM); + * //Return associative array without integer indexes + * $result->setFetchMode(\Phalcon\Db::FETCH_ASSOC); + * //Return associative array together with integer indexes + * $result->setFetchMode(\Phalcon\Db::FETCH_BOTH); + * //Return an object + * $result->setFetchMode(\Phalcon\Db::FETCH_OBJ); + * + * + * @param int $fetchMode + * @param mixed $colNoOrClassNameOrObject + * @param mixed $ctorargs + * @return bool + */ + public function setFetchMode($fetchMode, $colNoOrClassNameOrObject = null, $ctorargs = null) {} + + /** + * Gets the internal PDO result object + * + * @return \PDOStatement + */ + public function getInternalResult() {} + +} diff --git a/ide/2.0.8/Phalcon/debug/Dump.php b/ide/2.0.8/Phalcon/debug/Dump.php new file mode 100644 index 000000000..6d610b011 --- /dev/null +++ b/ide/2.0.8/Phalcon/debug/Dump.php @@ -0,0 +1,134 @@ + + * $foo = 123; + * echo (new \Phalcon\Debug\Dump())->variable($foo, "foo"); + * + * + * $foo = "string"; + * $bar = ["key" => "value"]; + * $baz = new stdClass(); + * echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz); + * + */ +class Dump +{ + + protected $_detailed = false; + + + protected $_methods = null; + + + protected $_styles; + + + + public function getDetailed() {} + + /** + * @param mixed $detailed + */ + public function setDetailed($detailed) {} + + /** + * Phalcon\Debug\Dump constructor + * + * @param array $styles + * @param boolean $detailed debug object's private and protected properties + */ + public function __construct($styles = null, $detailed = false) {} + + /** + * Alias of variables() method + * + * @param mixed $variable + * @param ... + * @return string + */ + public function all() {} + + /** + * Get style for type + * + * @param string $type + * @return string + */ + protected function getStyle($type) {} + + /** + * Set styles for vars type + * + * @param mixed $styles + * @return array + */ + public function setStyles($styles = null) {} + + /** + * Alias of variable() method + * + * @param mixed $variable + * @param string $name + * @return string + */ + public function one($variable, $name = null) {} + + /** + * Prepare an HTML string of information about a single variable. + * + * @param mixed $variable + * @param string $name + * @param int $tab + * @return string + */ + protected function output($variable, $name = null, $tab = 1) {} + + /** + * Returns an HTML string of information about a single variable. + * + * echo (new \Phalcon\Debug\Dump())->variable($foo, "foo"); + * + * + * @param mixed $variable + * @param string $name + * @return string + */ + public function variable($variable, $name = null) {} + + /** + * Returns an HTML string of debugging information about any number of + * variables, each wrapped in a "pre" tag. + * + * $foo = "string"; + * $bar = ["key" => "value"]; + * $baz = new stdClass(); + * echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz); + * + * + * @param mixed $variable + * @param ... + * @return string + */ + public function variables() {} + + /** + * Returns an JSON string of information about a single variable. + * + * $foo = ["key" => "value"]; + * echo (new \Phalcon\Debug\Dump())->toJson($foo); + * $foo = new stdClass(); + * $foo->bar = 'buz'; + * echo (new \Phalcon\Debug\Dump())->toJson($foo); + * + * + * @param mixed $variable + * @return string + */ + public function toJson($variable) {} + +} diff --git a/ide/2.0.8/Phalcon/debug/Exception.php b/ide/2.0.8/Phalcon/debug/Exception.php new file mode 100644 index 000000000..12c2c2b76 --- /dev/null +++ b/ide/2.0.8/Phalcon/debug/Exception.php @@ -0,0 +1,12 @@ + + * $service = new \Phalcon\Di\Service('request', 'Phalcon\Http\Request'); + * $request = service->resolve(); + * + */ +class Service implements \Phalcon\Di\ServiceInterface +{ + + protected $_name; + + + protected $_definition; + + + protected $_shared = false; + + + protected $_resolved = false; + + + protected $_sharedInstance; + + + /** + * Phalcon\Di\Service + * + * @param string $name + * @param mixed $definition + * @param boolean $shared + */ + public final function __construct($name, $definition, $shared = false) {} + + /** + * Returns the service's name + * + * @return string + */ + public function getName() {} + + /** + * Sets if the service is shared or not + * + * @param bool $shared + */ + public function setShared($shared) {} + + /** + * Check whether the service is shared or not + * + * @return bool + */ + public function isShared() {} + + /** + * Sets/Resets the shared instance related to the service + * + * @param mixed $sharedInstance + */ + public function setSharedInstance($sharedInstance) {} + + /** + * Set the service definition + * + * @param mixed $definition + */ + public function setDefinition($definition) {} + + /** + * Returns the service definition + * + * @return mixed + */ + public function getDefinition() {} + + /** + * Resolves the service + * + * @param array $parameters + * @param \Phalcon\DiInterface $dependencyInjector + * @return mixed + */ + public function resolve($parameters = null, \Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * Changes a parameter in the definition without resolve the service + * + * @param int $position + * @param array $parameter + * @return Service + */ + public function setParameter($position, $parameter) {} + + /** + * Returns a parameter in a specific position + * + * @param int $position + * @return array + */ + public function getParameter($position) {} + + /** + * Returns true if the service was resolved + * + * @return bool + */ + public function isResolved() {} + + /** + * Restore the internal state of a service + * + * @param array $attributes + * @return Service + */ + public static function __set_state($attributes) {} + +} diff --git a/ide/2.0.8/Phalcon/di/ServiceInterface.php b/ide/2.0.8/Phalcon/di/ServiceInterface.php new file mode 100644 index 000000000..12877ca00 --- /dev/null +++ b/ide/2.0.8/Phalcon/di/ServiceInterface.php @@ -0,0 +1,82 @@ + + * $eventsManager->fire('db', $connection); + * + * + * @param string $eventType + * @param object $source + * @param mixed $data + * @param boolean $cancelable + * @return mixed + */ + public function fire($eventType, $source, $data = null, $cancelable = true) {} + + /** + * Check whether certain type of event has listeners + * + * @param string $type + * @return bool + */ + public function hasListeners($type) {} + + /** + * Returns all the attached listeners of a certain type + * + * @param string $type + * @return array + */ + public function getListeners($type) {} + +} diff --git a/ide/2.0.8/Phalcon/events/ManagerInterface.php b/ide/2.0.8/Phalcon/events/ManagerInterface.php new file mode 100644 index 000000000..7a60e4162 --- /dev/null +++ b/ide/2.0.8/Phalcon/events/ManagerInterface.php @@ -0,0 +1,55 @@ + + * $request = new \Phalcon\Http\Request(); + * if ($request->isPost() == true) { + * if ($request->isAjax() == true) { + * echo 'Request was made using POST and AJAX'; + * } + * } + * + */ +class Request implements \Phalcon\Http\RequestInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_rawBody; + + + protected $_filter; + + + protected $_putCache; + + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Gets a variable from the $_REQUEST superglobal applying filters if needed. + * If no parameters are given the $_REQUEST superglobal is returned + * + * //Returns value from $_REQUEST["user_email"] without sanitizing + * $userEmail = $request->get("user_email"); + * //Returns value from $_REQUEST["user_email"] with sanitizing + * $userEmail = $request->get("user_email", "email"); + * + * + * @param string $name + * @param mixed $filters + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + public function get($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) {} + + /** + * Gets a variable from the $_POST superglobal applying filters if needed + * If no parameters are given the $_POST superglobal is returned + * + * //Returns value from $_POST["user_email"] without sanitizing + * $userEmail = $request->getPost("user_email"); + * //Returns value from $_POST["user_email"] with sanitizing + * $userEmail = $request->getPost("user_email", "email"); + * + * + * @param string $name + * @param mixed $filters + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + public function getPost($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) {} + + /** + * Gets a variable from put request + * + * //Returns value from $_PUT["user_email"] without sanitizing + * $userEmail = $request->getPut("user_email"); + * //Returns value from $_PUT["user_email"] with sanitizing + * $userEmail = $request->getPut("user_email", "email"); + * + * + * @param string $name + * @param mixed $filters + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + public function getPut($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) {} + + /** + * Gets variable from $_GET superglobal applying filters if needed + * If no parameters are given the $_GET superglobal is returned + * + * //Returns value from $_GET["id"] without sanitizing + * $id = $request->getQuery("id"); + * //Returns value from $_GET["id"] with sanitizing + * $id = $request->getQuery("id", "int"); + * //Returns value from $_GET["id"] with a default value + * $id = $request->getQuery("id", null, 150); + * + * + * @param string $name + * @param mixed $filters + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + public function getQuery($name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) {} + + /** + * Helper to get data from superglobals, applying filters if needed. + * If no parameters are given the superglobal is returned. + * + * @param array $source + * @param string $name + * @param mixed $filters + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + protected final function getHelper($source, $name = null, $filters = null, $defaultValue = null, $notAllowEmpty = false, $noRecursive = false) {} + + /** + * Gets variable from $_SERVER superglobal + * + * @param string $name + * @return string|null + */ + public function getServer($name) {} + + /** + * Checks whether $_REQUEST superglobal has certain index + * + * @param string $name + * @return bool + */ + public function has($name) {} + + /** + * Checks whether $_POST superglobal has certain index + * + * @param string $name + * @return bool + */ + public function hasPost($name) {} + + /** + * Checks whether the PUT data has certain index + * + * @param string $name + * @return bool + */ + public function hasPut($name) {} + + /** + * Checks whether $_GET superglobal has certain index + * + * @param string $name + * @return bool + */ + public function hasQuery($name) {} + + /** + * Checks whether $_SERVER superglobal has certain index + * + * @param string $name + * @return bool + */ + public final function hasServer($name) {} + + /** + * Gets HTTP header from request data + * + * @param string $header + * @return string + */ + public final function getHeader($header) {} + + /** + * Gets HTTP schema (http/https) + * + * @return string + */ + public function getScheme() {} + + /** + * Checks whether request has been made using ajax + * + * @return bool + */ + public function isAjax() {} + + /** + * Checks whether request has been made using SOAP + * + * @return bool + */ + public function isSoapRequested() {} + + /** + * Checks whether request has been made using any secure layer + * + * @return bool + */ + public function isSecureRequest() {} + + /** + * Gets HTTP raw request body + * + * @return string + */ + public function getRawBody() {} + + /** + * Gets decoded JSON HTTP raw request body + * + * @param bool $associative + * @return array|bool|\stdClass + */ + public function getJsonRawBody($associative = false) {} + + /** + * Gets active server address IP + * + * @return string + */ + public function getServerAddress() {} + + /** + * Gets active server name + * + * @return string + */ + public function getServerName() {} + + /** + * Gets information about schema, host and port used by the request + * + * @return string + */ + public function getHttpHost() {} + + /** + * Gets HTTP URI which request has been made + * + * @return string + */ + public final function getURI() {} + + /** + * Gets most possible client IPv4 Address. This method search in _SERVER['REMOTE_ADDR'] and optionally in _SERVER['HTTP_X_FORWARDED_FOR'] + * + * @param bool $trustForwardedHeader + * @return string|bool + */ + public function getClientAddress($trustForwardedHeader = false) {} + + /** + * Gets HTTP method which request has been made + * + * @return string + */ + public final function getMethod() {} + + /** + * Gets HTTP user agent used to made the request + * + * @return string + */ + public function getUserAgent() {} + + /** + * Checks if a method is a valid HTTP method + * + * @param string $method + * @return bool + */ + public function isValidHttpMethod($method) {} + + /** + * Check if HTTP method match any of the passed methods + * When strict is true it checks if validated methods are real HTTP methods + * + * @param mixed $methods + * @param bool $strict + * @return bool + */ + public function isMethod($methods, $strict = false) {} + + /** + * Checks whether HTTP method is POST. if _SERVER["REQUEST_METHOD"]==="POST" + * + * @return bool + */ + public function isPost() {} + + /** + * Checks whether HTTP method is GET. if _SERVER["REQUEST_METHOD"]==="GET" + * + * @return bool + */ + public function isGet() {} + + /** + * Checks whether HTTP method is PUT. if _SERVER["REQUEST_METHOD"]==="PUT" + * + * @return bool + */ + public function isPut() {} + + /** + * Checks whether HTTP method is PATCH. if _SERVER["REQUEST_METHOD"]==="PATCH" + * + * @return bool + */ + public function isPatch() {} + + /** + * Checks whether HTTP method is HEAD. if _SERVER["REQUEST_METHOD"]==="HEAD" + * + * @return bool + */ + public function isHead() {} + + /** + * Checks whether HTTP method is DELETE. if _SERVER["REQUEST_METHOD"]==="DELETE" + * + * @return bool + */ + public function isDelete() {} + + /** + * Checks whether HTTP method is OPTIONS. if _SERVER["REQUEST_METHOD"]==="OPTIONS" + * + * @return bool + */ + public function isOptions() {} + + /** + * Checks whether request include attached files + * + * @param bool $onlySuccessful + * @return long + */ + public function hasFiles($onlySuccessful = false) {} + + /** + * Recursively counts file in an array of files + * + * @param mixed $data + * @param bool $onlySuccessful + * @return long + */ + protected final function hasFileHelper($data, $onlySuccessful) {} + + /** + * Gets attached files as Phalcon\Http\Request\File instances + * + * @param bool $onlySuccessful + * @return \Phalcon\Http\Request\File + */ + public function getUploadedFiles($onlySuccessful = false) {} + + /** + * Smooth out $_FILES to have plain array with all files uploaded + * + * @param array $names + * @param array $types + * @param array $tmp_names + * @param array $sizes + * @param array $errors + * @param string $prefix + * @return array + */ + protected final function smoothFiles($names, $types, $tmp_names, $sizes, $errors, $prefix) {} + + /** + * Returns the available headers in the request + * + * @return array + */ + public function getHeaders() {} + + /** + * Gets web page that refers active request. ie: http://www.google.com + * + * @return string + */ + public function getHTTPReferer() {} + + /** + * Process a request header and return an array of values with their qualities + * + * @param string $serverIndex + * @param string $name + * @return array + */ + protected final function _getQualityHeader($serverIndex, $name) {} + + /** + * Process a request header and return the one with best quality + * + * @param array $qualityParts + * @param string $name + * @return string + */ + protected final function _getBestQuality($qualityParts, $name) {} + + /** + * Gets content type which request has been made + * + * @return string|null + */ + public function getContentType() {} + + /** + * Gets an array with mime/types and their quality accepted by the browser/client from _SERVER["HTTP_ACCEPT"] + * + * @return array + */ + public function getAcceptableContent() {} + + /** + * Gets best mime/type accepted by the browser/client from _SERVER["HTTP_ACCEPT"] + * + * @return string + */ + public function getBestAccept() {} + + /** + * Gets a charsets array and their quality accepted by the browser/client from _SERVER["HTTP_ACCEPT_CHARSET"] + * + * @return mixed + */ + public function getClientCharsets() {} + + /** + * Gets best charset accepted by the browser/client from _SERVER["HTTP_ACCEPT_CHARSET"] + * + * @return string + */ + public function getBestCharset() {} + + /** + * Gets languages array and their quality accepted by the browser/client from _SERVER["HTTP_ACCEPT_LANGUAGE"] + * + * @return array + */ + public function getLanguages() {} + + /** + * Gets best language accepted by the browser/client from _SERVER["HTTP_ACCEPT_LANGUAGE"] + * + * @return string + */ + public function getBestLanguage() {} + + /** + * Gets auth info accepted by the browser/client from $_SERVER['PHP_AUTH_USER'] + * + * @return array|null + */ + public function getBasicAuth() {} + + /** + * Gets auth info accepted by the browser/client from $_SERVER['PHP_AUTH_DIGEST'] + * + * @return array + */ + public function getDigestAuth() {} + +} diff --git a/ide/2.0.8/Phalcon/http/RequestInterface.php b/ide/2.0.8/Phalcon/http/RequestInterface.php new file mode 100644 index 000000000..c56f2d673 --- /dev/null +++ b/ide/2.0.8/Phalcon/http/RequestInterface.php @@ -0,0 +1,306 @@ + + * $response = new \Phalcon\Http\Response(); + * $response->setStatusCode(200, "OK"); + * $response->setContent("Hello"); + * $response->send(); + * + */ +class Response implements \Phalcon\Http\ResponseInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_sent = false; + + + protected $_content; + + + protected $_headers; + + + protected $_cookies; + + + protected $_file; + + + protected $_dependencyInjector; + + + protected $_statusCodes; + + + /** + * Phalcon\Http\Response constructor + * + * @param string $content + * @param int $code + * @param string $status + */ + public function __construct($content = null, $code = null, $status = null) {} + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the HTTP response code + * + * $response->setStatusCode(404, "Not Found"); + * + * + * @param int $code + * @param string $message + * @return Response + */ + public function setStatusCode($code, $message = null) {} + + /** + * Returns the status code + * + * print_r($response->getStatusCode()); + * + * + * @return array + */ + public function getStatusCode() {} + + /** + * Sets a headers bag for the response externally + * + * @param mixed $headers + * @return Response + */ + public function setHeaders(\Phalcon\Http\Response\HeadersInterface $headers) {} + + /** + * Returns headers set by the user + * + * @return \Phalcon\Http\Response\HeadersInterface + */ + public function getHeaders() {} + + /** + * Sets a cookies bag for the response externally + * + * @param mixed $cookies + * @return Response + */ + public function setCookies(\Phalcon\Http\Response\CookiesInterface $cookies) {} + + /** + * Returns coookies set by the user + * + * @return \Phalcon\Http\Response\CookiesInterface + */ + public function getCookies() {} + + /** + * Overwrites a header in the response + * + * $response->setHeader("Content-Type", "text/plain"); + * + * + * @param string $name + * @param string $value + * @return \Phalcon\Http\Response + */ + public function setHeader($name, $value) {} + + /** + * Send a raw header to the response + * + * $response->setRawHeader("HTTP/1.1 404 Not Found"); + * + * + * @param string $header + * @return Response + */ + public function setRawHeader($header) {} + + /** + * Resets all the stablished headers + * + * @return Response + */ + public function resetHeaders() {} + + /** + * Sets a Expires header to use HTTP cache + * + * $this->response->setExpires(new DateTime()); + * + * + * @param mixed $datetime + * @return Response + */ + public function setExpires(\DateTime $datetime) {} + + /** + * Sets Cache headers to use HTTP cache + * + * $this->response->setCache(60); + * + * + * @param int $minutes + * @return Response + */ + public function setCache($minutes) {} + + /** + * Sends a Not-Modified response + * + * @return Response + */ + public function setNotModified() {} + + /** + * Sets the response content-type mime, optionally the charset + * + * $response->setContentType('application/pdf'); + * $response->setContentType('text/plain', 'UTF-8'); + * + * + * @param string $contentType + * @param string $charset + * @return \Phalcon\Http\Response + */ + public function setContentType($contentType, $charset = null) {} + + /** + * Set a custom ETag + * + * $response->setEtag(md5(time())); + * + * + * @param string $etag + * @return Response + */ + public function setEtag($etag) {} + + /** + * Redirect by HTTP to another action or URL + * + * //Using a string redirect (internal/external) + * $response->redirect("posts/index"); + * $response->redirect("http://en.wikipedia.org", true); + * $response->redirect("http://www.example.com/new-location", true, 301); + * //Making a redirection based on a named route + * $response->redirect(array( + * "for" => "index-lang", + * "lang" => "jp", + * "controller" => "index" + * )); + * + * + * @param string|array $location + * @param boolean $externalRedirect + * @param int $statusCode + * @return \Phalcon\Http\Response + */ + public function redirect($location = null, $externalRedirect = false, $statusCode = 302) {} + + /** + * Sets HTTP response body + * + * response->setContent("

Hello!

"); + *
+ * + * @param string $content + * @return Response + */ + public function setContent($content) {} + + /** + * Sets HTTP response body. The parameter is automatically converted to JSON + * + * $response->setJsonContent(array("status" => "OK")); + * + * + * @param mixed $content + * @param int $jsonOptions + * @param mixed $depth + * @return \Phalcon\Http\Response + */ + public function setJsonContent($content, $jsonOptions = 0, $depth = 512) {} + + /** + * Appends a string to the HTTP response body + * + * @param string $content + * @return \Phalcon\Http\Response + */ + public function appendContent($content) {} + + /** + * Gets the HTTP response body + * + * @return string + */ + public function getContent() {} + + /** + * Check if the response is already sent + * + * @return bool + */ + public function isSent() {} + + /** + * Sends headers to the client + * + * @return Response + */ + public function sendHeaders() {} + + /** + * Sends cookies to the client + * + * @return Response + */ + public function sendCookies() {} + + /** + * Prints out HTTP response to the client + * + * @return Response + */ + public function send() {} + + /** + * Sets an attached file to be sent at the end of the request + * + * @param string $filePath + * @param string $attachmentName + * @param mixed $attachment + * @return \Phalcon\Http\Response + */ + public function setFileToSend($filePath, $attachmentName = null, $attachment = true) {} + +} diff --git a/ide/2.0.8/Phalcon/http/ResponseInterface.php b/ide/2.0.8/Phalcon/http/ResponseInterface.php new file mode 100644 index 000000000..36f157f32 --- /dev/null +++ b/ide/2.0.8/Phalcon/http/ResponseInterface.php @@ -0,0 +1,150 @@ + + * response->setJsonContent(array("status" => "OK")); + * + * + * @param string $content + * @return \Phalcon\Http\ResponseInterface + */ + public function setJsonContent($content); + + /** + * Appends a string to the HTTP response body + * + * @param string $content + * @return \Phalcon\Http\ResponseInterface + */ + public function appendContent($content); + + /** + * Gets the HTTP response body + * + * @return string + */ + public function getContent(); + + /** + * Sends headers to the client + * + * @return ResponseInterface + */ + public function sendHeaders(); + + /** + * Sends cookies to the client + * + * @return ResponseInterface + */ + public function sendCookies(); + + /** + * Prints out HTTP response to the client + * + * @return ResponseInterface + */ + public function send(); + + /** + * Sets an attached file to be sent at the end of the request + * + * @param string $filePath + * @param string $attachmentName + * @return ResponseInterface + */ + public function setFileToSend($filePath, $attachmentName = null); + +} diff --git a/ide/2.0.8/Phalcon/http/cookie/Exception.php b/ide/2.0.8/Phalcon/http/cookie/Exception.php new file mode 100644 index 000000000..a3dbbd67d --- /dev/null +++ b/ide/2.0.8/Phalcon/http/cookie/Exception.php @@ -0,0 +1,12 @@ + + * class PostsController extends \Phalcon\Mvc\Controller + * { + * public function uploadAction() + * { + * //Check if the user has uploaded files + * if ($this->request->hasFiles() == true) { + * //Print the real file names and their sizes + * foreach ($this->request->getUploadedFiles() as $file){ + * echo $file->getName(), " ", $file->getSize(), "\n"; + * } + * } + * } + * } + * + */ +class File implements \Phalcon\Http\Request\FileInterface +{ + + protected $_name; + + + protected $_tmp; + + + protected $_size; + + + protected $_type; + + + protected $_realType; + + /** + * @var string|null + */ + protected $_error; + + /** + * @var string|null + */ + protected $_key; + + /** + * @var string + */ + protected $_extension; + + + /** + * @return string|null + */ + public function getError() {} + + /** + * @return string|null + */ + public function getKey() {} + + /** + * @return string + */ + public function getExtension() {} + + /** + * Phalcon\Http\Request\File constructor + * + * @param array $file + * @param mixed $key + */ + public function __construct($file, $key = null) {} + + /** + * Returns the file size of the uploaded file + * + * @return int + */ + public function getSize() {} + + /** + * Returns the real name of the uploaded file + * + * @return string + */ + public function getName() {} + + /** + * Returns the temporal name of the uploaded file + * + * @return string + */ + public function getTempName() {} + + /** + * Returns the mime type reported by the browser + * This mime type is not completely secure, use getRealType() instead + * + * @return string + */ + public function getType() {} + + /** + * Gets the real mime type of the upload file using finfo + * + * @return string + */ + public function getRealType() {} + + /** + * Checks whether the file has been uploaded via Post. + * + * @return bool + */ + public function isUploadedFile() {} + + /** + * Moves the temporary file to a destination within the application + * + * @param string $destination + * @return bool + */ + public function moveTo($destination) {} + +} diff --git a/ide/2.0.8/Phalcon/http/request/FileInterface.php b/ide/2.0.8/Phalcon/http/request/FileInterface.php new file mode 100644 index 000000000..3e3109e86 --- /dev/null +++ b/ide/2.0.8/Phalcon/http/request/FileInterface.php @@ -0,0 +1,64 @@ + + * $image = new Phalcon\Image\Adapter\Imagick("upload/test.jpg"); + * $image->resize(200, 200)->rotate(90)->crop(100, 100); + * if ($image->save()) { + * echo 'success'; + * } + * + */ +class Imagick extends \Phalcon\Image\Adapter implements \Phalcon\Image\AdapterInterface +{ + + static protected $_version = 0; + + + static protected $_checked = false; + + + /** + * Checks if Imagick is enabled + * + * @return bool + */ + public static function check() {} + + /** + * \Phalcon\Image\Adapter\Imagick constructor + * + * @param string $file + * @param int $width + * @param int $height + */ + public function __construct($file, $width = null, $height = null) {} + + /** + * Execute a resize. + * + * @param int $width + * @param int $height + */ + protected function _resize($width, $height) {} + + /** + * This method scales the images using liquid rescaling method. Only support Imagick + * + * @param int $width + * @param int $height + * @param int $deltaX + * @param int $rigidity + * @param int $$width new width + * @param int $$height new height + * @param int $$deltaX How much the seam can traverse on x-axis. Passing 0 causes the seams to be straight. + * @param int $$rigidity Introduces a bias for non-straight seams. This parameter is typically 0. + */ + protected function _liquidRescale($width, $height, $deltaX, $rigidity) {} + + /** + * Execute a crop. + * + * @param int $width + * @param int $height + * @param int $offsetX + * @param int $offsetY + */ + protected function _crop($width, $height, $offsetX, $offsetY) {} + + /** + * Execute a rotation. + * + * @param int $degrees + */ + protected function _rotate($degrees) {} + + /** + * Execute a flip. + * + * @param int $direction + */ + protected function _flip($direction) {} + + /** + * Execute a sharpen. + * + * @param int $amount + */ + protected function _sharpen($amount) {} + + /** + * Execute a reflection. + * + * @param int $height + * @param int $opacity + * @param bool $fadeIn + */ + protected function _reflection($height, $opacity, $fadeIn) {} + + /** + * Execute a watermarking. + * + * @param mixed $image + * @param int $offsetX + * @param int $offsetY + * @param int $opacity + */ + protected function _watermark(\Phalcon\Image\Adapter $image, $offsetX, $offsetY, $opacity) {} + + /** + * Execute a text + * + * @param string $text + * @param mixed $offsetX + * @param mixed $offsetY + * @param int $opacity + * @param int $r + * @param int $g + * @param int $b + * @param int $size + * @param string $fontfile + */ + protected function _text($text, $offsetX, $offsetY, $opacity, $r, $g, $b, $size, $fontfile) {} + + /** + * Composite one image onto another + * + * @param mixed $image + * @param Adapter $$mask mask Image instance + */ + protected function _mask(\Phalcon\Image\Adapter $image) {} + + /** + * Execute a background. + * + * @param int $r + * @param int $g + * @param int $b + * @param int $opacity + */ + protected function _background($r, $g, $b, $opacity) {} + + /** + * Blur image + * + * @param int $radius + * @param int $$radius Blur radius + */ + protected function _blur($radius) {} + + /** + * Pixelate image + * + * @param int $amount + * @param int $$amount amount to pixelate + */ + protected function _pixelate($amount) {} + + /** + * Execute a save. + * + * @param string $file + * @param int $quality + */ + protected function _save($file, $quality) {} + + /** + * Execute a render. + * + * @param string $extension + * @param int $quality + * @return string + */ + protected function _render($extension, $quality) {} + + /** + * Destroys the loaded image to free up resources. + */ + public function __destruct() {} + + /** + * Get instance + * + * @return \Imagick + */ + public function getInternalImInstance() {} + + /** + * Sets the limit for a particular resource in megabytes + * + * @param int $type Refer to the list of resourcetype constants (@see http://php.net/manual/ru/imagick.constants.php#imagick.constants.resourcetypes.) + * @param int $limit The resource limit. The unit depends on the type of the resource being limited. + */ + public function setResourceLimit($type, $limit) {} + +} diff --git a/ide/2.0.8/Phalcon/loader/Exception.php b/ide/2.0.8/Phalcon/loader/Exception.php new file mode 100644 index 000000000..0732e2934 --- /dev/null +++ b/ide/2.0.8/Phalcon/loader/Exception.php @@ -0,0 +1,12 @@ + + * $logger = new \Phalcon\Logger\Adapter\File("app/logs/test.log"); + * $logger->log("This is a message"); + * $logger->log("This is an error", \Phalcon\Logger::ERROR); + * $logger->error("This is another error"); + * $logger->close(); + * + */ +class File extends \Phalcon\Logger\Adapter implements \Phalcon\Logger\AdapterInterface +{ + /** + * File handler resource + * + * @var resource + */ + protected $_fileHandler; + + /** + * File Path + */ + protected $_path; + + /** + * Path options + */ + protected $_options; + + + /** + * File Path + */ + public function getPath() {} + + /** + * Phalcon\Logger\Adapter\File constructor + * + * @param string $name + * @param array $options + */ + public function __construct($name, $options = null) {} + + /** + * Returns the internal formatter + * + * @return \Phalcon\Logger\FormatterInterface + */ + public function getFormatter() {} + + /** + * Writes the log to the file itself + * + * @param string $message + * @param int $type + * @param int $time + * @param array $context + */ + public function logInternal($message, $type, $time, $context) {} + + /** + * Closes the logger + * + * @return bool + */ + public function close() {} + + /** + * Opens the internal file handler after unserialization + */ + public function __wakeup() {} + +} diff --git a/ide/2.0.8/Phalcon/logger/adapter/Firephp.php b/ide/2.0.8/Phalcon/logger/adapter/Firephp.php new file mode 100644 index 000000000..8066f6805 --- /dev/null +++ b/ide/2.0.8/Phalcon/logger/adapter/Firephp.php @@ -0,0 +1,52 @@ + + * $logger = new \Phalcon\Logger\Adapter\Firephp(""); + * $logger->log(\Phalcon\Logger::ERROR, "This is an error"); + * $logger->error("This is another error"); + * + */ +class Firephp extends \Phalcon\Logger\Adapter implements \Phalcon\Logger\AdapterInterface +{ + + static private $_initialized; + + + static private $_index; + + + /** + * Returns the internal formatter + * + * @return \Phalcon\Logger\FormatterInterface + */ + public function getFormatter() {} + + /** + * Writes the log to the stream itself + * + * @see http://www.firephp.org/Wiki/Reference/Protocol + * @param string $message + * @param int $type + * @param int $time + * @param array $context + * @param string $$message + * @param int $$type + * @param int $$time + * @param array $$context + */ + public function logInternal($message, $type, $time, $context) {} + + /** + * Closes the logger + * + * @return bool + */ + public function close() {} + +} diff --git a/ide/2.0.8/Phalcon/logger/adapter/Stream.php b/ide/2.0.8/Phalcon/logger/adapter/Stream.php new file mode 100644 index 000000000..dd26d9015 --- /dev/null +++ b/ide/2.0.8/Phalcon/logger/adapter/Stream.php @@ -0,0 +1,57 @@ + + * $logger = new \Phalcon\Logger\Adapter\Stream("php://stderr"); + * $logger->log("This is a message"); + * $logger->log("This is an error", \Phalcon\Logger::ERROR); + * $logger->error("This is another error"); + * + */ +class Stream extends \Phalcon\Logger\Adapter implements \Phalcon\Logger\AdapterInterface +{ + /** + * File handler resource + * + * @var resource + */ + protected $_stream; + + + /** + * Phalcon\Logger\Adapter\Stream constructor + * + * @param string $name + * @param array $options + */ + public function __construct($name, $options = null) {} + + /** + * Returns the internal formatter + * + * @return \Phalcon\Logger\FormatterInterface + */ + public function getFormatter() {} + + /** + * Writes the log to the stream itself + * + * @param string $message + * @param int $type + * @param int $time + * @param array $context + */ + public function logInternal($message, $type, $time, $context) {} + + /** + * Closes the logger + * + * @return bool + */ + public function close() {} + +} diff --git a/ide/2.0.8/Phalcon/logger/adapter/Syslog.php b/ide/2.0.8/Phalcon/logger/adapter/Syslog.php new file mode 100644 index 000000000..cc0eb1569 --- /dev/null +++ b/ide/2.0.8/Phalcon/logger/adapter/Syslog.php @@ -0,0 +1,57 @@ + + * $logger = new \Phalcon\Logger\Adapter\Syslog("ident", array( + * 'option' => LOG_NDELAY, + * 'facility' => LOG_MAIL + * )); + * $logger->log("This is a message"); + * $logger->log("This is an error", \Phalcon\Logger::ERROR); + * $logger->error("This is another error"); + * + */ +class Syslog extends \Phalcon\Logger\Adapter implements \Phalcon\Logger\AdapterInterface +{ + + protected $_opened = false; + + + /** + * Phalcon\Logger\Adapter\Syslog constructor + * + * @param string $name + * @param array $options + */ + public function __construct($name, $options = null) {} + + /** + * Returns the internal formatter + * + * @return \Phalcon\Logger\Formatter\Syslog + */ + public function getFormatter() {} + + /** + * Writes the log to the stream itself + * + * @param string $message + * @param int $type + * @param int $time + * @param array $context + * @param array $$context + */ + public function logInternal($message, $type, $time, $context) {} + + /** + * Closes the logger + * + * @return boolean + */ + public function close() {} + +} diff --git a/ide/2.0.8/Phalcon/logger/formatter/Firephp.php b/ide/2.0.8/Phalcon/logger/formatter/Firephp.php new file mode 100644 index 000000000..567c7aee9 --- /dev/null +++ b/ide/2.0.8/Phalcon/logger/formatter/Firephp.php @@ -0,0 +1,71 @@ + + * class Application extends \Phalcon\Mvc\Application + * { + * / + * Register the services here to make them general or register + * in the ModuleDefinition to make them module-specific + * \/ + * protected function _registerServices() + * { + * } + * / + * This method registers all the modules in the application + * \/ + * public function main() + * { + * $this->registerModules(array( + * 'frontend' => array( + * 'className' => 'Multiple\Frontend\Module', + * 'path' => '../apps/frontend/Module.php' + * ), + * 'backend' => array( + * 'className' => 'Multiple\Backend\Module', + * 'path' => '../apps/backend/Module.php' + * ) + * )); + * } + * } + * $application = new Application(); + * $application->main(); + * + */ +class Application extends \Phalcon\Di\Injectable +{ + + protected $_defaultModule; + + + protected $_modules; + + + protected $_implicitView = true; + + + /** + * Phalcon\Mvc\Application + * + * @param mixed $dependencyInjector + */ + public function __construct(\Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * By default. The view is implicitly buffering all the output + * You can full disable the view component using this method + * + * @param bool $implicitView + * @return Application + */ + public function useImplicitView($implicitView) {} + + /** + * Register an array of modules present in the application + * + * $this->registerModules(array( + * 'frontend' => array( + * 'className' => 'Multiple\Frontend\Module', + * 'path' => '../apps/frontend/Module.php' + * ), + * 'backend' => array( + * 'className' => 'Multiple\Backend\Module', + * 'path' => '../apps/backend/Module.php' + * ) + * )); + * + * + * @param array $modules + * @param bool $merge + * @return Application + */ + public function registerModules($modules, $merge = false) {} + + /** + * Return the modules registered in the application + * + * @return array + */ + public function getModules() {} + + /** + * Gets the module definition registered in the application via module name + * + * @param string $name + * @return array|object + */ + public function getModule($name) {} + + /** + * Sets the module name to be used if the router doesn't return a valid module + * + * @param string $defaultModule + * @return Application + */ + public function setDefaultModule($defaultModule) {} + + /** + * Returns the default module name + * + * @return string + */ + public function getDefaultModule() {} + + /** + * Handles a MVC request + * + * @param string $uri + * @return \Phalcon\Http\ResponseInterface|boolean + */ + public function handle($uri = null) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/Collection.php b/ide/2.0.8/Phalcon/mvc/Collection.php new file mode 100644 index 000000000..53b3a5f2e --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/Collection.php @@ -0,0 +1,509 @@ + + * echo $robot->readAttribute('name'); + * + * + * @param string $attribute + * @return mixed + */ + public function readAttribute($attribute) {} + + /** + * Writes an attribute value by its name + * + * $robot->writeAttribute('name', 'Rosey'); + * + * + * @param string $attribute + * @param mixed $value + */ + public function writeAttribute($attribute, $value) {} + + /** + * Returns a cloned collection + * + * @param mixed $collection + * @param array $document + * @return CollectionInterface + */ + public static function cloneResult(CollectionInterface $collection, $document) {} + + /** + * Returns a collection resultset + * + * @param array $params + * @param \Phalcon\Mvc\Collection $collection + * @param \MongoDb $connection + * @param boolean $unique + * @return array + */ + protected static function _getResultset($params, CollectionInterface $collection, $connection, $unique) {} + + /** + * Perform a count over a resultset + * + * @param array $params + * @param \Phalcon\Mvc\Collection $collection + * @param \MongoDb $connection + * @return int + */ + protected static function _getGroupResultset($params, Collection $collection, $connection) {} + + /** + * Executes internal hooks before save a document + * + * @param \Phalcon\DiInterface $dependencyInjector + * @param boolean $disableEvents + * @param boolean $exists + * @return boolean + */ + protected final function _preSave($dependencyInjector, $disableEvents, $exists) {} + + /** + * Executes internal events after save a document + * + * @param bool $disableEvents + * @param bool $success + * @param bool $exists + * @return bool + */ + protected final function _postSave($disableEvents, $success, $exists) {} + + /** + * Executes validators on every validation call + * + * use Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; + * class Subscriptors extends \Phalcon\Mvc\Collection + * { + * public function validation() + * { + * this->validate(new ExclusionIn(array( + * 'field' => 'status', + * 'domain' => array('A', 'I') + * ))); + * if (this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + * + * @param mixed $validator + */ + protected function validate(Model\ValidatorInterface $validator) {} + + /** + * Check whether validation process has generated any messages + * + * use Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; + * class Subscriptors extends \Phalcon\Mvc\Collection + * { + * public function validation() + * { + * this->validate(new ExclusionIn(array( + * 'field' => 'status', + * 'domain' => array('A', 'I') + * ))); + * if (this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + * + * @return bool + */ + public function validationHasFailed() {} + + /** + * Fires an internal event + * + * @param string $eventName + * @return bool + */ + public function fireEvent($eventName) {} + + /** + * Fires an internal event that cancels the operation + * + * @param string $eventName + * @return bool + */ + public function fireEventCancel($eventName) {} + + /** + * Cancel the current operation + * + * @param bool $disableEvents + * @return bool + */ + protected function _cancelOperation($disableEvents) {} + + /** + * Checks if the document exists in the collection + * + * @param \MongoCollection $collection + * @return boolean + */ + protected function _exists($collection) {} + + /** + * Returns all the validation messages + * + * $robot = new Robots(); + * $robot->type = 'mechanical'; + * $robot->name = 'Astro Boy'; + * $robot->year = 1952; + * if ($robot->save() == false) { + * echo "Umh, We can't store robots right now "; + * foreach ($robot->getMessages() as message) { + * echo message; + * } + * } else { + * echo "Great, a new robot was saved successfully!"; + * } + * + * + * @return \Phalcon\Mvc\Model\MessageInterface + */ + public function getMessages() {} + + /** + * Appends a customized message on the validation process + * + * use \Phalcon\Mvc\Model\Message as Message; + * class Robots extends \Phalcon\Mvc\Model + * { + * public function beforeSave() + * { + * if ($this->name == 'Peter') { + * message = new Message("Sorry, but a robot cannot be named Peter"); + * $this->appendMessage(message); + * } + * } + * } + * + * + * @param mixed $message + */ + public function appendMessage(\Phalcon\Mvc\Model\MessageInterface $message) {} + + /** + * Creates/Updates a collection based on the values in the attributes + * + * @return bool + */ + public function save() {} + + /** + * Find a document by its id (_id) + * + * @param string|\MongoId $id + * @return \Phalcon\Mvc\Collection + */ + public static function findById($id) {} + + /** + * Allows to query the first record that match the specified conditions + * + * //What's the first robot in the robots table? + * $robot = Robots::findFirst(); + * echo "The robot name is ", $robot->name, "\n"; + * //What's the first mechanical robot in robots table? + * $robot = Robots::findFirst(array( + * array("type" => "mechanical") + * )); + * echo "The first mechanical robot name is ", $robot->name, "\n"; + * //Get first virtual robot ordered by name + * $robot = Robots::findFirst(array( + * array("type" => "mechanical"), + * "order" => array("name" => 1) + * )); + * echo "The first virtual robot name is ", $robot->name, "\n"; + * + * + * @param array $parameters + * @return array + */ + public static function findFirst($parameters = null) {} + + /** + * Allows to query a set of records that match the specified conditions + * + * //How many robots are there? + * $robots = Robots::find(); + * echo "There are ", count($robots), "\n"; + * //How many mechanical robots are there? + * $robots = Robots::find(array( + * array("type" => "mechanical") + * )); + * echo "There are ", count(robots), "\n"; + * //Get and print virtual robots ordered by name + * $robots = Robots::findFirst(array( + * array("type" => "virtual"), + * "order" => array("name" => 1) + * )); + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * //Get first 100 virtual robots ordered by name + * $robots = Robots::find(array( + * array("type" => "virtual"), + * "order" => array("name" => 1), + * "limit" => 100 + * )); + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * + * + * @param array $parameters + * @return array + */ + public static function find($parameters = null) {} + + /** + * Perform a count over a collection + * + * echo 'There are ', Robots::count(), ' robots'; + * + * + * @param array $parameters + * @return array + */ + public static function count($parameters = null) {} + + /** + * Perform an aggregation using the Mongo aggregation framework + * + * @param array $parameters + * @return array + */ + public static function aggregate($parameters = null) {} + + /** + * Allows to perform a summatory group for a column in the collection + * + * @param string $field + * @param mixed $conditions + * @param mixed $finalize + * @return array + */ + public static function summatory($field, $conditions = null, $finalize = null) {} + + /** + * Deletes a model instance. Returning true on success or false otherwise. + * + * $robot = Robots::findFirst(); + * $robot->delete(); + * foreach (Robots::find() as $robot) { + * $robot->delete(); + * } + * + * + * @return bool + */ + public function delete() {} + + /** + * Sets up a behavior in a collection + * + * @param mixed $behavior + */ + protected function addBehavior(\Phalcon\Mvc\Collection\BehaviorInterface $behavior) {} + + /** + * Skips the current operation forcing a success state + * + * @param bool $skip + */ + public function skipOperation($skip) {} + + /** + * Returns the instance as an array representation + * + * print_r($robot->toArray()); + * + * + * @return array + */ + public function toArray() {} + + /** + * Serializes the object ignoring connections or protected properties + * + * @return string + */ + public function serialize() {} + + /** + * Unserializes the object from a serialized string + * + * @param string $data + */ + public function unserialize($data) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/CollectionInterface.php b/ide/2.0.8/Phalcon/mvc/CollectionInterface.php new file mode 100644 index 000000000..f72bb909f --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/CollectionInterface.php @@ -0,0 +1,148 @@ + + * dispatcher->forward(array('controller' => 'people', 'action' => 'index')); + * } + * } + * + */ +abstract class Controller extends \Phalcon\Di\Injectable implements \Phalcon\Mvc\ControllerInterface +{ + + /** + * Phalcon\Mvc\Controller constructor + */ + public final function __construct() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/ControllerInterface.php b/ide/2.0.8/Phalcon/mvc/ControllerInterface.php new file mode 100644 index 000000000..a46083149 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/ControllerInterface.php @@ -0,0 +1,12 @@ + + * $di = new \Phalcon\Di(); + * $dispatcher = new \Phalcon\Mvc\Dispatcher(); + * $dispatcher->setDI($di); + * $dispatcher->setControllerName('posts'); + * $dispatcher->setActionName('index'); + * $dispatcher->setParams(array()); + * $controller = $dispatcher->dispatch(); + * + */ +class Dispatcher extends \Phalcon\Dispatcher implements \Phalcon\Mvc\DispatcherInterface +{ + + protected $_handlerSuffix = "Controller"; + + + protected $_defaultHandler = "index"; + + + protected $_defaultAction = "index"; + + + /** + * Sets the default controller suffix + * + * @param string $controllerSuffix + */ + public function setControllerSuffix($controllerSuffix) {} + + /** + * Sets the default controller name + * + * @param string $controllerName + */ + public function setDefaultController($controllerName) {} + + /** + * Sets the controller name to be dispatched + * + * @param string $controllerName + */ + public function setControllerName($controllerName) {} + + /** + * Gets last dispatched controller name + * + * @return string + */ + public function getControllerName() {} + + /** + * Gets previous dispatched controller name + * + * @return string + */ + public function getPreviousControllerName() {} + + /** + * Gets previous dispatched action name + * + * @return string + */ + public function getPreviousActionName() {} + + /** + * Throws an internal exception + * + * @param string $message + * @param int $exceptionCode + */ + protected function _throwDispatchException($message, $exceptionCode = 0) {} + + /** + * Handles a user exception + * + * @param mixed $exception + */ + protected function _handleException(\Exception $exception) {} + + /** + * Possible controller class name that will be located to dispatch the request + * + * @return string + */ + public function getControllerClass() {} + + /** + * Returns the lastest dispatched controller + * + * @return \Phalcon\Mvc\ControllerInterface + */ + public function getLastController() {} + + /** + * Returns the active controller in the dispatcher + * + * @return \Phalcon\Mvc\ControllerInterface + */ + public function getActiveController() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/DispatcherInterface.php b/ide/2.0.8/Phalcon/mvc/DispatcherInterface.php new file mode 100644 index 000000000..d232517a7 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/DispatcherInterface.php @@ -0,0 +1,54 @@ + + * $app = new \Phalcon\Mvc\Micro(); + * $app->get('/say/welcome/{name}', function ($name) { + * echo "

Welcome $name!

"; + * }); + * $app->handle(); + * + */ +class Micro extends \Phalcon\Di\Injectable implements \ArrayAccess +{ + + protected $_dependencyInjector; + + + protected $_handlers; + + + protected $_router; + + + protected $_stopped; + + + protected $_notFoundHandler; + + + protected $_errorHandler; + + + protected $_activeHandler; + + + protected $_beforeHandlers; + + + protected $_afterHandlers; + + + protected $_finishHandlers; + + + protected $_returnedValue; + + + /** + * Phalcon\Mvc\Micro constructor + * + * @param mixed $dependencyInjector + */ + public function __construct(\Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Maps a route to a handler without any HTTP method constraint + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function map($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is GET + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function get($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is POST + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function post($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is PUT + * + * @param string $routePattern + * @param mixed $handler + * @param string $$routePattern + * @param callable $$handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function put($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is PATCH + * + * @param string $routePattern + * @param mixed $handler + * @param string $$routePattern + * @param callable $$handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function patch($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is HEAD + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function head($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is DELETE + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function delete($routePattern, $handler) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is OPTIONS + * + * @param string $routePattern + * @param callable $handler + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function options($routePattern, $handler) {} + + /** + * Mounts a collection of handlers + * + * @param mixed $collection + * @return Micro + */ + public function mount(\Phalcon\Mvc\Micro\CollectionInterface $collection) {} + + /** + * Sets a handler that will be called when the router doesn't match any of the defined routes + * + * @param callable $handler + * @return \Phalcon\Mvc\Micro + */ + public function notFound($handler) {} + + /** + * Sets a handler that will be called when an exception is thrown handling the route + * + * @param callable $handler + * @return \Phalcon\Mvc\Micro + */ + public function error($handler) {} + + /** + * Returns the internal router used by the application + * + * @return RouterInterface + */ + public function getRouter() {} + + /** + * Sets a service from the DI + * + * @param string $serviceName + * @param mixed $definition + * @param boolean $shared + * @return \Phalcon\Di\ServiceInterface + */ + public function setService($serviceName, $definition, $shared = false) {} + + /** + * Checks if a service is registered in the DI + * + * @param string $serviceName + * @return bool + */ + public function hasService($serviceName) {} + + /** + * Obtains a service from the DI + * + * @param string $serviceName + * @return object + */ + public function getService($serviceName) {} + + /** + * Obtains a shared service from the DI + * + * @param string $serviceName + * @return mixed + */ + public function getSharedService($serviceName) {} + + /** + * Handle the whole request + * + * @param string $uri + * @return mixed + */ + public function handle($uri = null) {} + + /** + * Stops the middleware execution avoiding than other middlewares be executed + */ + public function stop() {} + + /** + * Sets externally the handler that must be called by the matched route + * + * @param callable $activeHandler + */ + public function setActiveHandler($activeHandler) {} + + /** + * Return the handler that will be called for the matched route + * + * @return callable + */ + public function getActiveHandler() {} + + /** + * Returns the value returned by the executed handler + * + * @return mixed + */ + public function getReturnedValue() {} + + /** + * Check if a service is registered in the internal services container using the array syntax + * + * @param string $alias + * @return boolean + */ + public function offsetExists($alias) {} + + /** + * Allows to register a shared service in the internal services container using the array syntax + * + * $app['request'] = new \Phalcon\Http\Request(); + * + * + * @param string $alias + * @param mixed $definition + */ + public function offsetSet($alias, $definition) {} + + /** + * Allows to obtain a shared service in the internal services container using the array syntax + * + * var_dump($di['request']); + * + * + * @param string $alias + * @return mixed + */ + public function offsetGet($alias) {} + + /** + * Removes a service from the internal services container using the array syntax + * + * @param string $alias + */ + public function offsetUnset($alias) {} + + /** + * Appends a before middleware to be called before execute the route + * + * @param callable $handler + * @return \Phalcon\Mvc\Micro + */ + public function before($handler) {} + + /** + * Appends an 'after' middleware to be called after execute the route + * + * @param callable $handler + * @return \Phalcon\Mvc\Micro + */ + public function after($handler) {} + + /** + * Appends a 'finish' middleware to be called when the request is finished + * + * @param callable $handler + * @return \Phalcon\Mvc\Micro + */ + public function finish($handler) {} + + /** + * Returns the internal handlers attached to the application + * + * @return array + */ + public function getHandlers() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/Model.php b/ide/2.0.8/Phalcon/mvc/Model.php new file mode 100644 index 000000000..b2d23f37c --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/Model.php @@ -0,0 +1,1204 @@ + + * $robot = new Robots(); + * $robot->type = 'mechanical'; + * $robot->name = 'Astro Boy'; + * $robot->year = 1952; + * if ($robot->save() == false) { + * echo "Umh, We can store robots: "; + * foreach ($robot->getMessages() as $message) { + * echo message; + * } + * } else { + * echo "Great, a new robot was saved successfully!"; + * } + * + */ +abstract class Model implements \Phalcon\Mvc\EntityInterface, \Phalcon\Mvc\ModelInterface, \Phalcon\Mvc\Model\ResultInterface, \Phalcon\Di\InjectionAwareInterface, \Serializable +{ + + const OP_NONE = 0; + + + const OP_CREATE = 1; + + + const OP_UPDATE = 2; + + + const OP_DELETE = 3; + + + const DIRTY_STATE_PERSISTENT = 0; + + + const DIRTY_STATE_TRANSIENT = 1; + + + const DIRTY_STATE_DETACHED = 2; + + + protected $_dependencyInjector; + + + protected $_modelsManager; + + + protected $_modelsMetaData; + + + protected $_errorMessages; + + + protected $_operationMade = 0; + + + protected $_dirtyState = 1; + + + protected $_transaction; + + + protected $_uniqueKey; + + + protected $_uniqueParams; + + + protected $_uniqueTypes; + + + protected $_skipped; + + + protected $_related; + + + protected $_snapshot; + + + /** + * Phalcon\Mvc\Model constructor + * + * @param mixed $dependencyInjector + * @param mixed $modelsManager + */ + public final function __construct(\Phalcon\DiInterface $dependencyInjector = null, \Phalcon\Mvc\Model\ManagerInterface $modelsManager = null) {} + + /** + * Sets the dependency injection container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the dependency injection container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets a custom events manager + * + * @param mixed $eventsManager + */ + protected function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the custom events manager + * + * @return \Phalcon\Events\ManagerInterface + */ + protected function getEventsManager() {} + + /** + * Returns the models meta-data service related to the entity instance + * + * @return \Phalcon\Mvc\Model\MetaDataInterface + */ + public function getModelsMetaData() {} + + /** + * Returns the models manager related to the entity instance + * + * @return \Phalcon\Mvc\Model\ManagerInterface + */ + public function getModelsManager() {} + + /** + * Sets a transaction related to the Model instance + * + * use Phalcon\Mvc\Model\Transaction\Manager as TxManager; + * use Phalcon\Mvc\Model\Transaction\Failed as TxFailed; + * try { + * $txManager = new TxManager(); + * $transaction = $txManager->get(); + * $robot = new Robots(); + * $robot->setTransaction($transaction); + * $robot->name = 'WALL·E'; + * $robot->created_at = date('Y-m-d'); + * if ($robot->save() == false) { + * $transaction->rollback("Can't save robot"); + * } + * $robotPart = new RobotParts(); + * $robotPart->setTransaction($transaction); + * $robotPart->type = 'head'; + * if ($robotPart->save() == false) { + * $transaction->rollback("Robot part cannot be saved"); + * } + * $transaction->commit(); + * } catch (TxFailed $e) { + * echo 'Failed, reason: ', $e->getMessage(); + * } + * + * + * @param mixed $transaction + * @return Model + */ + public function setTransaction(\Phalcon\Mvc\Model\TransactionInterface $transaction) {} + + /** + * Sets table name which model should be mapped + * + * @param string $source + * @return Model + */ + protected function setSource($source) {} + + /** + * Returns table name mapped in the model + * + * @return string + */ + public function getSource() {} + + /** + * Sets schema name where table mapped is located + * + * @param string $schema + * @return Model + */ + protected function setSchema($schema) {} + + /** + * Returns schema name where table mapped is located + * + * @return string + */ + public function getSchema() {} + + /** + * Sets the DependencyInjection connection service name + * + * @param string $connectionService + * @return Model + */ + public function setConnectionService($connectionService) {} + + /** + * Sets the DependencyInjection connection service name used to read data + * + * @param string $connectionService + * @return Model + */ + public function setReadConnectionService($connectionService) {} + + /** + * Sets the DependencyInjection connection service name used to write data + * + * @param string $connectionService + * @return Model + */ + public function setWriteConnectionService($connectionService) {} + + /** + * Returns the DependencyInjection connection service name used to read data related the model + * + * @return string + */ + public function getReadConnectionService() {} + + /** + * Returns the DependencyInjection connection service name used to write data related to the model + * + * @return string + */ + public function getWriteConnectionService() {} + + /** + * Sets the dirty state of the object using one of the DIRTY_STATE_* constants + * + * @param int $dirtyState + * @return ModelInterface + */ + public function setDirtyState($dirtyState) {} + + /** + * Returns one of the DIRTY_STATE_* constants telling if the record exists in the database or not + * + * @return int + */ + public function getDirtyState() {} + + /** + * Gets the connection used to read data for the model + * + * @return \Phalcon\Db\AdapterInterface + */ + public function getReadConnection() {} + + /** + * Gets the connection used to write data to the model + * + * @return \Phalcon\Db\AdapterInterface + */ + public function getWriteConnection() {} + + /** + * Assigns values to a model from an array + * + * $robot->assign(array( + * 'type' => 'mechanical', + * 'name' => 'Astro Boy', + * 'year' => 1952 + * )); + * //assign by db row, column map needed + * $robot->assign($dbRow, array( + * 'db_type' => 'type', + * 'db_name' => 'name', + * 'db_year' => 'year' + * )); + * //allow assign only name and year + * $robot->assign($_POST, null, array('name', 'year'); + * + * + * @param array $data + * @param array $dataColumnMap array to transform keys of data to another + * @param array $whiteList + * @return \Phalcon\Mvc\Model + */ + public function assign($data, $dataColumnMap = null, $whiteList = null) {} + + /** + * Assigns values to a model from an array returning a new model. + * + * $robot = \Phalcon\Mvc\Model::cloneResultMap(new Robots(), array( + * 'type' => 'mechanical', + * 'name' => 'Astro Boy', + * 'year' => 1952 + * )); + * + * + * @param \Phalcon\Mvc\ModelInterface|Phalcon\Mvc\Model\Row $base + * @param array $data + * @param array $columnMap + * @param int $dirtyState + * @param boolean $keepSnapshots + * @return \Phalcon\Mvc\Model + */ + public static function cloneResultMap($base, $data, $columnMap, $dirtyState = 0, $keepSnapshots = null) {} + + /** + * Returns an hydrated result based on the data and the column map + * + * @param array $data + * @param array $columnMap + * @param int $hydrationMode + * @return mixed + */ + public static function cloneResultMapHydrate($data, $columnMap, $hydrationMode) {} + + /** + * Assigns values to a model from an array returning a new model + * + * $robot = Phalcon\Mvc\Model::cloneResult(new Robots(), array( + * 'type' => 'mechanical', + * 'name' => 'Astro Boy', + * 'year' => 1952 + * )); + * + * + * @param mixed $base + * @param array $data + * @param int $dirtyState + * @param \Phalcon\Mvc\ModelInterface $$base + * @return \Phalcon\Mvc\ModelInterface + */ + public static function cloneResult(ModelInterface $base, $data, $dirtyState = 0) {} + + /** + * Allows to query a set of records that match the specified conditions + * + * //How many robots are there? + * $robots = Robots::find(); + * echo "There are ", count($robots), "\n"; + * //How many mechanical robots are there? + * $robots = Robots::find("type='mechanical'"); + * echo "There are ", count($robots), "\n"; + * //Get and print virtual robots ordered by name + * $robots = Robots::find(array("type='virtual'", "order" => "name")); + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * //Get first 100 virtual robots ordered by name + * $robots = Robots::find(array("type='virtual'", "order" => "name", "limit" => 100)); + * foreach ($robots as $robot) { + * echo $robot->name, "\n"; + * } + * + * + * @param mixed $parameters + * @param $array parameters + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + public static function find($parameters = null) {} + + /** + * Allows to query the first record that match the specified conditions + * + * //What's the first robot in robots table? + * $robot = Robots::findFirst(); + * echo "The robot name is ", $robot->name; + * //What's the first mechanical robot in robots table? + * $robot = Robots::findFirst("type='mechanical'"); + * echo "The first mechanical robot name is ", $robot->name; + * //Get first virtual robot ordered by name + * $robot = Robots::findFirst(array("type='virtual'", "order" => "name")); + * echo "The first virtual robot name is ", $robot->name; + * + * + * @param string|array $parameters + * @return \Phalcon\Mvc\Model + */ + public static function findFirst($parameters = null) {} + + /** + * Create a criteria for a specific model + * + * @param mixed $dependencyInjector + * @return \Phalcon\Mvc\Model\Criteria + */ + public static function query(\Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * Checks if the current record already exists or not + * + * @param \Phalcon\Mvc\Model\MetadataInterface $metaData + * @param \Phalcon\Db\AdapterInterface $connection + * @param string|array $table + * @return boolean + */ + protected function _exists(\Phalcon\Mvc\Model\MetadataInterface $metaData, \Phalcon\Db\AdapterInterface $connection, $table = null) {} + + /** + * Generate a PHQL SELECT statement for an aggregate + * + * @param string $functionName + * @param string $alias + * @param array $parameters + * @param string $function + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected static function _groupResult($functionName, $alias, $parameters) {} + + /** + * Allows to count how many records match the specified conditions + * + * //How many robots are there? + * $number = Robots::count(); + * echo "There are ", $number, "\n"; + * //How many mechanical robots are there? + * $number = Robots::count("type = 'mechanical'"); + * echo "There are ", $number, " mechanical robots\n"; + * + * + * @param array $parameters + * @return mixed + */ + public static function count($parameters = null) {} + + /** + * Allows to calculate a summatory on a column that match the specified conditions + * + * //How much are all robots? + * $sum = Robots::sum(array('column' => 'price')); + * echo "The total price of robots is ", $sum, "\n"; + * //How much are mechanical robots? + * $sum = Robots::sum(array("type = 'mechanical'", 'column' => 'price')); + * echo "The total price of mechanical robots is ", $sum, "\n"; + * + * + * @param array $parameters + * @return mixed + */ + public static function sum($parameters = null) {} + + /** + * Allows to get the maximum value of a column that match the specified conditions + * + * //What is the maximum robot id? + * $id = Robots::maximum(array('column' => 'id')); + * echo "The maximum robot id is: ", $id, "\n"; + * //What is the maximum id of mechanical robots? + * $sum = Robots::maximum(array("type='mechanical'", 'column' => 'id')); + * echo "The maximum robot id of mechanical robots is ", $id, "\n"; + * + * + * @param array $parameters + * @return mixed + */ + public static function maximum($parameters = null) {} + + /** + * Allows to get the minimum value of a column that match the specified conditions + * + * //What is the minimum robot id? + * $id = Robots::minimum(array('column' => 'id')); + * echo "The minimum robot id is: ", $id; + * //What is the minimum id of mechanical robots? + * $sum = Robots::minimum(array("type='mechanical'", 'column' => 'id')); + * echo "The minimum robot id of mechanical robots is ", $id; + * + * + * @param array $parameters + * @return mixed + */ + public static function minimum($parameters = null) {} + + /** + * Allows to calculate the average value on a column matching the specified conditions + * + * //What's the average price of robots? + * $average = Robots::average(array('column' => 'price')); + * echo "The average price is ", $average, "\n"; + * //What's the average price of mechanical robots? + * $average = Robots::average(array("type='mechanical'", 'column' => 'price')); + * echo "The average price of mechanical robots is ", $average, "\n"; + * + * + * @param array $parameters + * @return double + */ + public static function average($parameters = null) {} + + /** + * Fires an event, implicitly calls behaviors and listeners in the events manager are notified + * + * @param string $eventName + * @return bool + */ + public function fireEvent($eventName) {} + + /** + * Fires an event, implicitly calls behaviors and listeners in the events manager are notified + * This method stops if one of the callbacks/listeners returns boolean false + * + * @param string $eventName + * @return bool + */ + public function fireEventCancel($eventName) {} + + /** + * Cancel the current operation + */ + protected function _cancelOperation() {} + + /** + * Appends a customized message on the validation process + * + * use \Phalcon\Mvc\Model\Message as Message; + * class Robots extends \Phalcon\Mvc\Model + * { + * public function beforeSave() + * { + * if ($this->name == 'Peter') { + * $message = new Message("Sorry, but a robot cannot be named Peter"); + * $this->appendMessage($message); + * } + * } + * } + * + * + * @param mixed $message + * @return Model + */ + public function appendMessage(\Phalcon\Mvc\Model\MessageInterface $message) {} + + /** + * Executes validators on every validation call + * + * use Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new ExclusionIn(array( + * 'field' => 'status', + * 'domain' => array('A', 'I') + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + * + * @param mixed $validator + * @return Model + */ + protected function validate(Model\ValidatorInterface $validator) {} + + /** + * Check whether validation process has generated any messages + * + * use Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionIn; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new ExclusionIn(array( + * 'field' => 'status', + * 'domain' => array('A', 'I') + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + * + * @return bool + */ + public function validationHasFailed() {} + + /** + * Returns array of validation messages + * + * $robot = new Robots(); + * $robot->type = 'mechanical'; + * $robot->name = 'Astro Boy'; + * $robot->year = 1952; + * if ($robot->save() == false) { + * echo "Umh, We can't store robots right now "; + * foreach ($robot->getMessages() as $message) { + * echo $message; + * } + * } else { + * echo "Great, a new robot was saved successfully!"; + * } + * + * + * @param mixed $filter + * @return \Phalcon\Mvc\Model\MessageInterface + */ + public function getMessages($filter = null) {} + + /** + * Reads "belongs to" relations and check the virtual foreign keys when inserting or updating records + * to verify that inserted/updated values are present in the related entity + * + * @return bool + */ + protected function _checkForeignKeysRestrict() {} + + /** + * Reads both "hasMany" and "hasOne" relations and checks the virtual foreign keys (cascade) when deleting records + * + * @return bool + */ + protected function _checkForeignKeysReverseCascade() {} + + /** + * Reads both "hasMany" and "hasOne" relations and checks the virtual foreign keys (restrict) when deleting records + * + * @return bool + */ + protected function _checkForeignKeysReverseRestrict() {} + + /** + * Executes internal hooks before save a record + * + * @param mixed $metaData + * @param bool $exists + * @param mixed $identityField + * @return bool + */ + protected function _preSave(\Phalcon\Mvc\Model\MetadataInterface $metaData, $exists, $identityField) {} + + /** + * Executes internal events after save a record + * + * @param bool $success + * @param bool $exists + * @return bool + */ + protected function _postSave($success, $exists) {} + + /** + * Sends a pre-build INSERT SQL statement to the relational database system + * + * @param \Phalcon\Mvc\Model\MetadataInterface $metaData + * @param \Phalcon\Db\AdapterInterface $connection + * @param string|array $table + * @param boolean|string $identityField + * @return boolean + */ + protected function _doLowInsert(\Phalcon\Mvc\Model\MetadataInterface $metaData, \Phalcon\Db\AdapterInterface $connection, $table, $identityField) {} + + /** + * Sends a pre-build UPDATE SQL statement to the relational database system + * + * @param \Phalcon\Mvc\Model\MetaDataInterface $metaData + * @param \Phalcon\Db\AdapterInterface $connection + * @param string|array $table + * @return boolean + */ + protected function _doLowUpdate(\Phalcon\Mvc\Model\MetaDataInterface $metaData, \Phalcon\Db\AdapterInterface $connection, $table) {} + + /** + * Saves related records that must be stored prior to save the master record + * + * @param \Phalcon\Db\AdapterInterface $connection + * @param \Phalcon\Mvc\ModelInterface[] $related + * @return boolean + */ + protected function _preSaveRelatedRecords(\Phalcon\Db\AdapterInterface $connection, $related) {} + + /** + * Save the related records assigned in the has-one/has-many relations + * + * @param \Phalcon\Db\AdapterInterface $connection + * @param \Phalcon\Mvc\ModelInterface[] $related + * @return boolean + */ + protected function _postSaveRelatedRecords(\Phalcon\Db\AdapterInterface $connection, $related) {} + + /** + * Inserts or updates a model instance. Returning true on success or false otherwise. + * + * //Creating a new robot + * $robot = new Robots(); + * $robot->type = 'mechanical'; + * $robot->name = 'Astro Boy'; + * $robot->year = 1952; + * $robot->save(); + * //Updating a robot name + * $robot = Robots::findFirst("id=100"); + * $robot->name = "Biomass"; + * $robot->save(); + * + * + * @param array $data + * @param array $whiteList + * @return boolean + */ + public function save($data = null, $whiteList = null) {} + + /** + * Inserts a model instance. If the instance already exists in the persistance it will throw an exception + * Returning true on success or false otherwise. + * + * //Creating a new robot + * $robot = new Robots(); + * $robot->type = 'mechanical'; + * $robot->name = 'Astro Boy'; + * $robot->year = 1952; + * $robot->create(); + * //Passing an array to create + * $robot = new Robots(); + * $robot->create(array( + * 'type' => 'mechanical', + * 'name' => 'Astroy Boy', + * 'year' => 1952 + * )); + * + * + * @param mixed $data + * @param mixed $whiteList + * @return bool + */ + public function create($data = null, $whiteList = null) {} + + /** + * Updates a model instance. If the instance doesn't exist in the persistance it will throw an exception + * Returning true on success or false otherwise. + * + * //Updating a robot name + * $robot = Robots::findFirst("id=100"); + * $robot->name = "Biomass"; + * $robot->update(); + * + * + * @param mixed $data + * @param mixed $whiteList + * @return bool + */ + public function update($data = null, $whiteList = null) {} + + /** + * Deletes a model instance. Returning true on success or false otherwise. + * + * $robot = Robots::findFirst("id=100"); + * $robot->delete(); + * foreach (Robots::find("type = 'mechanical'") as $robot) { + * $robot->delete(); + * } + * + * + * @return bool + */ + public function delete() {} + + /** + * Returns the type of the latest operation performed by the ORM + * Returns one of the OP_* class constants + * + * @return int + */ + public function getOperationMade() {} + + /** + * Refreshes the model attributes re-querying the record from the database + * + * @return Model + */ + public function refresh() {} + + /** + * Skips the current operation forcing a success state + * + * @param bool $skip + */ + public function skipOperation($skip) {} + + /** + * Reads an attribute value by its name + * + * echo $robot->readAttribute('name'); + * + * + * @param string $attribute + */ + public function readAttribute($attribute) {} + + /** + * Writes an attribute value by its name + * + * $robot->writeAttribute('name', 'Rosey'); + * + * + * @param string $attribute + * @param mixed $value + */ + public function writeAttribute($attribute, $value) {} + + /** + * Sets a list of attributes that must be skipped from the + * generated INSERT/UPDATE statement + * + * skipAttributes(array('price')); + * } + * } + * + * + * @param array $attributes + */ + protected function skipAttributes($attributes) {} + + /** + * Sets a list of attributes that must be skipped from the + * generated INSERT statement + * + * skipAttributesOnCreate(array('created_at')); + * } + * } + * + * + * @param array $attributes + */ + protected function skipAttributesOnCreate($attributes) {} + + /** + * Sets a list of attributes that must be skipped from the + * generated UPDATE statement + * + * skipAttributesOnUpdate(array('modified_in')); + * } + * } + * + * + * @param array $attributes + */ + protected function skipAttributesOnUpdate($attributes) {} + + /** + * Sets a list of attributes that must be skipped from the + * generated UPDATE statement + * + * allowEmptyStringValues(array('name')); + * } + * } + * + * + * @param array $attributes + */ + protected function allowEmptyStringValues($attributes) {} + + /** + * Setup a 1-1 relation between two models + * + * hasOne('id', 'RobotsDescription', 'robots_id'); + * } + * } + * + * + * @param mixed $fields + * @param string $referenceModel + * @param mixed $referencedFields + * @param mixed $options + * @return \Phalcon\Mvc\Model\Relation + */ + protected function hasOne($fields, $referenceModel, $referencedFields, $options = null) {} + + /** + * Setup a relation reverse 1-1 between two models + * + * belongsTo('robots_id', 'Robots', 'id'); + * } + * } + * + * + * @param mixed $fields + * @param string $referenceModel + * @param mixed $referencedFields + * @param mixed $options + * @return \Phalcon\Mvc\Model\Relation + */ + protected function belongsTo($fields, $referenceModel, $referencedFields, $options = null) {} + + /** + * Setup a relation 1-n between two models + * + * hasMany('id', 'RobotsParts', 'robots_id'); + * } + * } + * + * + * @param mixed $fields + * @param string $referenceModel + * @param mixed $referencedFields + * @param mixed $options + * @return \Phalcon\Mvc\Model\Relation + */ + protected function hasMany($fields, $referenceModel, $referencedFields, $options = null) {} + + /** + * Setup a relation n-n between two models through an intermediate relation + * + * hasManyToMany( + * 'id', + * 'RobotsParts', + * 'robots_id', + * 'parts_id', + * 'Parts', + * 'id' + * ); + * } + * } + * + * + * @param string|array fields + * @param string intermediateModel + * @param string|array intermediateFields + * @param string|array intermediateReferencedFields + * @param string referencedModel + * @param mixed $fields + * @param string $intermediateModel + * @param mixed $intermediateFields + * @param mixed $intermediateReferencedFields + * @param string $referenceModel + * @param string|array $referencedFields + * @param array $options + * @return \Phalcon\Mvc\Model\Relation + */ + protected function hasManyToMany($fields, $intermediateModel, $intermediateFields, $intermediateReferencedFields, $referenceModel, $referencedFields, $options = null) {} + + /** + * Setups a behavior in a model + * + * addBehavior(new Timestampable(array( + * 'onCreate' => array( + * 'field' => 'created_at', + * 'format' => 'Y-m-d' + * ) + * ))); + * } + * } + * + * + * @param mixed $behavior + */ + public function addBehavior(\Phalcon\Mvc\Model\BehaviorInterface $behavior) {} + + /** + * Sets if the model must keep the original record snapshot in memory + * + * keepSnapshots(true); + * } + * } + * + * + * @param bool $keepSnapshot + */ + protected function keepSnapshots($keepSnapshot) {} + + /** + * Sets the record's snapshot data. + * This method is used internally to set snapshot data when the model was set up to keep snapshot data + * + * @param array $data + * @param array $columnMap + */ + public function setSnapshotData($data, $columnMap = null) {} + + /** + * Checks if the object has internal snapshot data + * + * @return bool + */ + public function hasSnapshotData() {} + + /** + * Returns the internal snapshot data + * + * @return array + */ + public function getSnapshotData() {} + + /** + * Check if a specific attribute has changed + * This only works if the model is keeping data snapshots + * + * @param string|array $fieldName + * @return bool + */ + public function hasChanged($fieldName = null) {} + + /** + * Returns a list of changed values + * + * @return array + */ + public function getChangedFields() {} + + /** + * Sets if a model must use dynamic update instead of the all-field update + * + * useDynamicUpdate(true); + * } + * } + * + * + * @param bool $dynamicUpdate + */ + protected function useDynamicUpdate($dynamicUpdate) {} + + /** + * Returns related records based on defined relations + * + * @param string $alias + * @param array $arguments + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + public function getRelated($alias, $arguments = null) {} + + /** + * Returns related records defined relations depending on the method name + * + * @param string $modelName + * @param string $method + * @param array $arguments + * @return mixed + */ + protected function _getRelatedRecords($modelName, $method, $arguments) {} + + /** + * Try to check if the query must invoke a finder + * + * @param string $method + * @param array $arguments + * @return \Phalcon\Mvc\ModelInterface[]|\Phalcon\Mvc\ModelInterface|boolean + */ + protected final static function _invokeFinder($method, $arguments) {} + + /** + * Handles method calls when a method is not implemented + * + * @param string method + * @param array arguments + * @return mixed + * @param string $method + * @param mixed $arguments + */ + public function __call($method, $arguments) {} + + /** + * Handles method calls when a static method is not implemented + * + * @param string method + * @param array arguments + * @return mixed + * @param string $method + * @param mixed $arguments + */ + public static function __callStatic($method, $arguments) {} + + /** + * Magic method to assign values to the the model + * + * @param string $property + * @param mixed $value + */ + public function __set($property, $value) {} + + /** + * Magic method to get related records using the relation alias as a property + * + * @param string $property + * @return \Phalcon\Mvc\Model\Resultset|Phalcon\Mvc\Model + */ + public function __get($property) {} + + /** + * Magic method to check if a property is a valid relation + * + * @param string $property + * @return bool + */ + public function __isset($property) {} + + /** + * Serializes the object ignoring connections, services, related objects or static properties + * + * @return string + */ + public function serialize() {} + + /** + * Unserializes the object from a serialized string + * + * @param string $data + */ + public function unserialize($data) {} + + /** + * Returns a simple representation of the object that can be used with var_dump + * + * var_dump($robot->dump()); + * + * + * @return array + */ + public function dump() {} + + /** + * Returns the instance as an array representation + * + * print_r($robot->toArray()); + * + * + * @param mixed $columns + * @param array $$columns + * @return array + */ + public function toArray($columns = null) {} + + /** + * Enables/disables options in the ORM + * + * @param array $options + */ + public static function setup($options) {} + + /** + * Reset a model instance data + */ + public function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/ModelInterface.php b/ide/2.0.8/Phalcon/mvc/ModelInterface.php new file mode 100644 index 000000000..25a5e7752 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/ModelInterface.php @@ -0,0 +1,323 @@ + + * $router = new Router(); + * $router->add( + * "/documentation/{chapter}/{name}\.{type:[a-z]+}", + * array( + * "controller" => "documentation", + * "action" => "show" + * ) + * ); + * $router->handle(); + * echo $router->getControllerName(); + * + */ +class Router implements \Phalcon\Di\InjectionAwareInterface, \Phalcon\Mvc\RouterInterface, \Phalcon\Events\EventsAwareInterface +{ + + const URI_SOURCE_GET_URL = 0; + + + const URI_SOURCE_SERVER_REQUEST_URI = 1; + + + const POSITION_FIRST = 0; + + + const POSITION_LAST = 1; + + + protected $_dependencyInjector; + + + protected $_eventsManager; + + + protected $_uriSource; + + + protected $_namespace = null; + + + protected $_module = null; + + + protected $_controller = null; + + + protected $_action = null; + + + protected $_params; + + + protected $_routes; + + + protected $_matchedRoute; + + + protected $_matches; + + + protected $_wasMatched = false; + + + protected $_defaultNamespace; + + + protected $_defaultModule; + + + protected $_defaultController; + + + protected $_defaultAction; + + + protected $_defaultParams; + + + protected $_removeExtraSlashes; + + + protected $_notFoundPaths; + + + /** + * Phalcon\Mvc\Router constructor + * + * @param bool $defaultRoutes + */ + public function __construct($defaultRoutes = true) {} + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the events manager + * + * @param mixed $eventsManager + */ + public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the internal event manager + * + * @return \Phalcon\Events\ManagerInterface + */ + public function getEventsManager() {} + + /** + * Get rewrite info. This info is read from $_GET['_url']. This returns '/' if the rewrite information cannot be read + * + * @return string + */ + public function getRewriteUri() {} + + /** + * Sets the URI source. One of the URI_SOURCE_* constants + * + * $router->setUriSource(Router::URI_SOURCE_SERVER_REQUEST_URI); + * + * + * @param mixed $uriSource + * @return RouterInterface + */ + public function setUriSource($uriSource) {} + + /** + * Set whether router must remove the extra slashes in the handled routes + * + * @param bool $remove + * @return RouterInterface + */ + public function removeExtraSlashes($remove) {} + + /** + * Sets the name of the default namespace + * + * @param string $namespaceName + * @return RouterInterface + */ + public function setDefaultNamespace($namespaceName) {} + + /** + * Sets the name of the default module + * + * @param string $moduleName + * @return RouterInterface + */ + public function setDefaultModule($moduleName) {} + + /** + * Sets the default controller name + * + * @param string $controllerName + * @return RouterInterface + */ + public function setDefaultController($controllerName) {} + + /** + * Sets the default action name + * + * @param string $actionName + * @return RouterInterface + */ + public function setDefaultAction($actionName) {} + + /** + * Sets an array of default paths. If a route is missing a path the router will use the defined here + * This method must not be used to set a 404 route + * + * $router->setDefaults(array( + * 'module' => 'common', + * 'action' => 'index' + * )); + * + * + * @param array $defaults + * @return RouterInterface + */ + public function setDefaults($defaults) {} + + /** + * Returns an array of default parameters + * + * @return array + */ + public function getDefaults() {} + + /** + * Handles routing information received from the rewrite engine + * + * //Read the info from the rewrite engine + * $router->handle(); + * //Manually passing an URL + * $router->handle('/posts/edit/1'); + * + * + * @param string $uri + */ + public function handle($uri = null) {} + + /** + * Adds a route to the router without any HTTP constraint + * + * use Phalcon\Mvc\Router; + * $router->add('/about', 'About::index'); + * $router->add('/about', 'About::index', ['GET', 'POST']); + * $router->add('/about', 'About::index', ['GET', 'POST'], Router::POSITION_FIRST); + * + * + * @param string $pattern + * @param mixed $paths + * @param mixed $httpMethods + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function add($pattern, $paths = null, $httpMethods = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is GET + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addGet($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is POST + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPost($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is PUT + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPut($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is PATCH + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPatch($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is DELETE + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addDelete($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Add a route to the router that only match if the HTTP method is OPTIONS + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addOptions($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Adds a route to the router that only match if the HTTP method is HEAD + * + * @param string $pattern + * @param mixed $paths + * @param mixed $position + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addHead($pattern, $paths = null, $position = Router::POSITION_LAST) {} + + /** + * Mounts a group of routes in the router + * + * @param mixed $group + * @return RouterInterface + */ + public function mount(\Phalcon\Mvc\Router\GroupInterface $group) {} + + /** + * Set a group of paths to be returned when none of the defined routes are matched + * + * @param mixed $paths + * @return RouterInterface + */ + public function notFound($paths) {} + + /** + * Removes all the pre-defined routes + */ + public function clear() {} + + /** + * Returns the processed namespace name + * + * @return string + */ + public function getNamespaceName() {} + + /** + * Returns the processed module name + * + * @return string + */ + public function getModuleName() {} + + /** + * Returns the processed controller name + * + * @return string + */ + public function getControllerName() {} + + /** + * Returns the processed action name + * + * @return string + */ + public function getActionName() {} + + /** + * Returns the processed parameters + * + * @return array + */ + public function getParams() {} + + /** + * Returns the route that matchs the handled URI + * + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function getMatchedRoute() {} + + /** + * Returns the sub expressions in the regular expression matched + * + * @return array + */ + public function getMatches() {} + + /** + * Checks if the router macthes any of the defined routes + * + * @return bool + */ + public function wasMatched() {} + + /** + * Returns all the routes defined in the router + * + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function getRoutes() {} + + /** + * Returns a route object by its id + * + * @param mixed $id + * @return bool|\Phalcon\Mvc\Router\RouteInterface + */ + public function getRouteById($id) {} + + /** + * Returns a route object by its name + * + * @param string $name + * @return bool|\Phalcon\Mvc\Router\RouteInterface + */ + public function getRouteByName($name) {} + + /** + * Returns whether controller name should not be mangled + * + * @return bool + */ + public function isExactControllerName() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/RouterInterface.php b/ide/2.0.8/Phalcon/mvc/RouterInterface.php new file mode 100644 index 000000000..d649f3afb --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/RouterInterface.php @@ -0,0 +1,212 @@ + + * //Generate a URL appending the URI to the base URI + * echo $url->get('products/edit/1'); + * //Generate a URL for a predefined route + * echo $url->get(array('for' => 'blog-post', 'title' => 'some-cool-stuff', 'year' => '2012')); + * + */ +class Url implements \Phalcon\Mvc\UrlInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_baseUri = null; + + + protected $_staticBaseUri = null; + + + protected $_basePath = null; + + + protected $_router; + + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets a prefix for all the URIs to be generated + * + * $url->setBaseUri('/invo/'); + * $url->setBaseUri('/invo/index.php/'); + * + * + * @param string $baseUri + * @return Url + */ + public function setBaseUri($baseUri) {} + + /** + * Sets a prefix for all static URLs generated + * + * $url->setStaticBaseUri('/invo/'); + * + * + * @param string $staticBaseUri + * @return Url + */ + public function setStaticBaseUri($staticBaseUri) {} + + /** + * Returns the prefix for all the generated urls. By default / + * + * @return string + */ + public function getBaseUri() {} + + /** + * Returns the prefix for all the generated static urls. By default / + * + * @return string + */ + public function getStaticBaseUri() {} + + /** + * Sets a base path for all the generated paths + * + * $url->setBasePath('/var/www/htdocs/'); + * + * + * @param string $basePath + * @return Url + */ + public function setBasePath($basePath) {} + + /** + * Returns the base path + * + * @return string + */ + public function getBasePath() {} + + /** + * Generates a URL + * + * //Generate a URL appending the URI to the base URI + * echo $url->get('products/edit/1'); + * //Generate a URL for a predefined route + * echo $url->get(array('for' => 'blog-post', 'title' => 'some-cool-stuff', 'year' => '2015')); + * + * + * @param mixed $uri + * @param mixed $args + * @param mixed $local + * @param mixed $baseUri + * @return string + */ + public function get($uri = null, $args = null, $local = null, $baseUri = null) {} + + /** + * Generates a URL for a static resource + * + * // Generate a URL for a static resource + * echo $url->getStatic("img/logo.png"); + * // Generate a URL for a static predefined route + * echo $url->getStatic(array('for' => 'logo-cdn')); + * + * + * @param mixed $uri + * @return string + */ + public function getStatic($uri = null) {} + + /** + * Generates a local path + * + * @param string $path + * @return string + */ + public function path($path = null) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/UrlInterface.php b/ide/2.0.8/Phalcon/mvc/UrlInterface.php new file mode 100644 index 000000000..9d35e888c --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/UrlInterface.php @@ -0,0 +1,59 @@ + + * //Setting views directory + * $view = new \Phalcon\Mvc\View(); + * $view->setViewsDir('app/views/'); + * $view->start(); + * //Shows recent posts view (app/views/posts/recent.phtml) + * $view->render('posts', 'recent'); + * $view->finish(); + * //Printing views output + * echo $view->getContent(); + * + */ +class View extends \Phalcon\Di\Injectable implements \Phalcon\Mvc\ViewInterface +{ + /** + * Render Level: To the main layout + */ + const LEVEL_MAIN_LAYOUT = 5; + + /** + * Render Level: Render to the templates "after" + */ + const LEVEL_AFTER_TEMPLATE = 4; + + /** + * Render Level: To the controller layout + */ + const LEVEL_LAYOUT = 3; + + /** + * Render Level: To the templates "before" + */ + const LEVEL_BEFORE_TEMPLATE = 2; + + /** + * Render Level: To the action view + */ + const LEVEL_ACTION_VIEW = 1; + + /** + * Render Level: No render any view + */ + const LEVEL_NO_RENDER = 0; + + /** + * Cache Mode + */ + const CACHE_MODE_NONE = 0; + + + const CACHE_MODE_INVERSE = 1; + + + protected $_options; + + + protected $_basePath = ""; + + + protected $_content = ""; + + + protected $_renderLevel = 5; + + + protected $_currentRenderLevel = 0; + + + protected $_disabledLevels; + + + protected $_viewParams; + + + protected $_layout; + + + protected $_layoutsDir = ""; + + + protected $_partialsDir = ""; + + + protected $_viewsDir; + + + protected $_templatesBefore; + + + protected $_templatesAfter; + + + protected $_engines = false; + + /** + * @var array + */ + protected $_registeredEngines; + + + protected $_mainView = "index"; + + + protected $_controllerName; + + + protected $_actionName; + + + protected $_params; + + + protected $_pickView; + + + protected $_cache; + + + protected $_cacheLevel = 0; + + + protected $_activeRenderPath; + + + protected $_disabled = false; + + + + public function getRenderLevel() {} + + + public function getCurrentRenderLevel() {} + + /** + * @return array + */ + public function getRegisteredEngines() {} + + /** + * Phalcon\Mvc\View constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Sets the views directory. Depending of your platform, always add a trailing slash or backslash + * + * @param string $viewsDir + * @return View + */ + public function setViewsDir($viewsDir) {} + + /** + * Gets views directory + * + * @return string + */ + public function getViewsDir() {} + + /** + * Sets the layouts sub-directory. Must be a directory under the views directory. Depending of your platform, always add a trailing slash or backslash + * + * $view->setLayoutsDir('../common/layouts/'); + * + * + * @param string $layoutsDir + * @return View + */ + public function setLayoutsDir($layoutsDir) {} + + /** + * Gets the current layouts sub-directory + * + * @return string + */ + public function getLayoutsDir() {} + + /** + * Sets a partials sub-directory. Must be a directory under the views directory. Depending of your platform, always add a trailing slash or backslash + * + * $view->setPartialsDir('../common/partials/'); + * + * + * @param string $partialsDir + * @return View + */ + public function setPartialsDir($partialsDir) {} + + /** + * Gets the current partials sub-directory + * + * @return string + */ + public function getPartialsDir() {} + + /** + * Sets base path. Depending of your platform, always add a trailing slash or backslash + * + * $view->setBasePath(__DIR__ . '/'); + * + * + * @param string $basePath + * @return View + */ + public function setBasePath($basePath) {} + + /** + * Gets base path + * + * @return string + */ + public function getBasePath() {} + + /** + * Sets the render level for the view + * + * //Render the view related to the controller only + * $this->view->setRenderLevel(View::LEVEL_LAYOUT); + * + * + * @param int $level + * @return View + */ + public function setRenderLevel($level) {} + + /** + * Disables a specific level of rendering + * + * //Render all levels except ACTION level + * $this->view->disableLevel(View::LEVEL_ACTION_VIEW); + * + * + * @param int|array $level + * @return \Phalcon\Mvc\View + */ + public function disableLevel($level) {} + + /** + * Sets default view name. Must be a file without extension in the views directory + * + * //Renders as main view views-dir/base.phtml + * $this->view->setMainView('base'); + * + * + * @param string $viewPath + * @return View + */ + public function setMainView($viewPath) {} + + /** + * Returns the name of the main view + * + * @return string + */ + public function getMainView() {} + + /** + * Change the layout to be used instead of using the name of the latest controller name + * + * $this->view->setLayout('main'); + * + * + * @param string $layout + * @return View + */ + public function setLayout($layout) {} + + /** + * Returns the name of the main view + * + * @return string + */ + public function getLayout() {} + + /** + * Sets a template before the controller layout + * + * @param string|array $templateBefore + * @return \Phalcon\Mvc\View + */ + public function setTemplateBefore($templateBefore) {} + + /** + * Resets any "template before" layouts + * + * @return View + */ + public function cleanTemplateBefore() {} + + /** + * Sets a "template after" controller layout + * + * @param string|array $templateAfter + * @return \Phalcon\Mvc\View + */ + public function setTemplateAfter($templateAfter) {} + + /** + * Resets any template before layouts + * + * @return View + */ + public function cleanTemplateAfter() {} + + /** + * Adds parameters to views (alias of setVar) + * + * $this->view->setParamToView('products', $products); + * + * + * @param string $key + * @param mixed $value + * @return \Phalcon\Mvc\View + */ + public function setParamToView($key, $value) {} + + /** + * Set all the render params + * + * $this->view->setVars(array('products' => $products)); + * + * + * @param array $params + * @param boolean $merge + * @return \Phalcon\Mvc\View + */ + public function setVars($params, $merge = true) {} + + /** + * Set a single view parameter + * + * $this->view->setVar('products', $products); + * + * + * @param string $key + * @param mixed $value + * @return \Phalcon\Mvc\View + */ + public function setVar($key, $value) {} + + /** + * Returns a parameter previously set in the view + * + * @param string $key + * @return mixed + */ + public function getVar($key) {} + + /** + * Returns parameters to views + * + * @return array + */ + public function getParamsToView() {} + + /** + * Gets the name of the controller rendered + * + * @return string + */ + public function getControllerName() {} + + /** + * Gets the name of the action rendered + * + * @return string + */ + public function getActionName() {} + + /** + * Gets extra parameters of the action rendered + * + * @return array + */ + public function getParams() {} + + /** + * Starts rendering process enabling the output buffering + * + * @return View + */ + public function start() {} + + /** + * Loads registered template engines, if none is registered it will use Phalcon\Mvc\View\Engine\Php + * + * @return array + */ + protected function _loadTemplateEngines() {} + + /** + * Checks whether view exists on registered extensions and render it + * + * @param array $engines + * @param string $viewPath + * @param boolean $silence + * @param boolean $mustClean + * @param mixed $cache + * @param \Phalcon\Cache\BackendInterface $$cache + */ + protected function _engineRender($engines, $viewPath, $silence, $mustClean, \Phalcon\Cache\BackendInterface $cache = null) {} + + /** + * Register templating engines + * + * $this->view->registerEngines(array( + * ".phtml" => "Phalcon\Mvc\View\Engine\Php", + * ".volt" => "Phalcon\Mvc\View\Engine\Volt", + * ".mhtml" => "MyCustomEngine" + * )); + * + * + * @param array $engines + * @return View + */ + public function registerEngines($engines) {} + + /** + * Checks whether view exists + * + * @param string $view + * @return bool + */ + public function exists($view) {} + + /** + * Executes render process from dispatching data + * + * //Shows recent posts view (app/views/posts/recent.phtml) + * $view->start()->render('posts', 'recent')->finish(); + * + * + * @param string $controllerName + * @param string $actionName + * @param array $params + * @return bool|View + */ + public function render($controllerName, $actionName, $params = null) {} + + /** + * Choose a different view to render instead of last-controller/last-action + * + * class ProductsController extends \Phalcon\Mvc\Controller + * { + * public function saveAction() + * { + * //Do some save stuff... + * //Then show the list view + * $this->view->pick("products/list"); + * } + * } + * + * + * @param string|array $renderView + * @return \Phalcon\Mvc\View + */ + public function pick($renderView) {} + + /** + * Renders a partial view + * + * //Retrieve the contents of a partial + * echo $this->getPartial('shared/footer'); + * + * + * //Retrieve the contents of a partial with arguments + * echo $this->getPartial('shared/footer', array('content' => $html)); + * + * + * @param string $partialPath + * @param array $params + * @return string + */ + public function getPartial($partialPath, $params = null) {} + + /** + * Renders a partial view + * + * //Show a partial inside another view + * $this->partial('shared/footer'); + * + * + * //Show a partial inside another view with parameters + * $this->partial('shared/footer', array('content' => $html)); + * + * + * @param string $partialPath + * @param array $params + */ + public function partial($partialPath, $params = null) {} + + /** + * Perform the automatic rendering returning the output as a string + * + * $template = $this->view->getRender('products', 'show', array('products' => $products)); + * + * + * @param string $controllerName + * @param string $actionName + * @param array $params + * @param mixed $configCallback + * @return string + */ + public function getRender($controllerName, $actionName, $params = null, $configCallback = null) {} + + /** + * Finishes the render process by stopping the output buffering + * + * @return View + */ + public function finish() {} + + /** + * Create a Phalcon\Cache based on the internal cache options + * + * @return \Phalcon\Cache\BackendInterface + */ + protected function _createCache() {} + + /** + * Check if the component is currently caching the output content + * + * @return bool + */ + public function isCaching() {} + + /** + * Returns the cache instance used to cache + * + * @return \Phalcon\Cache\BackendInterface + */ + public function getCache() {} + + /** + * Cache the actual view render to certain level + * + * $this->view->cache(array('key' => 'my-key', 'lifetime' => 86400)); + * + * + * @param boolean|array $options + * @return \Phalcon\Mvc\View + */ + public function cache($options = true) {} + + /** + * Externally sets the view content + * + * $this->view->setContent("

hello

"); + *
+ * + * @param string $content + * @return View + */ + public function setContent($content) {} + + /** + * Returns cached output from another view stage + * + * @return string + */ + public function getContent() {} + + /** + * Returns the path of the view that is currently rendered + * + * @return string + */ + public function getActiveRenderPath() {} + + /** + * Disables the auto-rendering process + * + * @return View + */ + public function disable() {} + + /** + * Enables the auto-rendering process + * + * @return View + */ + public function enable() {} + + /** + * Resets the view component to its factory default values + * + * @return View + */ + public function reset() {} + + /** + * Magic method to pass variables to the views + * + * $this->view->products = $products; + * + * + * @param string $key + * @param mixed $value + */ + public function __set($key, $value) {} + + /** + * Magic method to retrieve a variable passed to the view + * + * echo $this->view->products; + * + * + * @param string $key + * @return mixed + */ + public function __get($key) {} + + /** + * Whether automatic rendering is enabled + * + * @return bool + */ + public function isDisabled() {} + + /** + * Magic method to retrieve if a variable is set in the view + * + * echo isset($this->view->products); + * + * + * @param string $key + * @return boolean + */ + public function __isset($key) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/ViewBaseInterface.php b/ide/2.0.8/Phalcon/mvc/ViewBaseInterface.php new file mode 100644 index 000000000..237308125 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/ViewBaseInterface.php @@ -0,0 +1,86 @@ +x or array[x]. + */ +class Document implements \Phalcon\Mvc\EntityInterface, \ArrayAccess +{ + + /** + * Checks whether an offset exists in the document + * + * @param int $index + * @return boolean + */ + public function offsetExists($index) {} + + /** + * Returns the value of a field using the ArrayAccess interfase + * + * @param string $index + */ + public function offsetGet($index) {} + + /** + * Change a value using the ArrayAccess interface + * + * @param string $index + * @param mixed $value + */ + public function offsetSet($index, $value) {} + + /** + * Rows cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface + * + * @param string $offset + */ + public function offsetUnset($offset) {} + + /** + * Reads an attribute value by its name + * + * echo $robot->readAttribute('name'); + * + * + * @param string $attribute + * @return mixed + */ + public function readAttribute($attribute) {} + + /** + * Writes an attribute value by its name + * + * $robot->writeAttribute('name', 'Rosey'); + * + * + * @param string $attribute + * @param mixed $value + */ + public function writeAttribute($attribute, $value) {} + + /** + * Returns the instance as an array representation + * + * @return array + */ + public function toArray() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/collection/Exception.php b/ide/2.0.8/Phalcon/mvc/collection/Exception.php new file mode 100644 index 000000000..736016ca9 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/collection/Exception.php @@ -0,0 +1,12 @@ + + * $di = new \Phalcon\Di(); + * $di->set('collectionManager', function(){ + * return new \Phalcon\Mvc\Collection\Manager(); + * }); + * $robot = new Robots($di); + * + */ +class Manager implements \Phalcon\Di\InjectionAwareInterface, \Phalcon\Events\EventsAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_initialized; + + + protected $_lastInitialized; + + + protected $_eventsManager; + + + protected $_customEventsManager; + + + protected $_connectionServices; + + + protected $_implicitObjectsIds; + + + protected $_behaviors; + + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the event manager + * + * @param mixed $eventsManager + */ + public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the internal event manager + * + * @return \Phalcon\Events\ManagerInterface + */ + public function getEventsManager() {} + + /** + * Sets a custom events manager for a specific model + * + * @param mixed $model + * @param mixed $eventsManager + */ + public function setCustomEventsManager(\Phalcon\Mvc\CollectionInterface $model, \Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns a custom events manager related to a model + * + * @param mixed $model + * @param \Phalcon\Mvc\CollectionInterface $$model + * @return \Phalcon\Events\ManagerInterface + */ + public function getCustomEventsManager(\Phalcon\Mvc\CollectionInterface $model) {} + + /** + * Initializes a model in the models manager + * + * @param mixed $model + */ + public function initialize(\Phalcon\Mvc\CollectionInterface $model) {} + + /** + * Check whether a model is already initialized + * + * @param string $modelName + * @return bool + */ + public function isInitialized($modelName) {} + + /** + * Get the latest initialized model + * + * @return \Phalcon\Mvc\CollectionInterface + */ + public function getLastInitialized() {} + + /** + * Sets a connection service for a specific model + * + * @param mixed $model + * @param string $connectionService + */ + public function setConnectionService(\Phalcon\Mvc\CollectionInterface $model, $connectionService) {} + + /** + * Sets whether a model must use implicit objects ids + * + * @param mixed $model + * @param bool $useImplicitObjectIds + */ + public function useImplicitObjectIds(\Phalcon\Mvc\CollectionInterface $model, $useImplicitObjectIds) {} + + /** + * Checks if a model is using implicit object ids + * + * @param mixed $model + * @return bool + */ + public function isUsingImplicitObjectIds(\Phalcon\Mvc\CollectionInterface $model) {} + + /** + * Returns the connection related to a model + * + * @param mixed $model + * @param \Phalcon\Mvc\CollectionInterface $$model + * @return \Mongo + */ + public function getConnection(\Phalcon\Mvc\CollectionInterface $model) {} + + /** + * Receives events generated in the models and dispatches them to a events-manager if available + * Notify the behaviors that are listening in the model + * + * @param string $eventName + * @param mixed $model + */ + public function notifyEvent($eventName, \Phalcon\Mvc\CollectionInterface $model) {} + + /** + * Dispatch a event to the listeners and behaviors + * This method expects that the endpoint listeners/behaviors returns true + * meaning that a least one was implemented + * + * @param mixed $model + * @param string $eventName + * @param mixed $data + * @return bool + */ + public function missingMethod(\Phalcon\Mvc\CollectionInterface $model, $eventName, $data) {} + + /** + * Binds a behavior to a model + * + * @param mixed $model + * @param mixed $behavior + */ + public function addBehavior(\Phalcon\Mvc\CollectionInterface $model, \Phalcon\Mvc\Collection\BehaviorInterface $behavior) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/collection/ManagerInterface.php b/ide/2.0.8/Phalcon/mvc/collection/ManagerInterface.php new file mode 100644 index 000000000..b51756b49 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/collection/ManagerInterface.php @@ -0,0 +1,108 @@ + + * $di = new \Phalcon\Di(); + * $di->set('collectionManager', function() { + * return new \Phalcon\Mvc\Collection\Manager(); + * }); + * $robot = new Robots(di); + * + */ +interface ManagerInterface +{ + + /** + * Sets a custom events manager for a specific model + * + * @param mixed $model + * @param mixed $eventsManager + */ + public function setCustomEventsManager(\Phalcon\Mvc\CollectionInterface $model, \Phalcon\Events\ManagerInterface $eventsManager); + + /** + * Returns a custom events manager related to a model + * + * @param mixed $model + * @return \Phalcon\Events\ManagerInterface + */ + public function getCustomEventsManager(\Phalcon\Mvc\CollectionInterface $model); + + /** + * Initializes a model in the models manager + * + * @param mixed $model + */ + public function initialize(\Phalcon\Mvc\CollectionInterface $model); + + /** + * Check whether a model is already initialized + * + * @param string $modelName + * @return bool + */ + public function isInitialized($modelName); + + /** + * Get the latest initialized model + * + * @return \Phalcon\Mvc\CollectionInterface + */ + public function getLastInitialized(); + + /** + * Sets a connection service for a specific model + * + * @param mixed $model + * @param string $connectionService + */ + public function setConnectionService(\Phalcon\Mvc\CollectionInterface $model, $connectionService); + + /** + * Sets if a model must use implicit objects ids + * + * @param mixed $model + * @param bool $useImplicitObjectIds + */ + public function useImplicitObjectIds(\Phalcon\Mvc\CollectionInterface $model, $useImplicitObjectIds); + + /** + * Checks if a model is using implicit object ids + * + * @param mixed $model + * @return bool + */ + public function isUsingImplicitObjectIds(\Phalcon\Mvc\CollectionInterface $model); + + /** + * Returns the connection related to a model + * + * @param mixed $model + * @return \Phalcon\Db\AdapterInterface + */ + public function getConnection(\Phalcon\Mvc\CollectionInterface $model); + + /** + * Receives events generated in the models and dispatches them to a events-manager if available + * Notify the behaviors that are listening in the model + * + * @param string $eventName + * @param mixed $model + */ + public function notifyEvent($eventName, \Phalcon\Mvc\CollectionInterface $model); + + /** + * Binds a behavior to a collection + * + * @param mixed $model + * @param mixed $behavior + */ + public function addBehavior(\Phalcon\Mvc\CollectionInterface $model, \Phalcon\Mvc\Collection\BehaviorInterface $behavior); + +} diff --git a/ide/2.0.8/Phalcon/mvc/collection/behavior/SoftDelete.php b/ide/2.0.8/Phalcon/mvc/collection/behavior/SoftDelete.php new file mode 100644 index 000000000..527ee606b --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/collection/behavior/SoftDelete.php @@ -0,0 +1,21 @@ + + * $app = new \Phalcon\Mvc\Micro(); + * $collection = new Collection(); + * $collection->setHandler(new PostsController()); + * $collection->get('/posts/edit/{id}', 'edit'); + * $app->mount($collection); + * + */ +class Collection implements \Phalcon\Mvc\Micro\CollectionInterface +{ + + protected $_prefix; + + + protected $_lazy; + + + protected $_handler; + + + protected $_handlers; + + + /** + * Internal function to add a handler to the group + * + * @param string|array $method + * @param string $routePattern + * @param mixed $handler + * @param string $name + */ + protected function _addMap($method, $routePattern, $handler, $name) {} + + /** + * Sets a prefix for all routes added to the collection + * + * @param string $prefix + * @return Collection + */ + public function setPrefix($prefix) {} + + /** + * Returns the collection prefix if any + * + * @return string + */ + public function getPrefix() {} + + /** + * Returns the registered handlers + * + * @return array + */ + public function getHandlers() {} + + /** + * Sets the main handler + * + * @param mixed $handler + * @param boolean $lazy + * @return \Phalcon\Mvc\Micro\Collection + */ + public function setHandler($handler, $lazy = false) {} + + /** + * Sets if the main handler must be lazy loaded + * + * @param bool $lazy + * @return Collection + */ + public function setLazy($lazy) {} + + /** + * Returns if the main handler must be lazy loaded + * + * @return bool + */ + public function isLazy() {} + + /** + * Returns the main handler + * + * @return mixed + */ + public function getHandler() {} + + /** + * Maps a route to a handler + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function map($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is GET + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function get($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is POST + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function post($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is PUT + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function put($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is PATCH + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function patch($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is HEAD + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function head($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is DELETE + * + * @param string $routePattern + * @param callable $handler + * @param string $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function delete($routePattern, $handler, $name = null) {} + + /** + * Maps a route to a handler that only matches if the HTTP method is OPTIONS + * + * @param string $routePattern + * @param callable $handler + * @param mixed $name + * @return \Phalcon\Mvc\Micro\Collection + */ + public function options($routePattern, $handler, $name = null) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/micro/CollectionInterface.php b/ide/2.0.8/Phalcon/mvc/micro/CollectionInterface.php new file mode 100644 index 000000000..30c219445 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/micro/CollectionInterface.php @@ -0,0 +1,145 @@ + + * $robots = Robots::query() + * ->where("type = :type:") + * ->andWhere("year < 2000") + * ->bind(array("type" => "mechanical")) + * ->limit(5, 10) + * ->orderBy("name") + * ->execute(); + * + */ +class Criteria implements \Phalcon\Mvc\Model\CriteriaInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_model; + + + protected $_params; + + + protected $_bindParams; + + + protected $_bindTypes; + + + protected $_hiddenParamNumber = 0; + + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return null|\Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Set a model on which the query will be executed + * + * @param string $modelName + * @return Criteria + */ + public function setModelName($modelName) {} + + /** + * Returns an internal model name on which the criteria will be applied + * + * @return string + */ + public function getModelName() {} + + /** + * Sets the bound parameters in the criteria + * This method replaces all previously set bound parameters + * + * @param array $bindParams + * @return Criteria + */ + public function bind($bindParams) {} + + /** + * Sets the bind types in the criteria + * This method replaces all previously set bound parameters + * + * @param array $bindTypes + * @return Criteria + */ + public function bindTypes($bindTypes) {} + + /** + * Sets SELECT DISTINCT / SELECT ALL flag + * + * @param mixed $distinct + * @return Criteria + */ + public function distinct($distinct) {} + + /** + * Sets the columns to be queried + * + * $criteria->columns(array('id', 'name')); + * + * + * @param string|array $columns + * @return \Phalcon\Mvc\Model\Criteria + */ + public function columns($columns) {} + + /** + * Adds a INNER join to the query + * + * $criteria->join('Robots'); + * $criteria->join('Robots', 'r.id = RobotsParts.robots_id'); + * $criteria->join('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * $criteria->join('Robots', 'r.id = RobotsParts.robots_id', 'r', 'LEFT'); + * + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @param mixed $type + * @return Criteria + */ + public function join($model, $conditions = null, $alias = null, $type = null) {} + + /** + * Adds a INNER join to the query + * + * $criteria->innerJoin('Robots'); + * $criteria->innerJoin('Robots', 'r.id = RobotsParts.robots_id'); + * $criteria->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @return Criteria + */ + public function innerJoin($model, $conditions = null, $alias = null) {} + + /** + * Adds a LEFT join to the query + * + * $criteria->leftJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @return Criteria + */ + public function leftJoin($model, $conditions = null, $alias = null) {} + + /** + * Adds a RIGHT join to the query + * + * $criteria->rightJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param mixed $conditions + * @param mixed $alias + * @return Criteria + */ + public function rightJoin($model, $conditions = null, $alias = null) {} + + /** + * Sets the conditions parameter in the criteria + * + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return Criteria + */ + public function where($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a condition to the current conditions using an AND operator (deprecated) + * + * @deprecated 1.0.0 + * @see \Phalcon\Mvc\Model\Criteria::andWhere() + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return Criteria + */ + public function addWhere($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a condition to the current conditions using an AND operator + * + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return Criteria + */ + public function andWhere($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a condition to the current conditions using an OR operator + * + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes + * @return Criteria + */ + public function orWhere($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a BETWEEN condition to the current conditions + * + * $criteria->betweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return Criteria + */ + public function betweenWhere($expr, $minimum, $maximum) {} + + /** + * Appends a NOT BETWEEN condition to the current conditions + * + * $criteria->notBetweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return Criteria + */ + public function notBetweenWhere($expr, $minimum, $maximum) {} + + /** + * Appends an IN condition to the current conditions + * + * $criteria->inWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return Criteria + */ + public function inWhere($expr, $values) {} + + /** + * Appends a NOT IN condition to the current conditions + * + * $criteria->notInWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return Criteria + */ + public function notInWhere($expr, $values) {} + + /** + * Adds the conditions parameter to the criteria + * + * @param string $conditions + * @return Criteria + */ + public function conditions($conditions) {} + + /** + * Adds the order-by parameter to the criteria (deprecated) + * + * @deprecated 1.2.1 + * @see \Phalcon\Mvc\Model\Criteria::orderBy() + * @param string $orderColumns + * @return Criteria + */ + public function order($orderColumns) {} + + /** + * Adds the order-by clause to the criteria + * + * @param string $orderColumns + * @return Criteria + */ + public function orderBy($orderColumns) {} + + /** + * Adds the group-by clause to the criteria + * + * @param mixed $group + * @return Criteria + */ + public function groupBy($group) {} + + /** + * Adds the having clause to the criteria + * + * @param mixed $having + * @return Criteria + */ + public function having($having) {} + + /** + * Adds the limit parameter to the criteria + * + * @param mixed $limit + * @param mixed $offset + * @return Criteria + */ + public function limit($limit, $offset = null) {} + + /** + * Adds the "for_update" parameter to the criteria + * + * @param bool $forUpdate + * @return Criteria + */ + public function forUpdate($forUpdate = true) {} + + /** + * Adds the "shared_lock" parameter to the criteria + * + * @param bool $sharedLock + * @return Criteria + */ + public function sharedLock($sharedLock = true) {} + + /** + * Sets the cache options in the criteria + * This method replaces all previously set cache options + * + * @param array $cache + * @return Criteria + */ + public function cache($cache) {} + + /** + * Returns the conditions parameter in the criteria + * + * @return string|null + */ + public function getWhere() {} + + /** + * Returns the columns to be queried + * + * @return string|array|null + */ + public function getColumns() {} + + /** + * Returns the conditions parameter in the criteria + * + * @return string|null + */ + public function getConditions() {} + + /** + * Returns the limit parameter in the criteria, which will be + * an integer if limit was set without an offset, + * an array with 'number' and 'offset' keys if an offset was set with the limit, + * or null if limit has not been set. + * + * @return int|array|null + */ + public function getLimit() {} + + /** + * Returns the order clause in the criteria + * + * @return string|null + */ + public function getOrder() {} + + /** + * Returns the group clause in the criteria + */ + public function getGroupBy() {} + + /** + * Returns the having clause in the criteria + */ + public function getHaving() {} + + /** + * Returns all the parameters defined in the criteria + * + * @return array + */ + public function getParams() {} + + /** + * Builds a Phalcon\Mvc\Model\Criteria based on an input array like _POST + * + * @param mixed $dependencyInjector + * @param string $modelName + * @param array $data + * @param string $operator + * @return Criteria + */ + public static function fromInput(\Phalcon\DiInterface $dependencyInjector, $modelName, $data, $operator = "AND") {} + + /** + * Executes a find using the parameters built with the criteria + * + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + public function execute() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/CriteriaInterface.php b/ide/2.0.8/Phalcon/mvc/model/CriteriaInterface.php new file mode 100644 index 000000000..c2a2fe983 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/CriteriaInterface.php @@ -0,0 +1,209 @@ + + * $criteria->betweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return \Phalcon\Mvc\Model\CriteriaInterface + */ + public function betweenWhere($expr, $minimum, $maximum); + + /** + * Appends a NOT BETWEEN condition to the current conditions + * + * $criteria->notBetweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return \Phalcon\Mvc\Model\CriteriaInterface + */ + public function notBetweenWhere($expr, $minimum, $maximum); + + /** + * Appends an IN condition to the current conditions + * + * $criteria->inWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return CriteriaInterface + */ + public function inWhere($expr, $values); + + /** + * Appends a NOT IN condition to the current conditions + * + * $criteria->notInWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return CriteriaInterface + */ + public function notInWhere($expr, $values); + + /** + * Returns the conditions parameter in the criteria + * + * @return string|null + */ + public function getWhere(); + + /** + * Returns the conditions parameter in the criteria + * + * @return string|null + */ + public function getConditions(); + + /** + * Returns the limit parameter in the criteria, which will be + * an integer if limit was set without an offset, + * an array with 'number' and 'offset' keys if an offset was set with the limit, + * or null if limit has not been set. + * + * @return int|array|null + */ + public function getLimit(); + + /** + * Returns the order parameter in the criteria + * + * @return string|null + */ + public function getOrder(); + + /** + * Returns all the parameters defined in the criteria + * + * @return array + */ + public function getParams(); + + /** + * Executes a find using the parameters built with the criteria + * + * @return ResultsetInterface + */ + public function execute(); + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/Exception.php b/ide/2.0.8/Phalcon/mvc/model/Exception.php new file mode 100644 index 000000000..1685da6d4 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/Exception.php @@ -0,0 +1,12 @@ + + * use Phalcon\Di; + * use Phalcon\Mvc\Model\Manager as ModelsManager; + * $di = new Di(); + * $di->set('modelsManager', function() { + * return new ModelsManager(); + * }); + * $robot = new Robots($di); + * + */ +class Manager implements \Phalcon\Mvc\Model\ManagerInterface, \Phalcon\Di\InjectionAwareInterface, \Phalcon\Events\EventsAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_eventsManager; + + + protected $_customEventsManager; + + + protected $_readConnectionServices; + + + protected $_writeConnectionServices; + + + protected $_aliases; + + /** + * Has many relations + */ + protected $_hasMany; + + /** + * Has many relations by model + */ + protected $_hasManySingle; + + /** + * Has one relations + */ + protected $_hasOne; + + /** + * Has one relations by model + */ + protected $_hasOneSingle; + + /** + * Belongs to relations + */ + protected $_belongsTo; + + /** + * All the relationships by model + */ + protected $_belongsToSingle; + + /** + * Has many-Through relations + */ + protected $_hasManyToMany; + + /** + * Has many-Through relations by model + */ + protected $_hasManyToManySingle; + + /** + * Mark initialized models + */ + protected $_initialized; + + + protected $_sources; + + + protected $_schemas; + + /** + * Models' behaviors + */ + protected $_behaviors; + + /** + * Last model initialized + */ + protected $_lastInitialized; + + /** + * Last query created/executed + */ + protected $_lastQuery; + + /** + * Stores a list of reusable instances + */ + protected $_reusable; + + + protected $_keepSnapshots; + + /** + * Does the model use dynamic update, instead of updating all rows? + */ + protected $_dynamicUpdate; + + + protected $_namespaceAliases; + + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets a global events manager + * + * @param mixed $eventsManager + * @return Manager + */ + public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns the internal event manager + * + * @return \Phalcon\Events\ManagerInterface + */ + public function getEventsManager() {} + + /** + * Sets a custom events manager for a specific model + * + * @param mixed $model + * @param mixed $eventsManager + */ + public function setCustomEventsManager(\Phalcon\Mvc\ModelInterface $model, \Phalcon\Events\ManagerInterface $eventsManager) {} + + /** + * Returns a custom events manager related to a model + * + * @param mixed $model + * @return bool|\Phalcon\Events\ManagerInterface + */ + public function getCustomEventsManager(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Initializes a model in the model manager + * + * @param mixed $model + * @return bool + */ + public function initialize(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Check whether a model is already initialized + * + * @param string $modelName + * @return bool + */ + public function isInitialized($modelName) {} + + /** + * Get last initialized model + * + * @return \Phalcon\Mvc\ModelInterface + */ + public function getLastInitialized() {} + + /** + * Loads a model throwing an exception if it doesn't exist + * + * @param string $modelName + * @param bool $newInstance + * @return \Phalcon\Mvc\ModelInterface + */ + public function load($modelName, $newInstance = false) {} + + /** + * Sets the mapped source for a model + * + * @param mixed $model + * @param string $source + */ + public function setModelSource(\Phalcon\Mvc\ModelInterface $model, $source) {} + + /** + * Returns the mapped source for a model + * + * @param mixed $model + * @return string + */ + public function getModelSource(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Sets the mapped schema for a model + * + * @param mixed $model + * @param string $schema + */ + public function setModelSchema(\Phalcon\Mvc\ModelInterface $model, $schema) {} + + /** + * Returns the mapped schema for a model + * + * @param mixed $model + * @return string + */ + public function getModelSchema(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Sets both write and read connection service for a model + * + * @param mixed $model + * @param string $connectionService + */ + public function setConnectionService(\Phalcon\Mvc\ModelInterface $model, $connectionService) {} + + /** + * Sets write connection service for a model + * + * @param mixed $model + * @param string $connectionService + */ + public function setWriteConnectionService(\Phalcon\Mvc\ModelInterface $model, $connectionService) {} + + /** + * Sets read connection service for a model + * + * @param mixed $model + * @param string $connectionService + */ + public function setReadConnectionService(\Phalcon\Mvc\ModelInterface $model, $connectionService) {} + + /** + * Returns the connection to read data related to a model + * + * @param mixed $model + * @return \Phalcon\Db\AdapterInterface + */ + public function getReadConnection(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the connection to write data related to a model + * + * @param mixed $model + * @return \Phalcon\Db\AdapterInterface + */ + public function getWriteConnection(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the connection to read or write data related to a model depending on the connection services. + * + * @param mixed $model + * @param mixed $connectionServices + * @return \Phalcon\Db\AdapterInterface + */ + protected function _getConnection(\Phalcon\Mvc\ModelInterface $model, $connectionServices) {} + + /** + * Returns the connection service name used to read data related to a model + * + * @param mixed $model + * @return string + */ + public function getReadConnectionService(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the connection service name used to write data related to a model + * + * @param mixed $model + * @return string + */ + public function getWriteConnectionService(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the connection service name used to read or write data related to a model depending on the connection services + * + * @param mixed $model + * @param mixed $connectionServices + * @return string + */ + public function _getConnectionService(\Phalcon\Mvc\ModelInterface $model, $connectionServices) {} + + /** + * Receives events generated in the models and dispatches them to a events-manager if available + * Notify the behaviors that are listening in the model + * + * @param string $eventName + * @param mixed $model + */ + public function notifyEvent($eventName, \Phalcon\Mvc\ModelInterface $model) {} + + /** + * Dispatch a event to the listeners and behaviors + * This method expects that the endpoint listeners/behaviors returns true + * meaning that a least one was implemented + * + * @param mixed $model + * @param string $eventName + * @param mixed $data + */ + public function missingMethod(\Phalcon\Mvc\ModelInterface $model, $eventName, $data) {} + + /** + * Binds a behavior to a model + * + * @param mixed $model + * @param mixed $behavior + */ + public function addBehavior(\Phalcon\Mvc\ModelInterface $model, \Phalcon\Mvc\Model\BehaviorInterface $behavior) {} + + /** + * Sets if a model must keep snapshots + * + * @param mixed $model + * @param bool $keepSnapshots + */ + public function keepSnapshots(\Phalcon\Mvc\ModelInterface $model, $keepSnapshots) {} + + /** + * Checks if a model is keeping snapshots for the queried records + * + * @param mixed $model + * @return bool + */ + public function isKeepingSnapshots(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Sets if a model must use dynamic update instead of the all-field update + * + * @param mixed $model + * @param bool $dynamicUpdate + */ + public function useDynamicUpdate(\Phalcon\Mvc\ModelInterface $model, $dynamicUpdate) {} + + /** + * Checks if a model is using dynamic update instead of all-field update + * + * @param mixed $model + * @return bool + */ + public function isUsingDynamicUpdate(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Setup a 1-1 relation between two models + * + * @param mixed fields + * @param string referencedModel + * @param mixed referencedFields + * @param array options + * @param \Phalcon\Mvc\Model $model + * @param mixed $fields + * @param string $referencedModel + * @param mixed $referencedFields + * @param mixed $options + * @return \Phalcon\Mvc\Model\Relation + */ + public function addHasOne(\Phalcon\Mvc\ModelInterface $model, $fields, $referencedModel, $referencedFields, $options = null) {} + + /** + * Setup a relation reverse many to one between two models + * + * @param mixed fields + * @param string referencedModel + * @param mixed referencedFields + * @param array options + * @param \Phalcon\Mvc\Model $model + * @param mixed $fields + * @param string $referencedModel + * @param mixed $referencedFields + * @param mixed $options + * @return \Phalcon\Mvc\Model\Relation + */ + public function addBelongsTo(\Phalcon\Mvc\ModelInterface $model, $fields, $referencedModel, $referencedFields, $options = null) {} + + /** + * Setup a relation 1-n between two models + * + * @param mixed fields + * @param string referencedModel + * @param mixed referencedFields + * @param array options + * @param mixed $model + * @param mixed $fields + * @param string $referencedModel + * @param mixed $referencedFields + * @param mixed $options + * @param $Phalcon\Mvc\ModelInterface model + * @return \Phalcon\Mvc\Model\Relation + */ + public function addHasMany(\Phalcon\Mvc\ModelInterface $model, $fields, $referencedModel, $referencedFields, $options = null) {} + + /** + * Setups a relation n-m between two models + * + * @param string fields + * @param string intermediateModel + * @param string intermediateFields + * @param string intermediateReferencedFields + * @param string referencedModel + * @param string referencedFields + * @param mixed $model + * @param mixed $fields + * @param string $intermediateModel + * @param mixed $intermediateFields + * @param mixed $intermediateReferencedFields + * @param string $referencedModel + * @param mixed $referencedFields + * @param array $options + * @param $Phalcon\Mvc\ModelInterface model + * @return \Phalcon\Mvc\Model\Relation + */ + public function addHasManyToMany(\Phalcon\Mvc\ModelInterface $model, $fields, $intermediateModel, $intermediateFields, $intermediateReferencedFields, $referencedModel, $referencedFields, $options = null) {} + + /** + * Checks whether a model has a belongsTo relation with another model + * + * @param string $modelName + * @param string $modelRelation + * @return bool + */ + public function existsBelongsTo($modelName, $modelRelation) {} + + /** + * Checks whether a model has a hasMany relation with another model + * + * @param string $modelName + * @param string $modelRelation + * @return bool + */ + public function existsHasMany($modelName, $modelRelation) {} + + /** + * Checks whether a model has a hasOne relation with another model + * + * @param string $modelName + * @param string $modelRelation + * @return bool + */ + public function existsHasOne($modelName, $modelRelation) {} + + /** + * Checks whether a model has a hasManyToMany relation with another model + * + * @param string $modelName + * @param string $modelRelation + * @return bool + */ + public function existsHasManyToMany($modelName, $modelRelation) {} + + /** + * Returns a relation by its alias + * + * @param string $modelName + * @param string $alias + * @return bool|\Phalcon\Mvc\Model\Relation + */ + public function getRelationByAlias($modelName, $alias) {} + + /** + * Merge two arrays of find parameters + * + * @param mixed $findParamsOne + * @param mixed $findParamsTwo + * @return array + */ + protected final function _mergeFindParameters($findParamsOne, $findParamsTwo) {} + + /** + * Helper method to query records based on a relation definition + * + * @param mixed $relation + * @param string $method + * @param mixed $record + * @param mixed $parameters + * @return \Phalcon\Mvc\Model\Resultset\Simple|Phalcon\Mvc\Model\Resultset\Simple|false + */ + public function getRelationRecords(\Phalcon\Mvc\Model\RelationInterface $relation, $method, \Phalcon\Mvc\ModelInterface $record, $parameters = null) {} + + /** + * Returns a reusable object from the internal list + * + * @param string $modelName + * @param string $key + */ + public function getReusableRecords($modelName, $key) {} + + /** + * Stores a reusable record in the internal list + * + * @param string $modelName + * @param string $key + * @param mixed $records + */ + public function setReusableRecords($modelName, $key, $records) {} + + /** + * Clears the internal reusable list + */ + public function clearReusableObjects() {} + + /** + * Gets belongsTo related records from a model + * + * @param string $method + * @param string $modelName + * @param mixed $modelRelation + * @param mixed $record + * @param mixed $parameters + * @return bool|\Phalcon\Mvc\Model\ResultsetInterface + */ + public function getBelongsToRecords($method, $modelName, $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null) {} + + /** + * Gets hasMany related records from a model + * + * @param string $method + * @param string $modelName + * @param mixed $modelRelation + * @param mixed $record + * @param mixed $parameters + * @return bool|\Phalcon\Mvc\Model\ResultsetInterface + */ + public function getHasManyRecords($method, $modelName, $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null) {} + + /** + * Gets belongsTo related records from a model + * + * @param string $method + * @param string $modelName + * @param mixed $modelRelation + * @param mixed $record + * @param mixed $parameters + * @return bool|\Phalcon\Mvc\ModelInterface + */ + public function getHasOneRecords($method, $modelName, $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null) {} + + /** + * Gets all the belongsTo relations defined in a model + * + * $relations = $modelsManager->getBelongsTo(new Robots()); + * + * + * @param mixed $model + * @return array|\Phalcon\Mvc\Model\RelationInterface + */ + public function getBelongsTo(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Gets hasMany relations defined on a model + * + * @param mixed $model + * @return array|\Phalcon\Mvc\Model\RelationInterface + */ + public function getHasMany(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Gets hasOne relations defined on a model + * + * @param mixed $model + * @return array + */ + public function getHasOne(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Gets hasManyToMany relations defined on a model + * + * @param mixed $model + * @return array|\Phalcon\Mvc\Model\RelationInterface + */ + public function getHasManyToMany(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Gets hasOne relations defined on a model + * + * @param mixed $model + * @return \Phalcon\Mvc\Model\RelationInterface + */ + public function getHasOneAndHasMany(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Query all the relationships defined on a model + * + * @param string $modelName + * @return \Phalcon\Mvc\Model\RelationInterface + */ + public function getRelations($modelName) {} + + /** + * Query the first relationship defined between two models + * + * @param string $first + * @param string $second + * @return bool|\Phalcon\Mvc\Model\RelationInterface + */ + public function getRelationsBetween($first, $second) {} + + /** + * Creates a Phalcon\Mvc\Model\Query without execute it + * + * @param string $phql + * @return \Phalcon\Mvc\Model\QueryInterface + */ + public function createQuery($phql) {} + + /** + * Creates a Phalcon\Mvc\Model\Query and execute it + * + * @param string $phql + * @param mixed $placeholders + * @param mixed $types + * @return \Phalcon\Mvc\Model\QueryInterface + */ + public function executeQuery($phql, $placeholders = null, $types = null) {} + + /** + * Creates a Phalcon\Mvc\Model\Query\Builder + * + * @param mixed $params + * @return \Phalcon\Mvc\Model\Query\BuilderInterface + */ + public function createBuilder($params = null) {} + + /** + * Returns the last query created or executed in the models manager + * + * @return \Phalcon\Mvc\Model\QueryInterface + */ + public function getLastQuery() {} + + /** + * Registers shorter aliases for namespaces in PHQL statements + * + * @param string $alias + * @param string $namespaceName + */ + public function registerNamespaceAlias($alias, $namespaceName) {} + + /** + * Returns a real namespace from its alias + * + * @param string $alias + * @return string + */ + public function getNamespaceAlias($alias) {} + + /** + * Returns all the registered namespace aliases + * + * @return array + */ + public function getNamespaceAliases() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/ManagerInterface.php b/ide/2.0.8/Phalcon/mvc/model/ManagerInterface.php new file mode 100644 index 000000000..2c5726c98 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/ManagerInterface.php @@ -0,0 +1,366 @@ + + * use Phalcon\Mvc\Model\Message as Message; + * class Robots extends \Phalcon\Mvc\Model + * { + * public function beforeSave() + * { + * if (this->name == 'Peter') { + * text = "A robot cannot be named Peter"; + * field = "name"; + * type = "InvalidValue"; + * message = new Message(text, field, type); + * this->appendMessage(message); + * } + * } + * } + * + */ +class Message implements \Phalcon\Mvc\Model\MessageInterface +{ + + protected $_type; + + + protected $_message; + + + protected $_field; + + + protected $_model; + + + /** + * Phalcon\Mvc\Model\Message constructor + * + * @param string $message + * @param string|array $field + * @param string $type + * @param \Phalcon\Mvc\ModelInterface $model + */ + public function __construct($message, $field = null, $type = null, $model = null) {} + + /** + * Sets message type + * + * @param string $type + * @return Message + */ + public function setType($type) {} + + /** + * Returns message type + * + * @return string + */ + public function getType() {} + + /** + * Sets verbose message + * + * @param string $message + * @return Message + */ + public function setMessage($message) {} + + /** + * Returns verbose message + * + * @return string + */ + public function getMessage() {} + + /** + * Sets field name related to message + * + * @param mixed $field + * @return Message + */ + public function setField($field) {} + + /** + * Returns field name related to message + */ + public function getField() {} + + /** + * Set the model who generates the message + * + * @param mixed $model + * @return Message + */ + public function setModel(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the model that produced the message + * + * @return \Phalcon\Mvc\ModelInterface + */ + public function getModel() {} + + /** + * Magic __toString method returns verbose message + * + * @return string + */ + public function __toString() {} + + /** + * Magic __set_state helps to re-build messages variable exporting + * + * @param array $message + * @return Message + */ + public static function __set_state($message) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/MessageInterface.php b/ide/2.0.8/Phalcon/mvc/model/MessageInterface.php new file mode 100644 index 000000000..e192339b2 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/MessageInterface.php @@ -0,0 +1,78 @@ +Because Phalcon\Mvc\Model requires meta-data like field names, data types, primary keys, etc. + * this component collect them and store for further querying by Phalcon\Mvc\Model. + * Phalcon\Mvc\Model\MetaData can also use adapters to store temporarily or permanently the meta-data.

+ *

A standard Phalcon\Mvc\Model\MetaData can be used to query model attributes:

+ * + * $metaData = new \Phalcon\Mvc\Model\MetaData\Memory(); + * $attributes = $metaData->getAttributes(new Robots()); + * print_r($attributes); + * + */ +abstract class MetaData implements \Phalcon\Di\InjectionAwareInterface +{ + + const MODELS_ATTRIBUTES = 0; + + + const MODELS_PRIMARY_KEY = 1; + + + const MODELS_NON_PRIMARY_KEY = 2; + + + const MODELS_NOT_NULL = 3; + + + const MODELS_DATA_TYPES = 4; + + + const MODELS_DATA_TYPES_NUMERIC = 5; + + + const MODELS_DATE_AT = 6; + + + const MODELS_DATE_IN = 7; + + + const MODELS_IDENTITY_COLUMN = 8; + + + const MODELS_DATA_TYPES_BIND = 9; + + + const MODELS_AUTOMATIC_DEFAULT_INSERT = 10; + + + const MODELS_AUTOMATIC_DEFAULT_UPDATE = 11; + + + const MODELS_DEFAULT_VALUES = 12; + + + const MODELS_EMPTY_STRING_VALUES = 13; + + + const MODELS_COLUMN_MAP = 0; + + + const MODELS_REVERSE_COLUMN_MAP = 1; + + + protected $_dependencyInjector; + + + protected $_strategy; + + + protected $_metaData; + + + protected $_columnMap; + + + /** + * Initialize the metadata for certain table + * + * @param mixed $model + * @param mixed $key + * @param mixed $table + * @param mixed $schema + */ + protected final function _initialize(\Phalcon\Mvc\ModelInterface $model, $key, $table, $schema) {} + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Set the meta-data extraction strategy + * + * @param mixed $strategy + */ + public function setStrategy(\Phalcon\Mvc\Model\MetaData\StrategyInterface $strategy) {} + + /** + * Return the strategy to obtain the meta-data + * + * @return \Phalcon\Mvc\Model\MetaData\StrategyInterface + */ + public function getStrategy() {} + + /** + * Reads the complete meta-data for certain model + * + * print_r($metaData->readMetaData(new Robots()); + * + * + * @param mixed $model + */ + public final function readMetaData(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Reads meta-data for certain model + * + * print_r($metaData->readMetaDataIndex(new Robots(), 0); + * + * + * @param mixed $model + * @param int $index + */ + public final function readMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, $index) {} + + /** + * Writes meta-data for certain model using a MODEL_* constant + * + * print_r($metaData->writeColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP, array('leName' => 'name'))); + * + * + * @param mixed $model + * @param int $index + * @param mixed $data + */ + public final function writeMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, $index, $data) {} + + /** + * Reads the ordered/reversed column map for certain model + * + * print_r($metaData->readColumnMap(new Robots())); + * + * + * @param mixed $model + */ + public final function readColumnMap(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Reads column-map information for certain model using a MODEL_* constant + * + * print_r($metaData->readColumnMapIndex(new Robots(), MetaData::MODELS_REVERSE_COLUMN_MAP)); + * + * + * @param mixed $model + * @param int $index + */ + public final function readColumnMapIndex(\Phalcon\Mvc\ModelInterface $model, $index) {} + + /** + * Returns table attributes names (fields) + * + * print_r($metaData->getAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns an array of fields which are part of the primary key + * + * print_r($metaData->getPrimaryKeyAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getPrimaryKeyAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns an array of fields which are not part of the primary key + * + * print_r($metaData->getNonPrimaryKeyAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getNonPrimaryKeyAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns an array of not null attributes + * + * print_r($metaData->getNotNullAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getNotNullAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes and their data types + * + * print_r($metaData->getDataTypes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getDataTypes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes which types are numerical + * + * print_r($metaData->getDataTypesNumeric(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getDataTypesNumeric(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the name of identity field (if one is present) + * + * print_r($metaData->getIdentityField(new Robots())); + * + * + * @param \Phalcon\Mvc\ModelInterface $model + * @return string + */ + public function getIdentityField(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes and their bind data types + * + * print_r($metaData->getBindTypes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getBindTypes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes that must be ignored from the INSERT SQL generation + * + * print_r($metaData->getAutomaticCreateAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getAutomaticCreateAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes that must be ignored from the UPDATE SQL generation + * + * print_r($metaData->getAutomaticUpdateAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getAutomaticUpdateAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Set the attributes that must be ignored from the INSERT SQL generation + * + * $metaData->setAutomaticCreateAttributes(new Robots(), array('created_at' => true)); + * + * + * @param mixed $model + * @param array $attributes + */ + public function setAutomaticCreateAttributes(\Phalcon\Mvc\ModelInterface $model, $attributes) {} + + /** + * Set the attributes that must be ignored from the UPDATE SQL generation + * + * $metaData->setAutomaticUpdateAttributes(new Robots(), array('modified_at' => true)); + * + * + * @param mixed $model + * @param array $attributes + */ + public function setAutomaticUpdateAttributes(\Phalcon\Mvc\ModelInterface $model, $attributes) {} + + /** + * Set the attributes that allow empty string values + * + * $metaData->setEmptyStringAttributes(new Robots(), array('name' => true)); + * + * + * @param mixed $model + * @param array $attributes + */ + public function setEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model, $attributes) {} + + /** + * Returns attributes allow empty strings + * + * print_r($metaData->getEmptyStringAttributes(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns attributes (which have default values) and their default values + * + * print_r($metaData->getDefaultValues(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getDefaultValues(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the column map if any + * + * print_r($metaData->getColumnMap(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getColumnMap(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Returns the reverse column map if any + * + * print_r($metaData->getReverseColumnMap(new Robots())); + * + * + * @param mixed $model + * @return array + */ + public function getReverseColumnMap(\Phalcon\Mvc\ModelInterface $model) {} + + /** + * Check if a model has certain attribute + * + * var_dump($metaData->hasAttribute(new Robots(), 'name')); + * + * + * @param mixed $model + * @param string $attribute + * @return bool + */ + public function hasAttribute(\Phalcon\Mvc\ModelInterface $model, $attribute) {} + + /** + * Checks if the internal meta-data container is empty + * + * var_dump($metaData->isEmpty()); + * + * + * @return bool + */ + public function isEmpty() {} + + /** + * Resets internal meta-data in order to regenerate it + * + * $metaData->reset(); + * + */ + public function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/MetaDataInterface.php b/ide/2.0.8/Phalcon/mvc/model/MetaDataInterface.php new file mode 100644 index 000000000..930c326a7 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/MetaDataInterface.php @@ -0,0 +1,241 @@ + + * $phql = "SELECT c.price*0.16 AS taxes, c.* FROM Cars AS c JOIN Brands AS b + * WHERE b.name = :name: ORDER BY c.name"; + * $result = manager->executeQuery($phql, array( + * "name" => "Lamborghini" + * )); + * foreach ($result as $row) { + * echo "Name: ", $row->cars->name, "\n"; + * echo "Price: ", $row->cars->price, "\n"; + * echo "Taxes: ", $row->taxes, "\n"; + * } + * + */ +class Query implements \Phalcon\Mvc\Model\QueryInterface, \Phalcon\Di\InjectionAwareInterface +{ + + const TYPE_SELECT = 309; + + + const TYPE_INSERT = 306; + + + const TYPE_UPDATE = 300; + + + const TYPE_DELETE = 303; + + + protected $_dependencyInjector; + + + protected $_manager; + + + protected $_metaData; + + + protected $_type; + + + protected $_phql; + + + protected $_ast; + + + protected $_intermediate; + + + protected $_models; + + + protected $_sqlAliases; + + + protected $_sqlAliasesModels; + + + protected $_sqlModelsAliases; + + + protected $_sqlAliasesModelsInstances; + + + protected $_sqlColumnAliases; + + + protected $_modelsInstances; + + + protected $_cache; + + + protected $_cacheOptions; + + + protected $_uniqueRow; + + + protected $_bindParams; + + + protected $_bindTypes; + + + protected $_enableImplicitJoins; + + + static protected $_irPhqlCache; + + + /** + * Phalcon\Mvc\Model\Query constructor + * + * @param string $phql + * @param \Phalcon\DiInterface $dependencyInjector + * @param mixed $options + */ + public function __construct($phql = null, \Phalcon\DiInterface $dependencyInjector = null, $options = null) {} + + /** + * Sets the dependency injection container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the dependency injection container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Tells to the query if only the first row in the resultset must be returned + * + * @param bool $uniqueRow + * @return Query + */ + public function setUniqueRow($uniqueRow) {} + + /** + * Check if the query is programmed to get only the first row in the resultset + * + * @return bool + */ + public function getUniqueRow() {} + + /** + * Replaces the model's name to its source name in a qualifed-name expression + * + * @param array $expr + * @return array + */ + protected final function _getQualified($expr) {} + + /** + * Resolves a expression in a single call argument + * + * @param array $argument + * @return array + */ + protected final function _getCallArgument($argument) {} + + /** + * Resolves a expression in a single call argument + * + * @param array $expr + * @return array + */ + protected final function _getCaseExpression($expr) {} + + /** + * Resolves a expression in a single call argument + * + * @param array $expr + * @return array + */ + protected final function _getFunctionCall($expr) {} + + /** + * Resolves an expression from its intermediate code into a string + * + * @param array $expr + * @param boolean $quoting + * @return string + */ + protected final function _getExpression($expr, $quoting = true) {} + + /** + * Resolves a column from its intermediate representation into an array used to determine + * if the resultset produced is simple or complex + * + * @param array $column + * @return array + */ + protected final function _getSelectColumn($column) {} + + /** + * Resolves a table in a SELECT statement checking if the model exists + * + * @param \Phalcon\Mvc\Model\ManagerInterface $manager + * @param array $qualifiedName + * @return string + */ + protected final function _getTable(\Phalcon\Mvc\Model\ManagerInterface $manager, $qualifiedName) {} + + /** + * Resolves a JOIN clause checking if the associated models exist + * + * @param mixed $manager + * @param mixed $join + * @return array + */ + protected final function _getJoin(\Phalcon\Mvc\Model\ManagerInterface $manager, $join) {} + + /** + * Resolves a JOIN type + * + * @param array $join + * @return string + */ + protected final function _getJoinType($join) {} + + /** + * Resolves joins involving has-one/belongs-to/has-many relations + * + * @param string $joinType + * @param string $joinSource + * @param string $modelAlias + * @param string $joinAlias + * @param \Phalcon\Mvc\Model\RelationInterface $relation + * @return array + */ + protected final function _getSingleJoin($joinType, $joinSource, $modelAlias, $joinAlias, \Phalcon\Mvc\Model\RelationInterface $relation) {} + + /** + * Resolves joins involving many-to-many relations + * + * @param string $joinType + * @param string $joinSource + * @param string $modelAlias + * @param string $joinAlias + * @param \Phalcon\Mvc\Model\RelationInterface $relation + * @return array + */ + protected final function _getMultiJoin($joinType, $joinSource, $modelAlias, $joinAlias, \Phalcon\Mvc\Model\RelationInterface $relation) {} + + /** + * Processes the JOINs in the query returning an internal representation for the database dialect + * + * @param array $select + * @return array + */ + protected final function _getJoins($select) {} + + /** + * Returns a processed order clause for a SELECT statement + * + * @param mixed $order + * @param array|string $$order + * @return array + */ + protected final function _getOrderClause($order) {} + + /** + * Returns a processed group clause for a SELECT statement + * + * @param array $group + * @return array + */ + protected final function _getGroupClause($group) {} + + /** + * Returns a processed limit clause for a SELECT statement + * + * @param array $limitClause + * @return array + */ + protected final function _getLimitClause($limitClause) {} + + /** + * Analyzes a SELECT intermediate code and produces an array to be executed later + * + * @param mixed $ast + * @param mixed $merge + * @return array + */ + protected final function _prepareSelect($ast = null, $merge = null) {} + + /** + * Analyzes an INSERT intermediate code and produces an array to be executed later + * + * @return array + */ + protected final function _prepareInsert() {} + + /** + * Analyzes an UPDATE intermediate code and produces an array to be executed later + * + * @return array + */ + protected final function _prepareUpdate() {} + + /** + * Analyzes a DELETE intermediate code and produces an array to be executed later + * + * @return array + */ + protected final function _prepareDelete() {} + + /** + * Parses the intermediate code produced by Phalcon\Mvc\Model\Query\Lang generating another + * intermediate representation that could be executed by Phalcon\Mvc\Model\Query + * + * @return array + */ + public function parse() {} + + /** + * Returns the current cache backend instance + * + * @return \Phalcon\Cache\BackendInterface + */ + public function getCache() {} + + /** + * Executes the SELECT intermediate representation producing a Phalcon\Mvc\Model\Resultset + * + * @param mixed $intermediate + * @param mixed $bindParams + * @param mixed $bindTypes + * @param bool $simulate + * @return array|\Phalcon\Mvc\Model\ResultsetInterface + */ + protected final function _executeSelect($intermediate, $bindParams, $bindTypes, $simulate = false) {} + + /** + * Executes the INSERT intermediate representation producing a Phalcon\Mvc\Model\Query\Status + * + * @param array $intermediate + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\StatusInterface + */ + protected final function _executeInsert($intermediate, $bindParams, $bindTypes) {} + + /** + * Executes the UPDATE intermediate representation producing a Phalcon\Mvc\Model\Query\Status + * + * @param array $intermediate + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\StatusInterface + */ + protected final function _executeUpdate($intermediate, $bindParams, $bindTypes) {} + + /** + * Executes the DELETE intermediate representation producing a Phalcon\Mvc\Model\Query\Status + * + * @param array $intermediate + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\StatusInterface + */ + protected final function _executeDelete($intermediate, $bindParams, $bindTypes) {} + + /** + * Query the records on which the UPDATE/DELETE operation well be done + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param array $intermediate + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\ResultsetInterface + */ + protected final function _getRelatedRecords(\Phalcon\Mvc\ModelInterface $model, $intermediate, $bindParams, $bindTypes) {} + + /** + * Executes a parsed PHQL statement + * + * @param array $bindParams + * @param array $bindTypes + * @return mixed + */ + public function execute($bindParams = null, $bindTypes = null) {} + + /** + * Executes the query returning the first result + * + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\ModelInterface + */ + public function getSingleResult($bindParams = null, $bindTypes = null) {} + + /** + * Sets the type of PHQL statement to be executed + * + * @param int $type + * @return Query + */ + public function setType($type) {} + + /** + * Gets the type of PHQL statement executed + * + * @return int + */ + public function getType() {} + + /** + * Set default bind parameters + * + * @param array $bindParams + * @param bool $merge + * @return Query + */ + public function setBindParams($bindParams, $merge = false) {} + + /** + * Returns default bind params + * + * @return array + */ + public function getBindParams() {} + + /** + * Set default bind parameters + * + * @param array $bindTypes + * @param bool $merge + * @return Query + */ + public function setBindTypes($bindTypes, $merge = false) {} + + /** + * Returns default bind types + * + * @return array + */ + public function getBindTypes() {} + + /** + * Allows to set the IR to be executed + * + * @param array $intermediate + * @return Query + */ + public function setIntermediate($intermediate) {} + + /** + * Returns the intermediate representation of the PHQL statement + * + * @return array + */ + public function getIntermediate() {} + + /** + * Sets the cache parameters of the query + * + * @param mixed $cacheOptions + * @return Query + */ + public function cache($cacheOptions) {} + + /** + * Returns the current cache options + * + * @param array + */ + public function getCacheOptions() {} + + /** + * Returns the SQL to be generated by the internal PHQL (only works in SELECT statements) + * + * @return array + */ + public function getSql() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/QueryInterface.php b/ide/2.0.8/Phalcon/mvc/model/QueryInterface.php new file mode 100644 index 000000000..058d68f18 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/QueryInterface.php @@ -0,0 +1,59 @@ + + * //Using a standard foreach + * $robots = Robots::find(array("type='virtual'", "order" => "name")); + * foreach ($robots as robot) { + * echo robot->name, "\n"; + * } + * //Using a while + * $robots = Robots::find(array("type='virtual'", "order" => "name")); + * $robots->rewind(); + * while ($robots->valid()) { + * $robot = $robots->current(); + * echo $robot->name, "\n"; + * $robots->next(); + * } + * + */ +abstract class Resultset implements \Phalcon\Mvc\Model\ResultsetInterface, \Iterator, \SeekableIterator, \Countable, \ArrayAccess, \Serializable +{ + + const TYPE_RESULT_FULL = 0; + + + const TYPE_RESULT_PARTIAL = 1; + + + const HYDRATE_RECORDS = 0; + + + const HYDRATE_OBJECTS = 2; + + + const HYDRATE_ARRAYS = 1; + + /** + * Phalcon\Db\ResultInterface or false for empty resultset + */ + protected $_result = false; + + + protected $_cache; + + + protected $_isFresh = true; + + + protected $_pointer = 0; + + + protected $_count; + + + protected $_activeRow = null; + + + protected $_rows = null; + + + protected $_row = null; + + + protected $_errorMessages; + + + protected $_hydrateMode = 0; + + + /** + * Phalcon\Mvc\Model\Resultset constructor + * + * @param \Phalcon\Db\ResultInterface|false $result + * @param \Phalcon\Cache\BackendInterface $cache + * @param array $columnTypes + */ + public function __construct($result, \Phalcon\Cache\BackendInterface $cache = null) {} + + /** + * Moves cursor to next row in the resultset + */ + public function next() {} + + /** + * Check whether internal resource has rows to fetch + * + * @return bool + */ + public function valid() {} + + /** + * Gets pointer number of active row in the resultset + * + * @return int|null + */ + public function key() {} + + /** + * Rewinds resultset to its beginning + */ + public final function rewind() {} + + /** + * Changes internal pointer to a specific position in the resultset + * Set new position if required and set this->_row + * + * @param int $position + */ + public final function seek($position) {} + + /** + * Counts how many rows are in the resultset + * + * @return int + */ + public final function count() {} + + /** + * Checks whether offset exists in the resultset + * + * @param int $index + * @return bool + */ + public function offsetExists($index) {} + + /** + * Gets row in a specific position of the resultset + * + * @param int $index + * @return bool|\Phalcon\Mvc\ModelInterface + */ + public function offsetGet($index) {} + + /** + * Resultsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface + * + * @param int $index + * @param \Phalcon\Mvc\ModelInterface $value + */ + public function offsetSet($index, $value) {} + + /** + * Resultsets cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface + * + * @param int $offset + */ + public function offsetUnset($offset) {} + + /** + * Returns the internal type of data retrieval that the resultset is using + * + * @return int + */ + public function getType() {} + + /** + * Get first row in the resultset + * + * @return bool|\Phalcon\Mvc\ModelInterface + */ + public function getFirst() {} + + /** + * Get last row in the resultset + * + * @return bool|\Phalcon\Mvc\ModelInterface + */ + public function getLast() {} + + /** + * Set if the resultset is fresh or an old one cached + * + * @param bool $isFresh + * @return Resultset + */ + public function setIsFresh($isFresh) {} + + /** + * Tell if the resultset if fresh or an old one cached + * + * @return bool + */ + public function isFresh() {} + + /** + * Sets the hydration mode in the resultset + * + * @param int $hydrateMode + * @return Resultset + */ + public function setHydrateMode($hydrateMode) {} + + /** + * Returns the current hydration mode + * + * @return int + */ + public function getHydrateMode() {} + + /** + * Returns the associated cache for the resultset + * + * @return \Phalcon\Cache\BackendInterface + */ + public function getCache() {} + + /** + * Returns the error messages produced by a batch operation + * + * @return \Phalcon\Mvc\Model\MessageInterface + */ + public function getMessages() {} + + /** + * Updates every record in the resultset + * + * @param array $data + * @param \Closure $conditionCallback + * @return boolean + */ + public function update($data, \Closure $conditionCallback = null) {} + + /** + * Deletes every record in the resultset + * + * @param mixed $conditionCallback + * @return bool + */ + public function delete(\Closure $conditionCallback = null) {} + + /** + * Filters a resultset returning only those the developer requires + * + * $filtered = $robots->filter(function($robot){ + * if ($robot->id < 3) { + * return $robot; + * } + * }); + * + * + * @param callback $filter + * @return \Phalcon\Mvc\Model[] + */ + public function filter($filter) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/ResultsetInterface.php b/ide/2.0.8/Phalcon/mvc/model/ResultsetInterface.php new file mode 100644 index 000000000..58903e36e --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/ResultsetInterface.php @@ -0,0 +1,62 @@ +x or array[x]. + */ +class Row implements \Phalcon\Mvc\EntityInterface, \Phalcon\Mvc\Model\ResultInterface, \ArrayAccess +{ + + /** + * Set the current object's state + * + * @param int $dirtyState + * @return bool + */ + public function setDirtyState($dirtyState) {} + + /** + * Checks whether offset exists in the row + * + * @param mixed $index + * @param string|int $$index + * @return boolean + */ + public function offsetExists($index) {} + + /** + * Gets a record in a specific position of the row + * + * @param string|int $index + * @return string|Phalcon\Mvc\ModelInterface + */ + public function offsetGet($index) {} + + /** + * Rows cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface + * + * @param string|int $index + * @param \Phalcon\Mvc\ModelInterface $value + */ + public function offsetSet($index, $value) {} + + /** + * Rows cannot be changed. It has only been implemented to meet the definition of the ArrayAccess interface + * + * @param string|int $offset + */ + public function offsetUnset($offset) {} + + /** + * Reads an attribute value by its name + * + * echo $robot->readAttribute('name'); + * + * + * @param string $attribute + * @return mixed + */ + public function readAttribute($attribute) {} + + /** + * Writes an attribute value by its name + * + * $robot->writeAttribute('name', 'Rosey'); + * + * + * @param string $attribute + * @param mixed $value + */ + public function writeAttribute($attribute, $value) {} + + /** + * Returns the instance as an array representation + * + * @return array + */ + public function toArray() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/Transaction.php b/ide/2.0.8/Phalcon/mvc/model/Transaction.php new file mode 100644 index 000000000..cfc88900d --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/Transaction.php @@ -0,0 +1,146 @@ + + * try { + * $manager = new \Phalcon\Mvc\Model\Transaction\Manager(); + * $transaction = $manager->get(); + * $robot = new Robots(); + * $robot->setTransaction($transaction); + * $robot->name = 'WALL·E'; + * $robot->created_at = date('Y-m-d'); + * if ($robot->save() == false) { + * $transaction->rollback("Can't save robot"); + * } + * $robotPart = new RobotParts(); + * $robotPart->setTransaction($transaction); + * $robotPart->type = 'head'; + * if ($robotPart->save() == false) { + * $transaction->rollback("Can't save robot part"); + * } + * $transaction->commit(); + * } catch(Phalcon\Mvc\Model\Transaction\Failed $e) { + * echo 'Failed, reason: ', $e->getMessage(); + * } + * + */ +class Transaction implements \Phalcon\Mvc\Model\TransactionInterface +{ + + protected $_connection; + + + protected $_activeTransaction = false; + + + protected $_isNewTransaction = true; + + + protected $_rollbackOnAbort = false; + + + protected $_manager; + + + protected $_messages; + + + protected $_rollbackRecord; + + + /** + * Phalcon\Mvc\Model\Transaction constructor + * + * @param mixed $dependencyInjector + * @param boolean $autoBegin + * @param string $service + * @param \Phalcon\DiInterface $$ependencyInjector + */ + public function __construct(\Phalcon\DiInterface $dependencyInjector, $autoBegin = false, $service = null) {} + + /** + * Sets transaction manager related to the transaction + * + * @param mixed $manager + */ + public function setTransactionManager(\Phalcon\Mvc\Model\Transaction\ManagerInterface $manager) {} + + /** + * Starts the transaction + * + * @return bool + */ + public function begin() {} + + /** + * Commits the transaction + * + * @return bool + */ + public function commit() {} + + /** + * Rollbacks the transaction + * + * @param string $rollbackMessage + * @param \Phalcon\Mvc\ModelInterface $rollbackRecord + * @return boolean + */ + public function rollback($rollbackMessage = null, $rollbackRecord = null) {} + + /** + * Returns the connection related to transaction + * + * @return \Phalcon\Db\AdapterInterface + */ + public function getConnection() {} + + /** + * Sets if is a reused transaction or new once + * + * @param bool $isNew + */ + public function setIsNewTransaction($isNew) {} + + /** + * Sets flag to rollback on abort the HTTP connection + * + * @param bool $rollbackOnAbort + */ + public function setRollbackOnAbort($rollbackOnAbort) {} + + /** + * Checks whether transaction is managed by a transaction manager + * + * @return bool + */ + public function isManaged() {} + + /** + * Returns validations messages from last save try + * + * @return array + */ + public function getMessages() {} + + /** + * Checks whether internal connection is under an active transaction + * + * @return bool + */ + public function isValid() {} + + /** + * Sets object which generates rollback action + * + * @param mixed $record + */ + public function setRollbackedRecord(\Phalcon\Mvc\ModelInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/TransactionInterface.php b/ide/2.0.8/Phalcon/mvc/model/TransactionInterface.php new file mode 100644 index 000000000..88a500734 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/TransactionInterface.php @@ -0,0 +1,91 @@ + + * $metaData = new \Phalcon\Mvc\Model\Metadata\Apc(array( + * 'prefix' => 'my-app-id', + * 'lifetime' => 86400 + * )); + * + */ +class Apc extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_prefix = ""; + + + protected $_ttl = 172800; + + + /** + * Phalcon\Mvc\Model\MetaData\Apc constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads meta-data from APC + * + * @param string $key + * @return array|null + */ + public function read($key) {} + + /** + * Writes the meta-data to APC + * + * @param string $key + * @param mixed $data + */ + public function write($key, $data) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/Files.php b/ide/2.0.8/Phalcon/mvc/model/metadata/Files.php new file mode 100644 index 000000000..86b59be2c --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/Files.php @@ -0,0 +1,43 @@ + + * $metaData = new \Phalcon\Mvc\Model\Metadata\Files(array( + * 'metaDataDir' => 'app/cache/metadata/' + * )); + * + */ +class Files extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_metaDataDir = "./"; + + + /** + * Phalcon\Mvc\Model\MetaData\Files constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads meta-data from files + * + * @param string $key + * @return mixed + */ + public function read($key) {} + + /** + * Writes the meta-data to files + * + * @param string $key + * @param array $data + */ + public function write($key, $data) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/Libmemcached.php b/ide/2.0.8/Phalcon/mvc/model/metadata/Libmemcached.php new file mode 100644 index 000000000..aa7c47fd2 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/Libmemcached.php @@ -0,0 +1,60 @@ + + * $metaData = new Phalcon\Mvc\Model\Metadata\Libmemcached(array( + * 'servers' => array( + * array('host' => 'localhost', 'port' => 11211, 'weight' => 1), + * ), + * 'client' => array( + * Memcached::OPT_HASH => Memcached::HASH_MD5, + * Memcached::OPT_PREFIX_KEY => 'prefix.', + * ), + * 'lifetime' => 3600, + * 'prefix' => 'my_' + * )); + * + */ +class Libmemcached extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_ttl = 172800; + + + protected $_memcache = null; + + + /** + * Phalcon\Mvc\Model\MetaData\Libmemcached constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads metadata from Memcache + * + * @param string $key + * @return array|null + */ + public function read($key) {} + + /** + * Writes the metadata to Memcache + * + * @param string $key + * @param mixed $data + */ + public function write($key, $data) {} + + /** + * Flush Memcache data and resets internal meta-data in order to regenerate it + */ + public function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/Memcache.php b/ide/2.0.8/Phalcon/mvc/model/metadata/Memcache.php new file mode 100644 index 000000000..73637fade --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/Memcache.php @@ -0,0 +1,56 @@ + + * $metaData = new Phalcon\Mvc\Model\Metadata\Memcache(array( + * 'prefix' => 'my-app-id', + * 'lifetime' => 86400, + * 'host' => 'localhost', + * 'port' => 11211, + * 'persistent' => false + * )); + * + */ +class Memcache extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_ttl = 172800; + + + protected $_memcache = null; + + + /** + * Phalcon\Mvc\Model\MetaData\Memcache constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads metadata from Memcache + * + * @param string $key + * @return array|null + */ + public function read($key) {} + + /** + * Writes the metadata to Memcache + * + * @param string $key + * @param mixed $data + */ + public function write($key, $data) {} + + /** + * Flush Memcache data and resets internal meta-data in order to regenerate it + */ + public function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/Memory.php b/ide/2.0.8/Phalcon/mvc/model/metadata/Memory.php new file mode 100644 index 000000000..c389c473f --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/Memory.php @@ -0,0 +1,35 @@ + + * $metaData = new Phalcon\Mvc\Model\Metadata\Redis(array( + * 'prefix' => 'my-app-id', + * 'lifetime' => 86400, + * 'host' => 'localhost', + * 'port' => 6379, + * 'persistent' => false + * )); + * + */ +class Redis extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_ttl = 172800; + + + protected $_redis = null; + + + /** + * Phalcon\Mvc\Model\MetaData\Redis constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads metadata from Redis + * + * @param string $key + * @return array|null + */ + public function read($key) {} + + /** + * Writes the metadata to Redis + * + * @param string $key + * @param mixed $data + */ + public function write($key, $data) {} + + /** + * Flush Redis data and resets internal meta-data in order to regenerate it + */ + public function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/Session.php b/ide/2.0.8/Phalcon/mvc/model/metadata/Session.php new file mode 100644 index 000000000..fad34d788 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/Session.php @@ -0,0 +1,45 @@ + + * $metaData = new \Phalcon\Mvc\Model\Metadata\Session(array( + * 'prefix' => 'my-app-id' + * )); + * + */ +class Session extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_prefix = ""; + + + /** + * Phalcon\Mvc\Model\MetaData\Session constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads meta-data from $_SESSION + * + * @param string $key + * @return array + */ + public function read($key) {} + + /** + * Writes the meta-data to $_SESSION + * + * @param string $key + * @param array $data + */ + public function write($key, $data) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/StrategyInterface.php b/ide/2.0.8/Phalcon/mvc/model/metadata/StrategyInterface.php new file mode 100644 index 000000000..b7874be24 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/StrategyInterface.php @@ -0,0 +1,28 @@ + + * $metaData = new Phalcon\Mvc\Model\Metadata\Xcache(array( + * 'prefix' => 'my-app-id', + * 'lifetime' => 86400 + * )); + * + */ +class Xcache extends \Phalcon\Mvc\Model\MetaData implements \Phalcon\Mvc\Model\MetaDataInterface +{ + + protected $_prefix = ""; + + + protected $_ttl = 172800; + + + /** + * Phalcon\Mvc\Model\MetaData\Xcache constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Reads metadata from XCache + * + * @param string $key + * @return array + */ + public function read($key) {} + + /** + * Writes the metadata to XCache + * + * @param string $key + * @param array $data + */ + public function write($key, $data) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/metadata/strategy/Annotations.php b/ide/2.0.8/Phalcon/mvc/model/metadata/strategy/Annotations.php new file mode 100644 index 000000000..f1b7b11fa --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/metadata/strategy/Annotations.php @@ -0,0 +1,27 @@ + + * $params = array( + * 'models' => array('Users'), + * 'columns' => array('id', 'name', 'status'), + * 'conditions' => array( + * array( + * "created > :min: AND created < :max:", + * array("min" => '2013-01-01', 'max' => '2014-01-01'), + * array("min" => PDO::PARAM_STR, 'max' => PDO::PARAM_STR), + * ), + * ), + * // or 'conditions' => "created > '2013-01-01' AND created < '2014-01-01'", + * 'group' => array('id', 'name'), + * 'having' => "name = 'Kamil'", + * 'order' => array('name', 'id'), + * 'limit' => 20, + * 'offset' => 20, + * // or 'limit' => array(20, 20), + * ); + * $queryBuilder = new \Phalcon\Mvc\Model\Query\Builder($params); + * + */ +class Builder implements \Phalcon\Mvc\Model\Query\BuilderInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_columns; + + + protected $_models; + + + protected $_joins; + + + protected $_with; + + + protected $_conditions; + + + protected $_group; + + + protected $_having; + + + protected $_order; + + + protected $_limit; + + + protected $_offset; + + + protected $_forUpdate; + + + protected $_sharedLock; + + + protected $_bindParams; + + + protected $_bindTypes; + + + protected $_distinct; + + + protected $_hiddenParamNumber = 0; + + + /** + * Phalcon\Mvc\Model\Query\Builder constructor + * + * @param mixed $params + * @param mixed $dependencyInjector + */ + public function __construct($params = null, \Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + * @return Builder + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets SELECT DISTINCT / SELECT ALL flag + * + * $builder->distinct("status"); + * $builder->distinct(null); + * + * + * @param mixed $distinct + * @return Builder + */ + public function distinct($distinct) {} + + /** + * Returns SELECT DISTINCT / SELECT ALL flag + * + * @return bool + */ + public function getDistinct() {} + + /** + * Sets the columns to be queried + * + * $builder->columns("id, name"); + * $builder->columns(array('id', 'name')); + * $builder->columns(array('name', 'number' => 'COUNT(*)')); + * + * + * @param mixed $columns + * @return Builder + */ + public function columns($columns) {} + + /** + * Return the columns to be queried + * + * @return string|array + */ + public function getColumns() {} + + /** + * Sets the models who makes part of the query + * + * $builder->from('Robots'); + * $builder->from(array('Robots', 'RobotsParts')); + * $builder->from(array('r' => 'Robots', 'rp' => 'RobotsParts')); + * + * + * @param mixed $models + * @return Builder + */ + public function from($models) {} + + /** + * Add a model to take part of the query + * + * // Load data from models Robots + * $builder->addFrom('Robots'); + * // Load data from model 'Robots' using 'r' as alias in PHQL + * $builder->addFrom('Robots', 'r'); + * // Load data from model 'Robots' using 'r' as alias in PHQL + * // and eager load model 'RobotsParts' + * $builder->addFrom('Robots', 'r', 'RobotsParts'); + * // Load data from model 'Robots' using 'r' as alias in PHQL + * // and eager load models 'RobotsParts' and 'Parts' + * $builder->addFrom('Robots', 'r', ['RobotsParts', 'Parts']); + * + * + * @param mixed $model + * @param mixed $alias + * @param mixed $with + * @return Builder + */ + public function addFrom($model, $alias = null, $with = null) {} + + /** + * Return the models who makes part of the query + * + * @return string|array + */ + public function getFrom() {} + + /** + * Adds a INNER join to the query + * + * // Inner Join model 'Robots' with automatic conditions and alias + * $builder->join('Robots'); + * // Inner Join model 'Robots' specifing conditions + * $builder->join('Robots', 'Robots.id = RobotsParts.robots_id'); + * // Inner Join model 'Robots' specifing conditions and alias + * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * // Left Join model 'Robots' specifing conditions, alias and type of join + * $builder->join('Robots', 'r.id = RobotsParts.robots_id', 'r', 'LEFT'); + * + * + * @param string $model + * @param string $conditions + * @param string $alias + * @param string $type + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function join($model, $conditions = null, $alias = null, $type = null) {} + + /** + * Adds a INNER join to the query + * + * // Inner Join model 'Robots' with automatic conditions and alias + * $builder->innerJoin('Robots'); + * // Inner Join model 'Robots' specifing conditions + * $builder->innerJoin('Robots', 'Robots.id = RobotsParts.robots_id'); + * // Inner Join model 'Robots' specifing conditions and alias + * $builder->innerJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param string $conditions + * @param string $alias + * @param string $type + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function innerJoin($model, $conditions = null, $alias = null) {} + + /** + * Adds a LEFT join to the query + * + * $builder->leftJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param string $conditions + * @param string $alias + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function leftJoin($model, $conditions = null, $alias = null) {} + + /** + * Adds a RIGHT join to the query + * + * $builder->rightJoin('Robots', 'r.id = RobotsParts.robots_id', 'r'); + * + * + * @param string $model + * @param string $conditions + * @param string $alias + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function rightJoin($model, $conditions = null, $alias = null) {} + + /** + * Sets the query conditions + * + * $builder->where(100); + * $builder->where('name = "Peter"'); + * $builder->where('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); + * + * + * @param mixed $conditions + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function where($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a condition to the current conditions using a AND operator + * + * $builder->andWhere('name = "Peter"'); + * $builder->andWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); + * + * + * @param string $conditions + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function andWhere($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a condition to the current conditions using a OR operator + * + * $builder->orWhere('name = "Peter"'); + * $builder->orWhere('name = :name: AND id > :id:', array('name' => 'Peter', 'id' => 100)); + * + * + * @param string $conditions + * @param array $bindParams + * @param array $bindTypes + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function orWhere($conditions, $bindParams = null, $bindTypes = null) {} + + /** + * Appends a BETWEEN condition to the current conditions + * + * $builder->betweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return Builder + */ + public function betweenWhere($expr, $minimum, $maximum) {} + + /** + * Appends a NOT BETWEEN condition to the current conditions + * + * $builder->notBetweenWhere('price', 100.25, 200.50); + * + * + * @param string $expr + * @param mixed $minimum + * @param mixed $maximum + * @return Builder + */ + public function notBetweenWhere($expr, $minimum, $maximum) {} + + /** + * Appends an IN condition to the current conditions + * + * $builder->inWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return Builder + */ + public function inWhere($expr, $values) {} + + /** + * Appends a NOT IN condition to the current conditions + * + * $builder->notInWhere('id', [1, 2, 3]); + * + * + * @param string $expr + * @param array $values + * @return Builder + */ + public function notInWhere($expr, $values) {} + + /** + * Return the conditions for the query + * + * @return string|array + */ + public function getWhere() {} + + /** + * Sets a ORDER BY condition clause + * + * $builder->orderBy('Robots.name'); + * $builder->orderBy(array('1', 'Robots.name')); + * + * + * @param string|array $orderBy + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function orderBy($orderBy) {} + + /** + * Returns the set ORDER BY clause + * + * @return string|array + */ + public function getOrderBy() {} + + /** + * Sets a HAVING condition clause. You need to escape PHQL reserved words using [ and ] delimiters + * + * $builder->having('SUM(Robots.price) > 0'); + * + * + * @param string $having + * @return Builder + */ + public function having($having) {} + + /** + * Sets a FOR UPDATE clause + * + * $builder->forUpdate(true); + * + * + * @param bool $forUpdate + * @return Builder + */ + public function forUpdate($forUpdate) {} + + /** + * Return the current having clause + * + * @return string|array + */ + public function getHaving() {} + + /** + * Sets a LIMIT clause, optionally a offset clause + * + * $builder->limit(100); + * $builder->limit(100, 20); + * + * + * @param int $limit + * @param int $offset + * @return Builder + */ + public function limit($limit = null, $offset = null) {} + + /** + * Returns the current LIMIT clause + * + * @return string|array + */ + public function getLimit() {} + + /** + * Sets an OFFSET clause + * + * $builder->offset(30); + * + * + * @param int $offset + * @return Builder + */ + public function offset($offset) {} + + /** + * Returns the current OFFSET clause + * + * @return string|array + */ + public function getOffset() {} + + /** + * Sets a GROUP BY clause + * + * $builder->groupBy(array('Robots.name')); + * + * + * @param string|array $group + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function groupBy($group) {} + + /** + * Returns the GROUP BY clause + * + * @return string + */ + public function getGroupBy() {} + + /** + * Returns a PHQL statement built based on the builder parameters + * + * @return string + */ + public final function getPhql() {} + + /** + * Returns the query built + * + * @return \Phalcon\Mvc\Model\Query + */ + public function getQuery() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/query/BuilderInterface.php b/ide/2.0.8/Phalcon/mvc/model/query/BuilderInterface.php new file mode 100644 index 000000000..9e8b04895 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/query/BuilderInterface.php @@ -0,0 +1,249 @@ + + * $intermediate = Phalcon\Mvc\Model\Query\Lang::parsePHQL("SELECT r.* FROM Robots r LIMIT 10"); + * + */ +abstract class Lang +{ + + /** + * Parses a PHQL statement returning an intermediate representation (IR) + * + * @param string $phql + * @return string + */ + public static function parsePHQL($phql) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/query/Status.php b/ide/2.0.8/Phalcon/mvc/model/query/Status.php new file mode 100644 index 000000000..44bd6423d --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/query/Status.php @@ -0,0 +1,63 @@ + + * $phql = "UPDATE Robots SET name = :name:, type = :type:, year = :year: WHERE id = :id:"; + * $status = $app->modelsManager->executeQuery($phql, array( + * 'id' => 100, + * 'name' => 'Astroy Boy', + * 'type' => 'mechanical', + * 'year' => 1959 + * )); + * \//Check if the update was successful + * if ($status->success() == true) { + * echo 'OK'; + * } + * + */ +class Status implements \Phalcon\Mvc\Model\Query\StatusInterface +{ + + protected $_success; + + + protected $_model; + + + /** + * Phalcon\Mvc\Model\Query\Status + * + * @param bool $success + * @param mixed $model + */ + public function __construct($success, \Phalcon\Mvc\ModelInterface $model = null) {} + + /** + * Returns the model that executed the action + * + * @return \Phalcon\Mvc\ModelInterface + */ + public function getModel() {} + + /** + * Returns the messages produced because of a failed operation + * + * @return \Phalcon\Mvc\Model\MessageInterface + */ + public function getMessages() {} + + /** + * Allows to check if the executed operation was successful + * + * @return bool + */ + public function success() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/query/StatusInterface.php b/ide/2.0.8/Phalcon/mvc/model/query/StatusInterface.php new file mode 100644 index 000000000..9b1b58318 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/query/StatusInterface.php @@ -0,0 +1,41 @@ + + * try { + * use Phalcon\Mvc\Model\Transaction\Manager as TransactionManager; + * $transactionManager = new TransactionManager(); + * $transaction = $transactionManager->get(); + * $robot = new Robots(); + * $robot->setTransaction($transaction); + * $robot->name = 'WALL·E'; + * $robot->created_at = date('Y-m-d'); + * if($robot->save()==false){ + * $transaction->rollback("Can't save robot"); + * } + * $robotPart = new RobotParts(); + * $robotPart->setTransaction($transaction); + * $robotPart->type = 'head'; + * if($robotPart->save()==false){ + * $transaction->rollback("Can't save robot part"); + * } + * $transaction->commit(); + * } catch (Phalcon\Mvc\Model\Transaction\Failed $e) { + * echo 'Failed, reason: ', $e->getMessage(); + * } + * + */ +class Manager implements \Phalcon\Mvc\Model\Transaction\ManagerInterface, \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_initialized = false; + + + protected $_rollbackPendent = true; + + + protected $_number = 0; + + + protected $_service = "db"; + + + protected $_transactions; + + + /** + * Phalcon\Mvc\Model\Transaction\Manager constructor + * + * @param mixed $dependencyInjector + */ + public function __construct(\Phalcon\DiInterface $dependencyInjector = null) {} + + /** + * Sets the dependency injection container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the dependency injection container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the database service used to run the isolated transactions + * + * @param string $service + * @return Manager + */ + public function setDbService($service) {} + + /** + * Returns the database service used to isolate the transaction + * + * @return string + */ + public function getDbService() {} + + /** + * Set if the transaction manager must register a shutdown function to clean up pendent transactions + * + * @param bool $rollbackPendent + * @return Manager + */ + public function setRollbackPendent($rollbackPendent) {} + + /** + * Check if the transaction manager is registering a shutdown function to clean up pendent transactions + * + * @return bool + */ + public function getRollbackPendent() {} + + /** + * Checks whether the manager has an active transaction + * + * @return bool + */ + public function has() {} + + /** + * Returns a new \Phalcon\Mvc\Model\Transaction or an already created once + * This method registers a shutdown function to rollback active connections + * + * @param bool $autoBegin + * @return \Phalcon\Mvc\Model\TransactionInterface + */ + public function get($autoBegin = true) {} + + /** + * Create/Returns a new transaction or an existing one + * + * @param bool $autoBegin + * @return \Phalcon\Mvc\Model\TransactionInterface + */ + public function getOrCreateTransaction($autoBegin = true) {} + + /** + * Rollbacks active transactions within the manager + */ + public function rollbackPendent() {} + + /** + * Commmits active transactions within the manager + */ + public function commit() {} + + /** + * Rollbacks active transactions within the manager + * Collect will remove the transaction from the manager + * + * @param boolean $collect + */ + public function rollback($collect = true) {} + + /** + * Notifies the manager about a rollbacked transaction + * + * @param mixed $transaction + */ + public function notifyRollback(\Phalcon\Mvc\Model\TransactionInterface $transaction) {} + + /** + * Notifies the manager about a commited transaction + * + * @param mixed $transaction + */ + public function notifyCommit(\Phalcon\Mvc\Model\TransactionInterface $transaction) {} + + /** + * Removes transactions from the TransactionManager + * + * @param mixed $transaction + */ + protected function _collectTransaction(\Phalcon\Mvc\Model\TransactionInterface $transaction) {} + + /** + * Remove all the transactions from the manager + */ + public function collectTransactions() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/transaction/ManagerInterface.php b/ide/2.0.8/Phalcon/mvc/model/transaction/ManagerInterface.php new file mode 100644 index 000000000..5fc97d481 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/transaction/ManagerInterface.php @@ -0,0 +1,71 @@ + + * use Phalcon\Mvc\Model\Validator\Email as EmailValidator; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new EmailValidator(array( + * 'field' => 'electronic_mail' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Email extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Exclusionin.php b/ide/2.0.8/Phalcon/mvc/model/validator/Exclusionin.php new file mode 100644 index 000000000..68d4f6712 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Exclusionin.php @@ -0,0 +1,36 @@ + + * use Phalcon\Mvc\Model\Validator\ExclusionIn as ExclusionInValidator; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new ExclusionInValidator(array( + * 'field' => 'status', + * 'domain' => array('A', 'I') + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Exclusionin extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Inclusionin.php b/ide/2.0.8/Phalcon/mvc/model/validator/Inclusionin.php new file mode 100644 index 000000000..59cf66446 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Inclusionin.php @@ -0,0 +1,36 @@ + + * use Phalcon\Mvc\Model\Validator\InclusionIn as InclusionInValidator; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new InclusionInValidator(array( + * "field" => 'status', + * 'domain' => array('A', 'I') + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Inclusionin extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Ip.php b/ide/2.0.8/Phalcon/mvc/model/validator/Ip.php new file mode 100644 index 000000000..d51d0bb77 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Ip.php @@ -0,0 +1,59 @@ + + * use Phalcon\Mvc\Model\Validator\Ip; + * class Data extends Phalcon\Mvc\Model + * { + * public function validation() + * { + * // Any pubic IP + * $this->validate(new IP(array( + * 'field' => 'server_ip', + * 'version' => IP::VERSION_4 | IP::VERSION_6, // v6 and v4. The same if not specified + * 'allowReserved' => false, // False if not specified. Ignored for v6 + * 'allowPrivate' => false, // False if not specified + * 'message' => 'IP address has to be correct' + * ))); + * // Any public v4 address + * $this->validate(new IP(array( + * 'field' => 'ip_4', + * 'version' => IP::VERSION_4, + * 'message' => 'IP address has to be correct' + * ))); + * // Any v6 address + * $this->validate(new IP(array( + * 'field' => 'ip6', + * 'version' => IP::VERSION_6, + * 'allowPrivate' => true, + * 'message' => 'IP address has to be correct' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Ip extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + const VERSION_4 = 1048576; + + + const VERSION_6 = 2097152; + + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Numericality.php b/ide/2.0.8/Phalcon/mvc/model/validator/Numericality.php new file mode 100644 index 000000000..3d974013a --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Numericality.php @@ -0,0 +1,35 @@ + + * use Phalcon\Mvc\Model\Validator\Numericality as NumericalityValidator; + * class Products extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new NumericalityValidator(array( + * "field" => 'price' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Numericality extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/PresenceOf.php b/ide/2.0.8/Phalcon/mvc/model/validator/PresenceOf.php new file mode 100644 index 000000000..60940e751 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/PresenceOf.php @@ -0,0 +1,36 @@ + + * use Phalcon\Mvc\Model\Validator\PresenceOf; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new PresenceOf(array( + * "field" => 'name', + * "message" => 'The name is required' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class PresenceOf extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Regex.php b/ide/2.0.8/Phalcon/mvc/model/validator/Regex.php new file mode 100644 index 000000000..2d4bc5be0 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Regex.php @@ -0,0 +1,36 @@ + + * use Phalcon\Mvc\Model\Validator\Regex as RegexValidator; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new RegexValidator(array( + * "field" => 'created_at', + * 'pattern' => '/^[0-9]{4}[-\/](0[1-9]|1[12])[-\/](0[1-9]|[12][0-9]|3[01])/' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Regex extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/StringLength.php b/ide/2.0.8/Phalcon/mvc/model/validator/StringLength.php new file mode 100644 index 000000000..0af90947b --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/StringLength.php @@ -0,0 +1,39 @@ + + * use Phalcon\Mvc\Model\Validator\StringLength as StringLengthValidator; + * class Subscriptors extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new StringLengthValidator(array( + * "field" => 'name_last', + * 'max' => 50, + * 'min' => 2, + * 'messageMaximum' => 'We don\'t like really long names', + * 'messageMinimum' => 'We want more than just their initials' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class StringLength extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Uniqueness.php b/ide/2.0.8/Phalcon/mvc/model/validator/Uniqueness.php new file mode 100644 index 000000000..19502febe --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Uniqueness.php @@ -0,0 +1,38 @@ + + * use Phalcon\Mvc\Model; + * use Phalcon\Mvc\Model\Validator\Uniqueness; + * class Subscriptors extends Model + * { + * public function validation() + * { + * $this->validate(new Uniqueness(array( + * "field" => "email", + * "message" => "Value of field 'email' is already present in another record" + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Uniqueness extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/model/validator/Url.php b/ide/2.0.8/Phalcon/mvc/model/validator/Url.php new file mode 100644 index 000000000..11d72f931 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/model/validator/Url.php @@ -0,0 +1,35 @@ + + * use Phalcon\Mvc\Model\Validator\Url as UrlValidator; + * class Posts extends \Phalcon\Mvc\Model + * { + * public function validation() + * { + * $this->validate(new UrlValidator(array( + * 'field' => 'source_url' + * ))); + * if ($this->validationHasFailed() == true) { + * return false; + * } + * } + * } + * + */ +class Url extends \Phalcon\Mvc\Model\Validator implements \Phalcon\Mvc\Model\ValidatorInterface +{ + + /** + * Executes the validator + * + * @param mixed $record + * @return bool + */ + public function validate(\Phalcon\Mvc\EntityInterface $record) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/router/Annotations.php b/ide/2.0.8/Phalcon/mvc/router/Annotations.php new file mode 100644 index 000000000..997c7d992 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/router/Annotations.php @@ -0,0 +1,105 @@ + + * $di['router'] = function() { + * //Use the annotations router + * $router = new Annotations(false); + * //This will do the same as above but only if the handled uri starts with /robots + * $router->addResource('Robots', '/robots'); + * return $router; + * }; + * + */ +class Annotations extends \Phalcon\Mvc\Router +{ + + protected $_handlers; + + + protected $_processed = false; + + + protected $_controllerSuffix = "Controller"; + + + protected $_actionSuffix = "Action"; + + + protected $_routePrefix; + + + /** + * Adds a resource to the annotations handler + * A resource is a class that contains routing annotations + * + * @param string $handler + * @param string $prefix + * @return Annotations + */ + public function addResource($handler, $prefix = null) {} + + /** + * Adds a resource to the annotations handler + * A resource is a class that contains routing annotations + * The class is located in a module + * + * @param string $module + * @param string $handler + * @param string $prefix + * @return Annotations + */ + public function addModuleResource($module, $handler, $prefix = null) {} + + /** + * Produce the routing parameters from the rewrite information + * + * @param string $uri + */ + public function handle($uri = null) {} + + /** + * Checks for annotations in the controller docblock + * + * @param string $handler + * @param mixed $annotation + */ + public function processControllerAnnotation($handler, \Phalcon\Annotations\Annotation $annotation) {} + + /** + * Checks for annotations in the public methods of the controller + * + * @param string $module + * @param string $namespaceName + * @param string $controller + * @param string $action + * @param mixed $annotation + */ + public function processActionAnnotation($module, $namespaceName, $controller, $action, \Phalcon\Annotations\Annotation $annotation) {} + + /** + * Changes the controller class suffix + * + * @param string $controllerSuffix + */ + public function setControllerSuffix($controllerSuffix) {} + + /** + * Changes the action method suffix + * + * @param string $actionSuffix + */ + public function setActionSuffix($actionSuffix) {} + + /** + * Return the registered resources + * + * @return array + */ + public function getResources() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/router/Exception.php b/ide/2.0.8/Phalcon/mvc/router/Exception.php new file mode 100644 index 000000000..e8a40f672 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/router/Exception.php @@ -0,0 +1,12 @@ + + * $router = new \Phalcon\Mvc\Router(); + * //Create a group with a common module and controller + * $blog = new Group(array( + * 'module' => 'blog', + * 'controller' => 'index' + * )); + * //All the routes start with /blog + * $blog->setPrefix('/blog'); + * //Add a route to the group + * $blog->add('/save', array( + * 'action' => 'save' + * )); + * //Add another route to the group + * $blog->add('/edit/{id}', array( + * 'action' => 'edit' + * )); + * //This route maps to a controller different than the default + * $blog->add('/blog', array( + * 'controller' => 'about', + * 'action' => 'index' + * )); + * //Add the group to the router + * $router->mount($blog); + * + */ +class Group implements \Phalcon\Mvc\Router\GroupInterface +{ + + protected $_prefix; + + + protected $_hostname; + + + protected $_paths; + + + protected $_routes; + + + protected $_beforeMatch; + + + /** + * Phalcon\Mvc\Router\Group constructor + * + * @param mixed $paths + */ + public function __construct($paths = null) {} + + /** + * Set a hostname restriction for all the routes in the group + * + * @param string $hostname + * @return GroupInterface + */ + public function setHostname($hostname) {} + + /** + * Returns the hostname restriction + * + * @return string + */ + public function getHostname() {} + + /** + * Set a common uri prefix for all the routes in this group + * + * @param string $prefix + * @return GroupInterface + */ + public function setPrefix($prefix) {} + + /** + * Returns the common prefix for all the routes + * + * @return string + */ + public function getPrefix() {} + + /** + * Sets a callback that is called if the route is matched. + * The developer can implement any arbitrary conditions here + * If the callback returns false the route is treated as not matched + * + * @param callable $beforeMatch + * @return GroupInterface + */ + public function beforeMatch($beforeMatch) {} + + /** + * Returns the 'before match' callback if any + * + * @return callable + */ + public function getBeforeMatch() {} + + /** + * Set common paths for all the routes in the group + * + * @param mixed $paths + * @return GroupInterface + */ + public function setPaths($paths) {} + + /** + * Returns the common paths defined for this group + * + * @return array|string + */ + public function getPaths() {} + + /** + * Returns the routes added to the group + * + * @return RouteInterface + */ + public function getRoutes() {} + + /** + * Adds a route to the router on any HTTP method + * + * router->add('/about', 'About::index'); + * + * + * @param string $pattern + * @param mixed $paths + * @param mixed $httpMethods + * @return RouteInterface + */ + public function add($pattern, $paths = null, $httpMethods = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is GET + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addGet($pattern, $paths = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is POST + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addPost($pattern, $paths = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is PUT + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addPut($pattern, $paths = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is PATCH + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addPatch($pattern, $paths = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is DELETE + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addDelete($pattern, $paths = null) {} + + /** + * Add a route to the router that only match if the HTTP method is OPTIONS + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addOptions($pattern, $paths = null) {} + + /** + * Adds a route to the router that only match if the HTTP method is HEAD + * + * @param string $pattern + * @param string/array $paths + * @return \Phalcon\Mvc\Router\Route + */ + public function addHead($pattern, $paths = null) {} + + /** + * Removes all the pre-defined routes + */ + public function clear() {} + + /** + * Adds a route applying the common attributes + * + * @param string $pattern + * @param mixed $paths + * @param mixed $httpMethods + * @return RouteInterface + */ + protected function _addRoute($pattern, $paths = null, $httpMethods = null) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/router/GroupInterface.php b/ide/2.0.8/Phalcon/mvc/router/GroupInterface.php new file mode 100644 index 000000000..bd9481889 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/router/GroupInterface.php @@ -0,0 +1,186 @@ + + * $router = new \Phalcon\Mvc\Router(); + * //Create a group with a common module and controller + * $blog = new Group(array( + * 'module' => 'blog', + * 'controller' => 'index' + * )); + * //All the routes start with /blog + * $blog->setPrefix('/blog'); + * //Add a route to the group + * $blog->add('/save', array( + * 'action' => 'save' + * )); + * //Add another route to the group + * $blog->add('/edit/{id}', array( + * 'action' => 'edit' + * )); + * //This route maps to a controller different than the default + * $blog->add('/blog', array( + * 'controller' => 'about', + * 'action' => 'index' + * )); + * //Add the group to the router + * $router->mount($blog); + * + */ +interface GroupInterface +{ + + /** + * Set a hostname restriction for all the routes in the group + * + * @param string $hostname + * @return GroupInterface + */ + public function setHostname($hostname); + + /** + * Returns the hostname restriction + * + * @return string + */ + public function getHostname(); + + /** + * Set a common uri prefix for all the routes in this group + * + * @param string $prefix + * @return GroupInterface + */ + public function setPrefix($prefix); + + /** + * Returns the common prefix for all the routes + * + * @return string + */ + public function getPrefix(); + + /** + * Sets a callback that is called if the route is matched. + * The developer can implement any arbitrary conditions here + * If the callback returns false the route is treated as not matched + * + * @param callable $beforeMatch + * @return GroupInterface + */ + public function beforeMatch($beforeMatch); + + /** + * Returns the 'before match' callback if any + * + * @return callable + */ + public function getBeforeMatch(); + + /** + * Set common paths for all the routes in the group + * + * @param array $paths + * @return \Phalcon\Mvc\Router\Group + */ + public function setPaths($paths); + + /** + * Returns the common paths defined for this group + * + * @return array|string + */ + public function getPaths(); + + /** + * Returns the routes added to the group + * + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function getRoutes(); + + /** + * Adds a route to the router on any HTTP method + * + * router->add('/about', 'About::index'); + * + * + * @param string $pattern + * @param mixed $paths + * @param mixed $httpMethods + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function add($pattern, $paths = null, $httpMethods = null); + + /** + * Adds a route to the router that only match if the HTTP method is GET + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addGet($pattern, $paths = null); + + /** + * Adds a route to the router that only match if the HTTP method is POST + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPost($pattern, $paths = null); + + /** + * Adds a route to the router that only match if the HTTP method is PUT + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPut($pattern, $paths = null); + + /** + * Adds a route to the router that only match if the HTTP method is PATCH + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addPatch($pattern, $paths = null); + + /** + * Adds a route to the router that only match if the HTTP method is DELETE + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addDelete($pattern, $paths = null); + + /** + * Add a route to the router that only match if the HTTP method is OPTIONS + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addOptions($pattern, $paths = null); + + /** + * Adds a route to the router that only match if the HTTP method is HEAD + * + * @param string $pattern + * @param mixed $paths + * @return \Phalcon\Mvc\Router\RouteInterface + */ + public function addHead($pattern, $paths = null); + + /** + * Removes all the pre-defined routes + */ + public function clear(); + +} diff --git a/ide/2.0.8/Phalcon/mvc/router/Route.php b/ide/2.0.8/Phalcon/mvc/router/Route.php new file mode 100644 index 000000000..5cb392f08 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/router/Route.php @@ -0,0 +1,243 @@ + + * $route->via('GET'); + * $route->via(array('GET', 'POST')); + * + * + * @param mixed $httpMethods + * @return Route + */ + public function via($httpMethods) {} + + /** + * Extracts parameters from a string + * + * @param string $pattern + * @return array|bool + */ + public function extractNamedParams($pattern) {} + + /** + * Reconfigure the route adding a new pattern and a set of paths + * + * @param string $pattern + * @param mixed $paths + */ + public function reConfigure($pattern, $paths = null) {} + + /** + * Returns routePaths + * + * @param mixed $paths + * @return array + */ + public static function getRoutePaths($paths = null) {} + + /** + * Returns the route's name + * + * @return string + */ + public function getName() {} + + /** + * Sets the route's name + * + * $router->add('/about', array( + * 'controller' => 'about' + * ))->setName('about'); + * + * + * @param string $name + * @return Route + */ + public function setName($name) {} + + /** + * Sets a callback that is called if the route is matched. + * The developer can implement any arbitrary conditions here + * If the callback returns false the route is treated as not matched + * + * @param callable $callback + * @return Route + */ + public function beforeMatch($callback) {} + + /** + * Returns the 'before match' callback if any + * + * @return callable + */ + public function getBeforeMatch() {} + + /** + * Returns the route's id + * + * @return string + */ + public function getRouteId() {} + + /** + * Returns the route's pattern + * + * @return string + */ + public function getPattern() {} + + /** + * Returns the route's compiled pattern + * + * @return string + */ + public function getCompiledPattern() {} + + /** + * Returns the paths + * + * @return array + */ + public function getPaths() {} + + /** + * Returns the paths using positions as keys and names as values + * + * @return array + */ + public function getReversedPaths() {} + + /** + * Sets a set of HTTP methods that constraint the matching of the route (alias of via) + * + * $route->setHttpMethods('GET'); + * $route->setHttpMethods(array('GET', 'POST')); + * + * + * @param mixed $httpMethods + * @return Route + */ + public function setHttpMethods($httpMethods) {} + + /** + * Returns the HTTP methods that constraint matching the route + * + * @return array|string + */ + public function getHttpMethods() {} + + /** + * Sets a hostname restriction to the route + * + * $route->setHostname('localhost'); + * + * + * @param string $hostname + * @return Route + */ + public function setHostname($hostname) {} + + /** + * Returns the hostname restriction if any + * + * @return string + */ + public function getHostname() {} + + /** + * Sets the group associated with the route + * + * @param mixed $group + * @return Route + */ + public function setGroup(GroupInterface $group) {} + + /** + * Returns the group associated with the route + * + * @return null|GroupInterface + */ + public function getGroup() {} + + /** + * Adds a converter to perform an additional transformation for certain parameter + * + * @param string $name + * @param mixed $converter + * @return Route + */ + public function convert($name, $converter) {} + + /** + * Returns the router converter + * + * @return array + */ + public function getConverters() {} + + /** + * Resets the internal route id generator + */ + public static function reset() {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/router/RouteInterface.php b/ide/2.0.8/Phalcon/mvc/router/RouteInterface.php new file mode 100644 index 000000000..e49f3af1d --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/router/RouteInterface.php @@ -0,0 +1,113 @@ + + * $view = new \Phalcon\Mvc\View\Simple(); + * echo $view->render('templates/my-view', array('content' => $html)); + * //or with filename with extension + * echo $view->render('templates/my-view.volt', array('content' => $html)); + * + */ +class Simple extends \Phalcon\Di\Injectable implements \Phalcon\Mvc\ViewBaseInterface +{ + + protected $_options; + + + protected $_viewsDir; + + + protected $_partialsDir; + + + protected $_viewParams; + + + protected $_engines = false; + + + protected $_registeredEngines; + + + protected $_activeRenderPath; + + + protected $_content; + + + protected $_cache = false; + + + protected $_cacheOptions; + + + + public function getRegisteredEngines() {} + + /** + * Phalcon\Mvc\View\Simple constructor + * + * @param array $options + */ + public function __construct($options = null) {} + + /** + * Sets views directory. Depending of your platform, always add a trailing slash or backslash + * + * @param string $viewsDir + */ + public function setViewsDir($viewsDir) {} + + /** + * Gets views directory + * + * @return string + */ + public function getViewsDir() {} + + /** + * Register templating engines + * + * $this->view->registerEngines(array( + * ".phtml" => "Phalcon\Mvc\View\Engine\Php", + * ".volt" => "Phalcon\Mvc\View\Engine\Volt", + * ".mhtml" => "MyCustomEngine" + * )); + * + * + * @param array $engines + */ + public function registerEngines($engines) {} + + /** + * Loads registered template engines, if none is registered it will use Phalcon\Mvc\View\Engine\Php + * + * @return array + */ + protected function _loadTemplateEngines() {} + + /** + * Tries to render the view with every engine registered in the component + * + * @param string $path + * @param array $params + */ + protected final function _internalRender($path, $params) {} + + /** + * Renders a view + * + * @param string $path + * @param array $params + * @return string + */ + public function render($path, $params = null) {} + + /** + * Renders a partial view + * + * //Show a partial inside another view + * $this->partial('shared/footer'); + * + * + * //Show a partial inside another view with parameters + * $this->partial('shared/footer', array('content' => $html)); + * + * + * @param string $partialPath + * @param array $params + */ + public function partial($partialPath, $params = null) {} + + /** + * Sets the cache options + * + * @param array $options + * @return \Phalcon\Mvc\View\Simple + */ + public function setCacheOptions($options) {} + + /** + * Returns the cache options + * + * @return array + */ + public function getCacheOptions() {} + + /** + * Create a Phalcon\Cache based on the internal cache options + * + * @return \Phalcon\Cache\BackendInterface + */ + protected function _createCache() {} + + /** + * Returns the cache instance used to cache + * + * @return \Phalcon\Cache\BackendInterface + */ + public function getCache() {} + + /** + * Cache the actual view render to certain level + * + * $this->view->cache(array('key' => 'my-key', 'lifetime' => 86400)); + * + * + * @param mixed $options + * @return Simple + */ + public function cache($options = true) {} + + /** + * Adds parameters to views (alias of setVar) + * + * $this->view->setParamToView('products', $products); + * + * + * @param string $key + * @param mixed $value + * @return Simple + */ + public function setParamToView($key, $value) {} + + /** + * Set all the render params + * + * $this->view->setVars(array('products' => $products)); + * + * + * @param array $params + * @param bool $merge + * @return Simple + */ + public function setVars($params, $merge = true) {} + + /** + * Set a single view parameter + * + * $this->view->setVar('products', $products); + * + * + * @param string $key + * @param mixed $value + * @return Simple + */ + public function setVar($key, $value) {} + + /** + * Returns a parameter previously set in the view + * + * @param string $key + * @return mixed + */ + public function getVar($key) {} + + /** + * Returns parameters to views + * + * @return array + */ + public function getParamsToView() {} + + /** + * Externally sets the view content + * + * $this->view->setContent("

hello

"); + *
+ * + * @param string $content + * @return Simple + */ + public function setContent($content) {} + + /** + * Returns cached output from another view stage + * + * @return string + */ + public function getContent() {} + + /** + * Returns the path of the view that is currently rendered + * + * @return string + */ + public function getActiveRenderPath() {} + + /** + * Magic method to pass variables to the views + * + * $this->view->products = $products; + * + * + * @param string $key + * @param mixed $value + */ + public function __set($key, $value) {} + + /** + * Magic method to retrieve a variable passed to the view + * + * echo $this->view->products; + * + * + * @param string $key + * @return mixed + */ + public function __get($key) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/view/engine/Php.php b/ide/2.0.8/Phalcon/mvc/view/engine/Php.php new file mode 100644 index 000000000..d554be8de --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/view/engine/Php.php @@ -0,0 +1,21 @@ + + * $compiler = new \Phalcon\Mvc\View\Engine\Volt\Compiler(); + * $compiler->compile('views/partials/header.volt'); + * require $compiler->getCompiledTemplatePath(); + * + */ +class Compiler implements \Phalcon\Di\InjectionAwareInterface +{ + + protected $_dependencyInjector; + + + protected $_view; + + + protected $_options; + + + protected $_arrayHelpers; + + + protected $_level = 0; + + + protected $_foreachLevel = 0; + + + protected $_blockLevel = 0; + + + protected $_exprLevel = 0; + + + protected $_extended = false; + + + protected $_autoescape = false; + + + protected $_extendedBlocks; + + + protected $_currentBlock; + + + protected $_blocks; + + + protected $_forElsePointers; + + + protected $_loopPointers; + + + protected $_extensions; + + + protected $_functions; + + + protected $_filters; + + + protected $_macros; + + + protected $_prefix; + + + protected $_currentPath; + + + protected $_compiledTemplatePath; + + + /** + * Phalcon\Mvc\View\Engine\Volt\Compiler + * + * @param mixed $view + */ + public function __construct(\Phalcon\Mvc\ViewBaseInterface $view = null) {} + + /** + * Sets the dependency injector + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the internal dependency injector + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Sets the compiler options + * + * @param array $options + */ + public function setOptions($options) {} + + /** + * Sets a single compiler option + * + * @param string $option + * @param mixed $value + */ + public function setOption($option, $value) {} + + /** + * Returns a compiler's option + * + * @param string $option + * @return string + */ + public function getOption($option) {} + + /** + * Returns the compiler options + * + * @return array + */ + public function getOptions() {} + + /** + * Fires an event to registered extensions + * + * @param string $name + * @param array $arguments + * @return mixed + */ + public final function fireExtensionEvent($name, $arguments = null) {} + + /** + * Registers a Volt's extension + * + * @param mixed $extension + * @return Compiler + */ + public function addExtension($extension) {} + + /** + * Returns the list of extensions registered in Volt + * + * @return array + */ + public function getExtensions() {} + + /** + * Register a new function in the compiler + * + * @param string $name + * @param mixed $definition + * @return Compiler + */ + public function addFunction($name, $definition) {} + + /** + * Register the user registered functions + * + * @return array + */ + public function getFunctions() {} + + /** + * Register a new filter in the compiler + * + * @param string $name + * @param mixed $definition + * @return Compiler + */ + public function addFilter($name, $definition) {} + + /** + * Register the user registered filters + * + * @return array + */ + public function getFilters() {} + + /** + * Set a unique prefix to be used as prefix for compiled variables + * + * @param string $prefix + * @return Compiler + */ + public function setUniquePrefix($prefix) {} + + /** + * Return a unique prefix to be used as prefix for compiled variables and contexts + * + * @return string + */ + public function getUniquePrefix() {} + + /** + * Resolves attribute reading + * + * @param array $expr + * @return string + */ + public function attributeReader($expr) {} + + /** + * Resolves function intermediate code into PHP function calls + * + * @param array $expr + * @return string + */ + public function functionCall($expr) {} + + /** + * Resolves filter intermediate code into a valid PHP expression + * + * @param array $test + * @param string $left + * @return string + */ + public function resolveTest($test, $left) {} + + /** + * Resolves filter intermediate code into PHP function calls + * + * @param array $filter + * @param string $left + * @return string + */ + final protected function resolveFilter($filter, $left) {} + + /** + * Resolves an expression node in an AST volt tree + * + * @param array $expr + * @return string + */ + final public function expression($expr) {} + + /** + * Compiles a block of statements + * + * @param array $statements + * @return string|array + */ + final protected function _statementListOrExtends($statements) {} + + /** + * Compiles a "foreach" intermediate code representation into plain PHP code + * + * @param array $statement + * @param bool $extendsMode + * @return string + */ + public function compileForeach($statement, $extendsMode = false) {} + + /** + * Generates a 'forelse' PHP code + * + * @return string + */ + public function compileForElse() {} + + /** + * Compiles a 'if' statement returning PHP code + * + * @param array $statement + * @param bool $extendsMode + * @return string + */ + public function compileIf($statement, $extendsMode = false) {} + + /** + * Compiles a "elseif" statement returning PHP code + * + * @param array $statement + * @return string + */ + public function compileElseIf($statement) {} + + /** + * Compiles a "cache" statement returning PHP code + * + * @param array $statement + * @param bool $extendsMode + * @return string + */ + public function compileCache($statement, $extendsMode = false) {} + + /** + * Compiles a "set" statement returning PHP code + * + * @param array $statement + * @return string + */ + public function compileSet($statement) {} + + /** + * Compiles a "do" statement returning PHP code + * + * @param array $statement + * @return string + */ + public function compileDo($statement) {} + + /** + * Compiles a "return" statement returning PHP code + * + * @param array $statement + * @return string + */ + public function compileReturn($statement) {} + + /** + * Compiles a "autoescape" statement returning PHP code + * + * @param array $statement + * @param bool $extendsMode + * @return string + */ + public function compileAutoEscape($statement, $extendsMode) {} + + /** + * Compiles a '{{' '}}' statement returning PHP code + * + * @param array $statement + * @param boolean $extendsMode + * @return string + */ + public function compileEcho($statement) {} + + /** + * Compiles a 'include' statement returning PHP code + * + * @param array $statement + * @return string + */ + public function compileInclude($statement) {} + + /** + * Compiles macros + * + * @param array $statement + * @param bool $extendsMode + * @return string + */ + public function compileMacro($statement, $extendsMode) {} + + /** + * Compiles calls to macros + * + * @param array $statement + * @param boolean $extendsMode + * @return string + */ + public function compileCall($statement, $extendsMode) {} + + /** + * Traverses a statement list compiling each of its nodes + * + * @param array $statements + * @param bool $extendsMode + * @return string + */ + final protected function _statementList($statements, $extendsMode = false) {} + + /** + * Compiles a Volt source code returning a PHP plain version + * + * @param string $viewCode + * @param bool $extendsMode + * @return string + */ + protected function _compileSource($viewCode, $extendsMode = false) {} + + /** + * Compiles a template into a string + * + * echo $compiler->compileString('{{ "hello world" }}'); + * + * + * @param string $viewCode + * @param bool $extendsMode + * @return string + */ + public function compileString($viewCode, $extendsMode = false) {} + + /** + * Compiles a template into a file forcing the destination path + * + * $compiler->compile('views/layouts/main.volt', 'views/layouts/main.volt.php'); + * + * + * @param string $path + * @param string $compiledPath + * @param boolean $extendsMode + * @return string|array + */ + public function compileFile($path, $compiledPath, $extendsMode = false) {} + + /** + * Compiles a template into a file applying the compiler options + * This method does not return the compiled path if the template was not compiled + * + * $compiler->compile('views/layouts/main.volt'); + * require $compiler->getCompiledTemplatePath(); + * + * + * @param string $templatePath + * @param bool $extendsMode + */ + public function compile($templatePath, $extendsMode = false) {} + + /** + * Returns the path that is currently being compiled + * + * @return string + */ + public function getTemplatePath() {} + + /** + * Returns the path to the last compiled template + * + * @return string + */ + public function getCompiledTemplatePath() {} + + /** + * Parses a Volt template returning its intermediate representation + * + * print_r($compiler->parse('{{ 3 + 2 }}')); + * + * + * @param string $viewCode + * @return array + */ + public function parse($viewCode) {} + +} diff --git a/ide/2.0.8/Phalcon/mvc/view/engine/volt/Exception.php b/ide/2.0.8/Phalcon/mvc/view/engine/volt/Exception.php new file mode 100644 index 000000000..502581d74 --- /dev/null +++ b/ide/2.0.8/Phalcon/mvc/view/engine/volt/Exception.php @@ -0,0 +1,12 @@ + + * $paginator = new \Phalcon\Paginator\Adapter\Model( + * array( + * "data" => Robots::find(), + * "limit" => 25, + * "page" => $currentPage + * ) + * ); + * $paginate = $paginator->getPaginate(); + * + */ +class Model extends \Phalcon\Paginator\Adapter implements \Phalcon\Paginator\AdapterInterface +{ + /** + * Configuration of paginator by model + */ + protected $_config = null; + + + /** + * Phalcon\Paginator\Adapter\Model constructor + * + * @param array $config + */ + public function __construct($config) {} + + /** + * Returns a slice of the resultset to show in the pagination + * + * @return \stdclass + */ + public function getPaginate() {} + +} diff --git a/ide/2.0.8/Phalcon/paginator/adapter/NativeArray.php b/ide/2.0.8/Phalcon/paginator/adapter/NativeArray.php new file mode 100644 index 000000000..f080c16c1 --- /dev/null +++ b/ide/2.0.8/Phalcon/paginator/adapter/NativeArray.php @@ -0,0 +1,46 @@ + + * $paginator = new \Phalcon\Paginator\Adapter\NativeArray( + * array( + * "data" => array( + * array('id' => 1, 'name' => 'Artichoke'), + * array('id' => 2, 'name' => 'Carrots'), + * array('id' => 3, 'name' => 'Beet'), + * array('id' => 4, 'name' => 'Lettuce'), + * array('id' => 5, 'name' => '') + * ), + * "limit" => 2, + * "page" => $currentPage + * ) + * ); + * + */ +class NativeArray extends \Phalcon\Paginator\Adapter implements \Phalcon\Paginator\AdapterInterface +{ + /** + * Configuration of the paginator + */ + protected $_config = null; + + + /** + * Phalcon\Paginator\Adapter\NativeArray constructor + * + * @param array $config + */ + public function __construct($config) {} + + /** + * Returns a slice of the resultset to show in the pagination + * + * @return \stdClass + */ + public function getPaginate() {} + +} diff --git a/ide/2.0.8/Phalcon/paginator/adapter/QueryBuilder.php b/ide/2.0.8/Phalcon/paginator/adapter/QueryBuilder.php new file mode 100644 index 000000000..3a6af396f --- /dev/null +++ b/ide/2.0.8/Phalcon/paginator/adapter/QueryBuilder.php @@ -0,0 +1,69 @@ + + * $builder = $this->modelsManager->createBuilder() + * ->columns('id, name') + * ->from('Robots') + * ->orderBy('name'); + * $paginator = new Phalcon\Paginator\Adapter\QueryBuilder(array( + * "builder" => $builder, + * "limit"=> 20, + * "page" => 1 + * )); + * + */ +class QueryBuilder extends \Phalcon\Paginator\Adapter implements \Phalcon\Paginator\AdapterInterface +{ + /** + * Configuration of paginator by model + */ + protected $_config; + + /** + * Paginator's data + */ + protected $_builder; + + + /** + * Phalcon\Paginator\Adapter\QueryBuilder + * + * @param array $config + */ + public function __construct($config) {} + + /** + * Get the current page number + * + * @return int + */ + public function getCurrentPage() {} + + /** + * Set query builder object + * + * @param mixed $builder + * @return QueryBuilder + */ + public function setQueryBuilder(\Phalcon\Mvc\Model\Query\Builder $builder) {} + + /** + * Get query builder object + * + * @return \Phalcon\Mvc\Model\Query\Builder + */ + public function getQueryBuilder() {} + + /** + * Returns a slice of the resultset to show in the pagination + * + * @return \stdClass + */ + public function getPaginate() {} + +} diff --git a/ide/2.0.8/Phalcon/queue/Beanstalk.php b/ide/2.0.8/Phalcon/queue/Beanstalk.php new file mode 100644 index 000000000..a447fbca2 --- /dev/null +++ b/ide/2.0.8/Phalcon/queue/Beanstalk.php @@ -0,0 +1,142 @@ + + * $random = new \Phalcon\Security\Random(); + * // Random binary string + * $bytes = $random->bytes(); + * // Random hex string + * echo $random->hex(10); // a29f470508d5ccb8e289 + * echo $random->hex(10); // 533c2f08d5eee750e64a + * echo $random->hex(11); // f362ef96cb9ffef150c9cd + * echo $random->hex(12); // 95469d667475125208be45c4 + * echo $random->hex(13); // 05475e8af4a34f8f743ab48761 + * // Random base64 string + * echo $random->base64(12); // XfIN81jGGuKkcE1E + * echo $random->base64(12); // 3rcq39QzGK9fUqh8 + * echo $random->base64(); // DRcfbngL/iOo9hGGvy1TcQ== + * echo $random->base64(16); // SvdhPcIHDZFad838Bb0Swg== + * // Random URL-safe base64 string + * echo $random->base64Safe(); // PcV6jGbJ6vfVw7hfKIFDGA + * echo $random->base64Safe(); // GD8JojhzSTrqX7Q8J6uug + * echo $random->base64Safe(8); // mGyy0evy3ok + * echo $random->base64Safe(null, true); // DRrAgOFkS4rvRiVHFefcQ== + * // Random UUID + * echo $random->uuid(); // db082997-2572-4e2c-a046-5eefe97b1235 + * echo $random->uuid(); // da2aa0e2-b4d0-4e3c-99f5-f5ef62c57fe2 + * echo $random->uuid(); // 75e6b628-c562-4117-bb76-61c4153455a9 + * echo $random->uuid(); // dc446df1-0848-4d05-b501-4af3c220c13d + * // Random number between 0 and $len + * echo $random->number(256); // 84 + * echo $random->number(256); // 79 + * echo $random->number(100); // 29 + * echo $random->number(300); // 40 + * // Random base58 string + * echo $random->base58(); // 4kUgL2pdQMSCQtjE + * echo $random->base58(); // Umjxqf7ZPwh765yR + * echo $random->base58(24); // qoXcgmw4A9dys26HaNEdCRj9 + * echo $random->base58(7); // 774SJD3vgP + * + * This class partially borrows SecureRandom library from Ruby + * + * @link http://ruby-doc.org/stdlib-2.2.2/libdoc/securerandom/rdoc/SecureRandom.html + */ +class Random +{ + + /** + * Generates a random binary string + * If $len is not specified, 16 is assumed. It may be larger in future. + * The result may contain any byte: "x00" - "xFF". + * + * $random = new \Phalcon\Security\Random(); + * $bytes = $random->bytes(); + * + * + * @throws Exception If secure random number generator is not available or unexpected partial read + * @param int $len + * @return string + */ + public function bytes($len = 16) {} + + /** + * Generates a random hex string + * If $len is not specified, 16 is assumed. It may be larger in future. + * The length of the result string is usually greater of $len. + * + * $random = new \Phalcon\Security\Random(); + * echo $random->hex(10); // a29f470508d5ccb8e289 + * + * + * @throws Exception If secure random number generator is not available or unexpected partial read + * @param int $len + * @return string + */ + public function hex($len = null) {} + + /** + * Generates a random base58 string + * If $len is not specified, 16 is assumed. It may be larger in future. + * The result may contain alphanumeric characters except 0, O, I and l. + * It is similar to Base64 but has been modified to avoid both non-alphanumeric + * characters and letters which might look ambiguous when printed. + * + * $random = new \Phalcon\Security\Random(); + * echo $random->base58(); // 4kUgL2pdQMSCQtjE + * + * + * @link https://en.wikipedia.org/wiki/Base58 + * @throws Exception If secure random number generator is not available or unexpected partial read + * @param mixed $n + * @return string + */ + public function base58($n = null) {} + + /** + * Generates a random base64 string + * If $len is not specified, 16 is assumed. It may be larger in future. + * The length of the result string is usually greater of $len. + * Size formula: 4 *( $len / 3) and this need to be rounded up to a multiple of 4. + * + * $random = new \Phalcon\Security\Random(); + * echo $random->base64(12); // 3rcq39QzGK9fUqh8 + * + * + * @throws Exception If secure random number generator is not available or unexpected partial read + * @param int $len + * @return string + */ + public function base64($len = null) {} + + /** + * Generates a random URL-safe base64 string + * If $len is not specified, 16 is assumed. It may be larger in future. + * The length of the result string is usually greater of $len. + * By default, padding is not generated because "=" may be used as a URL delimiter. + * The result may contain A-Z, a-z, 0-9, "-" and "_". "=" is also used if $padding is true. + * See RFC 3548 for the definition of URL-safe base64. + * + * $random = new \Phalcon\Security\Random(); + * echo $random->base64Safe(); // GD8JojhzSTrqX7Q8J6uug + * + * + * @link https://www.ietf.org/rfc/rfc3548.txt + * @throws Exception If secure random number generator is not available or unexpected partial read + * @param int $len + * @param bool $padding + * @return string + */ + public function base64Safe($len = null, $padding = false) {} + + /** + * Generates a v4 random UUID (Universally Unique IDentifier) + * The version 4 UUID is purely random (except the version). It doesn't contain meaningful + * information such as MAC address, time, etc. See RFC 4122 for details of UUID. + * This algorithm sets the version number (4 bits) as well as two reserved bits. + * All other bits (the remaining 122 bits) are set using a random or pseudorandom data source. + * Version 4 UUIDs have the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx where x is any hexadecimal + * digit and y is one of 8, 9, A, or B (e.g., f47ac10b-58cc-4372-a567-0e02b2c3d479). + * + * $random = new \Phalcon\Security\Random(); + * echo $random->uuid(); // 1378c906-64bb-4f81-a8d6-4ae1bfcdec22 + * + * + * @link https://www.ietf.org/rfc/rfc4122.txt + * @throws Exception If secure random number generator is not available or unexpected partial read + * @return string + */ + public function uuid() {} + + /** + * Generates a random number between 0 and $len + * Returns an integer: 0 <= result <= $len. + * + * $random = new \Phalcon\Security\Random(); + * echo $random->number(16); // 8 + * + * + * @throws Exception If secure random number generator is not available, unexpected partial read or $len <= 0 + * @param int $len + * @return int + */ + public function number($len) {} + +} diff --git a/ide/2.0.8/Phalcon/session/Adapter.php b/ide/2.0.8/Phalcon/session/Adapter.php new file mode 100644 index 000000000..b8a1c6fca --- /dev/null +++ b/ide/2.0.8/Phalcon/session/Adapter.php @@ -0,0 +1,219 @@ + + * $session->setOptions(array( + * 'uniqueId' => 'my-private-app' + * )); + * + * + * @param array $options + */ + public function setOptions($options) {} + + /** + * Get internal options + * + * @return array + */ + public function getOptions() {} + + /** + * Set session name + * + * @param string $name + */ + public function setName($name) {} + + /** + * Get session name + * + * @return string + */ + public function getName() {} + + /** + * {@inheritdoc} + * + * @param bool $deleteOldSession + * @return Adapter + */ + public function regenerateId($deleteOldSession = true) {} + + /** + * Gets a session variable from an application context + * + * $session->get('auth', 'yes'); + * + * + * @param string $index + * @param mixed $defaultValue + * @param bool $remove + * @return mixed + */ + public function get($index, $defaultValue = null, $remove = false) {} + + /** + * Sets a session variable in an application context + * + * $session->set('auth', 'yes'); + * + * + * @param string $index + * @param mixed $value + */ + public function set($index, $value) {} + + /** + * Check whether a session variable is set in an application context + * + * var_dump($session->has('auth')); + * + * + * @param string $index + * @return bool + */ + public function has($index) {} + + /** + * Removes a session variable from an application context + * + * $session->remove('auth'); + * + * + * @param string $index + */ + public function remove($index) {} + + /** + * Returns active session id + * + * echo $session->getId(); + * + * + * @return string + */ + public function getId() {} + + /** + * Set the current session id + * + * $session->setId($id); + * + * + * @param string $id + */ + public function setId($id) {} + + /** + * Check whether the session has been started + * + * var_dump($session->isStarted()); + * + * + * @return bool + */ + public function isStarted() {} + + /** + * Destroys the active session + * + * var_dump($session->destroy()); + * var_dump($session->destroy(true)); + * + * + * @param bool $removeData + * @return bool + */ + public function destroy($removeData = false) {} + + /** + * Returns the status of the current session. For PHP 5.3 this function will always return SESSION_NONE + * + * var_dump($session->status()); + * // PHP 5.4 and above will give meaningful messages, 5.3 gets SESSION_NONE always + * if ($session->status() !== $session::SESSION_ACTIVE) { + * $session->start(); + * } + * + * + * @return int + */ + public function status() {} + + /** + * Alias: Gets a session variable from an application context + * + * @param string $index + */ + public function __get($index) {} + + /** + * Alias: Sets a session variable in an application context + * + * @param string $index + * @param mixed $value + */ + public function __set($index, $value) {} + + /** + * Alias: Check whether a session variable is set in an application context + * + * @param string $index + * @return bool + */ + public function __isset($index) {} + + /** + * Alias: Removes a session variable from an application context + * + * @param string $index + */ + public function __unset($index) {} + + + public function __destruct() {} + +} diff --git a/ide/2.0.8/Phalcon/session/AdapterInterface.php b/ide/2.0.8/Phalcon/session/AdapterInterface.php new file mode 100644 index 000000000..1e689db7c --- /dev/null +++ b/ide/2.0.8/Phalcon/session/AdapterInterface.php @@ -0,0 +1,106 @@ + + * $user = new \Phalcon\Session\Bag('user'); + * $user->name = "Kimbra Johnson"; + * $user->age = 22; + * + */ +class Bag implements \Phalcon\Di\InjectionAwareInterface, \Phalcon\Session\BagInterface, \IteratorAggregate, \ArrayAccess, \Countable +{ + + protected $_dependencyInjector; + + + protected $_name = null; + + + protected $_data; + + + protected $_initialized = false; + + + protected $_session; + + + /** + * Phalcon\Session\Bag constructor + * + * @param string $name + */ + public function __construct($name) {} + + /** + * Sets the DependencyInjector container + * + * @param mixed $dependencyInjector + */ + public function setDI(\Phalcon\DiInterface $dependencyInjector) {} + + /** + * Returns the DependencyInjector container + * + * @return \Phalcon\DiInterface + */ + public function getDI() {} + + /** + * Initializes the session bag. This method must not be called directly, the class calls it when its internal data is accesed + */ + public function initialize() {} + + /** + * Destroyes the session bag + * + * $user->destroy(); + * + */ + public function destroy() {} + + /** + * Sets a value in the session bag + * + * $user->set('name', 'Kimbra'); + * + * + * @param string $property + * @param mixed $value + */ + public function set($property, $value) {} + + /** + * Magic setter to assign values to the session bag + * + * $user->name = "Kimbra"; + * + * + * @param string $property + * @param mixed $value + */ + public function __set($property, $value) {} + + /** + * Obtains a value from the session bag optionally setting a default value + * + * echo $user->get('name', 'Kimbra'); + * + * + * @param string $property + * @param mixed $defaultValue + */ + public function get($property, $defaultValue = null) {} + + /** + * Magic getter to obtain values from the session bag + * + * echo $user->name; + * + * + * @param string $property + */ + public function __get($property) {} + + /** + * Check whether a property is defined in the internal bag + * + * var_dump($user->has('name')); + * + * + * @param string $property + * @return bool + */ + public function has($property) {} + + /** + * Magic isset to check whether a property is defined in the bag + * + * var_dump(isset($user['name'])); + * + * + * @param string $property + * @return bool + */ + public function __isset($property) {} + + /** + * Removes a property from the internal bag + * + * $user->remove('name'); + * + * + * @param string $property + * @return bool + */ + public function remove($property) {} + + /** + * Magic unset to remove items using the array syntax + * + * unset($user['name']); + * + * + * @param string $property + * @return bool + */ + public function __unset($property) {} + + /** + * Return length of bag + * + * echo $user->count(); + * + * + * @return int + */ + public final function count() {} + + /** + *  Returns the bag iterator + * + * @return \ArrayIterator + */ + public final function getIterator() {} + + /** + * @param string $property + * @param mixed $value + */ + public final function offsetSet($property, $value) {} + + /** + * @param string $property + */ + public final function offsetExists($property) {} + + /** + * @param string $property + */ + public final function offsetUnset($property) {} + + /** + * @param string $property + */ + public final function offsetGet($property) {} + +} diff --git a/ide/2.0.8/Phalcon/session/BagInterface.php b/ide/2.0.8/Phalcon/session/BagInterface.php new file mode 100644 index 000000000..c36cc1973 --- /dev/null +++ b/ide/2.0.8/Phalcon/session/BagInterface.php @@ -0,0 +1,71 @@ + + * $session = new \Phalcon\Session\Adapter\Files(array( + * 'uniqueId' => 'my-private-app' + * )); + * $session->start(); + * $session->set('var', 'some-value'); + * echo $session->get('var'); + * + */ +class Files extends \Phalcon\Session\Adapter implements \Phalcon\Session\AdapterInterface +{ + +} diff --git a/ide/2.0.8/Phalcon/session/adapter/Libmemcached.php b/ide/2.0.8/Phalcon/session/adapter/Libmemcached.php new file mode 100644 index 000000000..54ec0e0ad --- /dev/null +++ b/ide/2.0.8/Phalcon/session/adapter/Libmemcached.php @@ -0,0 +1,88 @@ + + * $session = new Phalcon\Session\Adapter\Libmemcached(array( + * 'servers' => array( + * array('host' => 'localhost', 'port' => 11211, 'weight' => 1), + * ), + * 'client' => array( + * Memcached::OPT_HASH => Memcached::HASH_MD5, + * Memcached::OPT_PREFIX_KEY => 'prefix.', + * ), + * 'lifetime' => 3600, + * 'prefix' => 'my_' + * )); + * $session->start(); + * $session->set('var', 'some-value'); + * echo $session->get('var'); + * + */ +class Libmemcached extends \Phalcon\Session\Adapter implements \Phalcon\Session\AdapterInterface +{ + + protected $_libmemcached = null; + + + protected $_lifetime = 8600; + + + + public function getLibmemcached() {} + + + public function getLifetime() {} + + /** + * Phalcon\Session\Adapter\Libmemcached constructor + * + * @param array $options + */ + public function __construct($options) {} + + /** + * @return bool + */ + public function open() {} + + /** + * @return bool + */ + public function close() {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return mixed + */ + public function read($sessionId) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @param string $data + */ + public function write($sessionId, $data) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return boolean + */ + public function destroy($sessionId = null) {} + + /** + * {@inheritdoc} + * + * @return bool + */ + public function gc() {} + +} diff --git a/ide/2.0.8/Phalcon/session/adapter/Memcache.php b/ide/2.0.8/Phalcon/session/adapter/Memcache.php new file mode 100644 index 000000000..f2436868b --- /dev/null +++ b/ide/2.0.8/Phalcon/session/adapter/Memcache.php @@ -0,0 +1,79 @@ + + * $session = new \Phalcon\Session\Adapter\Memcache(array( + * 'uniqueId' => 'my-private-app', + * 'host' => '127.0.0.1', + * 'port' => 11211, + * 'persistent' => true, + * 'lifetime' => 3600, + * 'prefix' => 'my_' + * )); + * $session->start(); + * $session->set('var', 'some-value'); + * echo $session->get('var'); + * + */ +class Memcache extends \Phalcon\Session\Adapter implements \Phalcon\Session\AdapterInterface +{ + + protected $_memcache = null; + + + protected $_lifetime = 8600; + + + + public function getMemcache() {} + + + public function getLifetime() {} + + /** + * Phalcon\Session\Adapter\Memcache constructor + * + * @param array $options + */ + public function __construct($options = array()) {} + + + public function open() {} + + + public function close() {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return mixed + */ + public function read($sessionId) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @param string $data + */ + public function write($sessionId, $data) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return boolean + */ + public function destroy($sessionId = null) {} + + /** + * {@inheritdoc} + */ + public function gc() {} + +} diff --git a/ide/2.0.8/Phalcon/session/adapter/Redis.php b/ide/2.0.8/Phalcon/session/adapter/Redis.php new file mode 100644 index 000000000..fe6547bbf --- /dev/null +++ b/ide/2.0.8/Phalcon/session/adapter/Redis.php @@ -0,0 +1,80 @@ + + * $session = new \Phalcon\Session\Adapter\Redis(array( + * 'uniqueId' => 'my-private-app', + * 'host' => 'localhost', + * 'port' => 6379, + * 'auth' => 'foobared', + * 'persistent' => false, + * 'lifetime' => 3600, + * 'prefix' => 'my_' + * )); + * $session->start(); + * $session->set('var', 'some-value'); + * echo $session->get('var'); + * + */ +class Redis extends \Phalcon\Session\Adapter implements \Phalcon\Session\AdapterInterface +{ + + protected $_redis = null; + + + protected $_lifetime = 8600; + + + + public function getRedis() {} + + + public function getLifetime() {} + + /** + * Phalcon\Session\Adapter\Redis constructor + * + * @param array $options + */ + public function __construct($options = array()) {} + + + public function open() {} + + + public function close() {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return mixed + */ + public function read($sessionId) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @param string $data + */ + public function write($sessionId, $data) {} + + /** + * {@inheritdoc} + * + * @param string $sessionId + * @return boolean + */ + public function destroy($sessionId = null) {} + + /** + * {@inheritdoc} + */ + public function gc() {} + +} diff --git a/ide/2.0.8/Phalcon/tag/Exception.php b/ide/2.0.8/Phalcon/tag/Exception.php new file mode 100644 index 000000000..8d2604755 --- /dev/null +++ b/ide/2.0.8/Phalcon/tag/Exception.php @@ -0,0 +1,12 @@ + + * print_r($messages[0]); + * + * + * @param int $index + * @return \Phalcon\Validation\Message + */ + public function offsetGet($index) {} + + /** + * Sets an attribute using the array-syntax + * + * $messages[0] = new \Phalcon\Validation\Message('This is a message'); + * + * + * @param int $index + * @param \Phalcon\Validation\Message $message + */ + public function offsetSet($index, $message) {} + + /** + * Checks if an index exists + * + * var_dump(isset($message['database'])); + * + * + * @param int $index + * @return boolean + */ + public function offsetExists($index) {} + + /** + * Removes a message from the list + * + * unset($message['database']); + * + * + * @param string $index + */ + public function offsetUnset($index) {} + + /** + * Appends a message to the group + * + * $messages->appendMessage(new \Phalcon\Validation\Message('This is a message')); + * + * + * @param mixed $message + */ + public function appendMessage(\Phalcon\Validation\MessageInterface $message) {} + + /** + * Appends an array of messages to the group + * + * $messages->appendMessages($messagesArray); + * + * + * @param \Phalcon\Validation\MessageInterface[] $messages + */ + public function appendMessages($messages) {} + + /** + * Filters the message group by field name + * + * @param string $fieldName + * @return array + */ + public function filter($fieldName) {} + + /** + * Returns the number of messages in the list + * + * @return int + */ + public function count() {} + + /** + * Rewinds the internal iterator + */ + public function rewind() {} + + /** + * Returns the current message in the iterator + * + * @return \Phalcon\Validation\Message + */ + public function current() {} + + /** + * Returns the current position/key in the iterator + * + * @return int + */ + public function key() {} + + /** + * Moves the internal iteration pointer to the next position + */ + public function next() {} + + /** + * Check if the current message in the iterator is valid + * + * @return bool + */ + public function valid() {} + + /** + * Magic __set_state helps to re-build messages variable when exporting + * + * @param array $group + * @return \Phalcon\Validation\Message\Group + */ + public static function __set_state($group) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Alnum.php b/ide/2.0.8/Phalcon/validation/validator/Alnum.php new file mode 100644 index 000000000..96250226c --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Alnum.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Alnum as AlnumValidator; + * $validator->add('username', new AlnumValidator(array( + * 'message' => ':field must contain only alphanumeric characters' + * ))); + * + */ +class Alnum extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Alpha.php b/ide/2.0.8/Phalcon/validation/validator/Alpha.php new file mode 100644 index 000000000..3860505fd --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Alpha.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Alpha as AlphaValidator; + * $validator->add('username', new AlphaValidator(array( + * 'message' => ':field must contain only letters' + * ))); + * + */ +class Alpha extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Between.php b/ide/2.0.8/Phalcon/validation/validator/Between.php new file mode 100644 index 000000000..9a765abd7 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Between.php @@ -0,0 +1,30 @@ + + * use Phalcon\Validation\Validator\Between; + * validator->add('name', new Between(array( + * 'minimum' => 0, + * 'maximum' => 100, + * 'message' => 'The price must be between 0 and 100' + * ))); + * + */ +class Between extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Confirmation.php b/ide/2.0.8/Phalcon/validation/validator/Confirmation.php new file mode 100644 index 000000000..75e1ac710 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Confirmation.php @@ -0,0 +1,37 @@ + + * use Phalcon\Validation\Validator\Confirmation; + * $validator->add('password', new Confirmation(array( + * 'message' => 'Password doesn\'t match confirmation', + * 'with' => 'confirmPassword' + * ))); + * + */ +class Confirmation extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + + /** + * Compare strings + * + * @param string $a + * @param string $b + * @return bool + */ + protected final function compare($a, $b) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/CreditCard.php b/ide/2.0.8/Phalcon/validation/validator/CreditCard.php new file mode 100644 index 000000000..417ec40b2 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/CreditCard.php @@ -0,0 +1,35 @@ + + * use Phalcon\Validation\Validator\CreditCard as CreditCardValidator; + * $validator->add('creditcard', new CreditCardValidator(array( + * 'message' => 'The credit card number is not valid' + * ))); + * + */ +class CreditCard extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + + /** + * is a simple checksum formula used to validate a variety of identification numbers + * + * @param string $number + * @return boolean + */ + private function verifyByLuhnAlgorithm($number) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Digit.php b/ide/2.0.8/Phalcon/validation/validator/Digit.php new file mode 100644 index 000000000..dae4e4dbe --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Digit.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Digit as DigitValidator; + * $validator->add('height', new DigitValidator(array( + * 'message' => ':field must be numeric' + * ))); + * + */ +class Digit extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Email.php b/ide/2.0.8/Phalcon/validation/validator/Email.php new file mode 100644 index 000000000..8951305fc --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Email.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Email as EmailValidator; + * $validator->add('email', new EmailValidator(array( + * 'message' => 'The e-mail is not valid' + * ))); + * + */ +class Email extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/ExclusionIn.php b/ide/2.0.8/Phalcon/validation/validator/ExclusionIn.php new file mode 100644 index 000000000..d6bd01efa --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/ExclusionIn.php @@ -0,0 +1,28 @@ + + * use Phalcon\Validation\Validator\ExclusionIn; + * $validator->add('status', new ExclusionIn(array( + * 'message' => 'The status must not be A or B', + * 'domain' => array('A', 'B') + * ))); + * + */ +class ExclusionIn extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/File.php b/ide/2.0.8/Phalcon/validation/validator/File.php new file mode 100644 index 000000000..96121dc85 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/File.php @@ -0,0 +1,32 @@ + + * use Phalcon\Validation\Validator\File as FileValidator; + * $validator->add('file', new FileValidator(array( + * 'maxSize' => '2M', + * 'messageSize' => ':field exceeds the max filesize (:max)', + * 'allowedTypes' => array('image/jpeg', 'image/png'), + * 'messageType' => 'Allowed file types are :types', + * 'maxResolution' => '800x600', + * 'messageMaxResolution' => 'Max resolution of :field is :max' + * ))); + * + */ +class File extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Identical.php b/ide/2.0.8/Phalcon/validation/validator/Identical.php new file mode 100644 index 000000000..d5ee453cc --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Identical.php @@ -0,0 +1,28 @@ + + * use Phalcon\Validation\Validator\Identical; + * $validator->add('terms', new Identical(array( + * 'accepted' => 'yes', + * 'message' => 'Terms and conditions must be accepted' + * ))); + * + */ +class Identical extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/InclusionIn.php b/ide/2.0.8/Phalcon/validation/validator/InclusionIn.php new file mode 100644 index 000000000..4bee62023 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/InclusionIn.php @@ -0,0 +1,28 @@ + + * use Phalcon\Validation\Validator\InclusionIn; + * $validator->add('status', new InclusionIn(array( + * 'message' => 'The status must be A or B', + * 'domain' => array('A', 'B') + * ))); + * + */ +class InclusionIn extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Numericality.php b/ide/2.0.8/Phalcon/validation/validator/Numericality.php new file mode 100644 index 000000000..5b68ec926 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Numericality.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Numericality; + * $validator->add('price', new Numericality(array( + * 'message' => ':field is not numeric' + * ))); + * + */ +class Numericality extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/PresenceOf.php b/ide/2.0.8/Phalcon/validation/validator/PresenceOf.php new file mode 100644 index 000000000..30ba729ed --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/PresenceOf.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\PresenceOf; + * $validator->add('name', new PresenceOf(array( + * 'message' => 'The name is required' + * ))); + * + */ +class PresenceOf extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Regex.php b/ide/2.0.8/Phalcon/validation/validator/Regex.php new file mode 100644 index 000000000..8b73552b6 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Regex.php @@ -0,0 +1,28 @@ + + * use Phalcon\Validation\Validator\Regex as RegexValidator; + * $validator->add('created_at', new RegexValidator(array( + * 'pattern' => '/^[0-9]{4}[-\/](0[1-9]|1[12])[-\/](0[1-9]|[12][0-9]|3[01])$/', + * 'message' => 'The creation date is invalid' + * ))); + * + */ +class Regex extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/StringLength.php b/ide/2.0.8/Phalcon/validation/validator/StringLength.php new file mode 100644 index 000000000..2bafa9675 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/StringLength.php @@ -0,0 +1,32 @@ + + * use Phalcon\Validation\Validator\StringLength as StringLength; + * $validation->add('name_last', new StringLength(array( + * 'max' => 50, + * 'min' => 2, + * 'messageMaximum' => 'We don\'t like really long names', + * 'messageMinimum' => 'We want more than just their initials' + * ))); + * + */ +class StringLength extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Uniqueness.php b/ide/2.0.8/Phalcon/validation/validator/Uniqueness.php new file mode 100644 index 000000000..79ef4083c --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Uniqueness.php @@ -0,0 +1,35 @@ + + * use Phalcon\Validation\Validator\Uniqueness as UniquenessValidator; + * $validator->add('username', new UniquenessValidator(array( + * 'model' => 'Users', + * 'message' => ':field must be unique' + * ))); + * + * Different attribute from the field + * + * $validator->add('username', new UniquenessValidator(array( + * 'model' => 'Users', + * 'attribute' => 'nick' + * ))); + * + */ +class Uniqueness extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +} diff --git a/ide/2.0.8/Phalcon/validation/validator/Url.php b/ide/2.0.8/Phalcon/validation/validator/Url.php new file mode 100644 index 000000000..76ab65b91 --- /dev/null +++ b/ide/2.0.8/Phalcon/validation/validator/Url.php @@ -0,0 +1,27 @@ + + * use Phalcon\Validation\Validator\Url as UrlValidator; + * $validator->add('url', new UrlValidator(array( + * 'message' => ':field must be a url' + * ))); + * + */ +class Url extends \Phalcon\Validation\Validator +{ + + /** + * Executes the validation + * + * @param mixed $validation + * @param string $field + * @return bool + */ + public function validate(\Phalcon\Validation $validation, $field) {} + +}