Permalink
Browse files

coding standard

  • Loading branch information...
1 parent 8ebbd1e commit f6ccb25211441d1f9c49b193668cd07ee247833d @kolinger committed Dec 21, 2012
Showing with 205 additions and 49 deletions.
  1. +13 −1 Config/Configurator.php
  2. +26 −6 Console/Extension.php
  3. +28 −8 Console/Router.php
  4. +43 −15 Doctrine/Cache.php
  5. +27 −7 Doctrine/Extension.php
  6. +8 −0 Doctrine/Logger.php
  7. +20 −4 Model/Entity.php
  8. +40 −8 Model/Facade.php
View
@@ -1,12 +1,23 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Config;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*/
class Configurator extends \Nette\Config\Configurator
{
+
/**
* @return \Nette\Config\Compiler
*/
@@ -19,4 +30,5 @@ protected function createCompiler()
return $compiler;
}
+
}
View
@@ -1,19 +1,34 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Console;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*/
class Extension extends \Nette\Config\CompilerExtension
{
- /** @var array */
+
+ /**
+ * @var array
+ */
private $defaults = array(
'name' => 'Square Command Line Interface',
'version' => '1.0',
'catchExceptions' => TRUE,
);
+
+
public function loadConfiguration()
{
$container = $this->getContainerBuilder();
@@ -35,8 +50,10 @@ public function loadConfiguration()
->addSetup('offsetSet', array(NULL, $this->prefix('@router')));
}
+
+
/**
- * @param \Nette\DI\Container
+ * @param \Nette\DI\Container $container
* @return \Symfony\Component\Console\Helper\HelperSet
*/
public static function createHelperSet(\Nette\DI\Container $container)
@@ -51,10 +68,12 @@ public static function createHelperSet(\Nette\DI\Container $container)
return $helperSet;
}
+
+
/**
- * @param array
- * @param \Nette\DI\Container
- * @param \Symfony\Component\Console\Helper\HelperSet
+ * @param array $config
+ * @param \Nette\DI\Container $container
+ * @param \Symfony\Component\Console\Helper\HelperSet $helperSet
* @return \Symfony\Component\Console\Application
*/
public static function createApplication(array $config, \Nette\DI\Container $container, \Symfony\Component\Console\Helper\HelperSet $helperSet)
@@ -70,4 +89,5 @@ public static function createApplication(array $config, \Nette\DI\Container $con
return $application;
}
+
}
View
@@ -1,26 +1,43 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Console;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*/
class Router extends \Nette\Object implements \Nette\Application\IRouter
{
- /** @var \Symfony\Component\Console\Application */
+
+ /**
+ * @var \Symfony\Component\Console\Application
+ */
private $console;
+
+
/**
- * @param \Symfony\Component\Console\Application
+ * @param \Symfony\Component\Console\Application $console
*/
public function __construct(\Symfony\Component\Console\Application $console)
{
$this->console = $console;
}
+
+
/**
- * @param \Nette\Http\IRequest
- * @return \Nette\Http\IRequest|NULL
+ * @param \Nette\Http\IRequest $httpRequest
+ * @return \Nette\Application\Request|NULL
*/
public function match(\Nette\Http\IRequest $httpRequest)
{
@@ -30,13 +47,16 @@ public function match(\Nette\Http\IRequest $httpRequest)
return NULL;
}
+
+
/**
- * @param \Nette\Application\Request
- * @param \Nette\Http\Url
- * @return string|NULL
+ * @param \Nette\Application\Request $appRequest
+ * @param \Nette\Http\Url $refUrl
+ * @return NULL|string
*/
public function constructUrl(\Nette\Application\Request $appRequest, \Nette\Http\Url $refUrl)
{
return NULL;
}
+
}
View
@@ -1,26 +1,43 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Doctrine;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*/
class Cache extends \Doctrine\Common\Cache\CacheProvider
{
- /** @var \Nette\Caching\IStorage */
+
+ /**
+ * @var \Nette\Caching\IStorage
+ */
private $storage;
+
+
/**
- * @param \Nette\Caching\IStorage
+ * @param \Nette\Caching\IStorage $storage
*/
public function __construct(\Nette\Caching\IStorage $storage)
{
$this->storage = new \Nette\Caching\Cache($storage, 'Square.Doctrine');
}
+
+
/**
- * @param string
- * @return FALSE|string
+ * @param string $id
+ * @return string|FALSE
*/
protected function doFetch($id)
{
@@ -31,9 +48,11 @@ protected function doFetch($id)
return FALSE;
}
+
+
/**
- * @param string
- * @return boolean
+ * @param string $id
+ * @return bool
*/
protected function doContains($id)
{
@@ -43,11 +62,13 @@ protected function doContains($id)
return FALSE;
}
+
+
/**
- * @param string
- * @param string
- * @param boolean
- * @return boolean
+ * @param string $id
+ * @param string $data
+ * @param bool $lifeTime
+ * @return bool
*/
protected function doSave($id, $data, $lifeTime = FALSE)
{
@@ -63,18 +84,22 @@ protected function doSave($id, $data, $lifeTime = FALSE)
return TRUE;
}
+
+
/**
- * @param string
- * @return boolean
+ * @param string $id
+ * @return bool
*/
protected function doDelete($id)
{
$this->storage->save($id, NULL);
return TRUE;
}
+
+
/**
- * @return boolean
+ * @return bool
*/
protected function doFlush()
{
@@ -84,11 +109,14 @@ protected function doFlush()
return TRUE;
}
+
+
/**
- * @return NULL|array
+ * @return array|null
*/
protected function doGetStats()
{
return NULL;
}
+
}
View
@@ -1,13 +1,26 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Doctrine;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*/
class Extension extends \Nette\Config\CompilerExtension
{
- /** @var array */
+
+ /**
+ * @var array
+ */
private $defaults = array(
'entitiesDirs' => array('%appDir%'),
'proxyDir' => '%appDir%/proxies',
@@ -24,6 +37,8 @@ class Extension extends \Nette\Config\CompilerExtension
),
);
+
+
public function loadConfiguration()
{
$container = $this->getContainerBuilder();
@@ -79,10 +94,12 @@ public function loadConfiguration()
->addTag('consoleCommand');
}
+
+
/**
- * @param array
- * @param Logger
- * @param \Doctrine\ORM\Configuration
+ * @param array $config
+ * @param Logger $logger
+ * @param \Doctrine\ORM\Configuration $configuration
* @return \Doctrine\DBAL\Connection
*/
public static function createConnection(array $config, Logger $logger, \Doctrine\ORM\Configuration $configuration)
@@ -107,9 +124,11 @@ public static function createConnection(array $config, Logger $logger, \Doctrine
return $connection;
}
+
+
/**
- * @param array
- * @param \Nette\Caching\Cache
+ * @param array $entitiesDirs
+ * @param Cache $cache
* @return \Doctrine\ORM\Mapping\Driver\AnnotationDriver
*/
public static function createAnnotationDriver(array $entitiesDirs, Cache $cache)
@@ -122,4 +141,5 @@ public static function createAnnotationDriver(array $entitiesDirs, Cache $cache)
return new \Doctrine\ORM\Mapping\Driver\AnnotationDriver($cachedReader, $entitiesDirs);
}
+
}
View
@@ -1,5 +1,13 @@
<?php
+/**
+ * This file is part of the Square CMS
+ *
+ * Copyright (c) 2011, 2012 Tomáš Kolinger <tomas@kolinger.name>
+ *
+ * For the full copyright and license information, please view the file license.txt that was distributed with this source code.
+ */
+
namespace Square\Doctrine;
use Nette\Diagnostics\Debugger,
Oops, something went wrong.

0 comments on commit f6ccb25

Please sign in to comment.