Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

coding standard

  • Loading branch information...
commit f6ccb25211441d1f9c49b193668cd07ee247833d 1 parent 8ebbd1e
@kolinger authored
View
14 Config/Configurator.php
@@ -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
32 Console/Extension.php
@@ -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
36 Console/Router.php
@@ -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
58 Doctrine/Cache.php
@@ -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,9 +84,11 @@ protected function doSave($id, $data, $lifeTime = FALSE)
return TRUE;
}
+
+
/**
- * @param string
- * @return boolean
+ * @param string $id
+ * @return bool
*/
protected function doDelete($id)
{
@@ -73,8 +96,10 @@ protected function doDelete($id)
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
34 Doctrine/Extension.php
@@ -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
8 Doctrine/Logger.php
@@ -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,
View
24 Model/Entity.php
@@ -1,18 +1,29 @@
<?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\Model;
use Doctrine\ORM\Mapping as orm;
+
+
/**
* @orm\MappedSuperclass
*
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*
* @property-read int $id
*/
abstract class Entity extends \Nette\Object
{
+
/**
* @orm\Id
* @orm\GeneratedValue
@@ -22,17 +33,21 @@
*/
private $id;
+
+
/**
- * @return string
+ * @return int
*/
public function getId()
{
return $this->id;
}
+
+
/**
- * @param string
- * @return NULL|string
+ * @param string $string
+ * @return null|string
*/
protected static function normalizeString($string)
{
@@ -42,4 +57,5 @@ protected static function normalizeString($string)
}
return $string;
}
+
}
View
48 Model/Facade.php
@@ -1,24 +1,41 @@
<?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\Model;
+
+
/**
- * @author Tomáš Kolinger
+ * @author Tomáš Kolinger <tomas@kolinger.name>
*
* @property-read \Doctrine\ORM\EntityManager $entityManager
* @property-read \Doctrine\ORM\EntityRepository $repository
*/
abstract class Facade extends \Nette\Object
{
+
const FLUSH = true;
const WITHOUT_FLUSH = false;
- /** @var \Doctrine\ORM\EntityManager */
+ /**
+ * @var \Doctrine\ORM\EntityManager
+ */
private $entityManager;
- /** @var \Doctrine\ORM\EntityRepository */
+ /**
+ * @var \Doctrine\ORM\EntityRepository
+ */
private $repository;
+
+
/**
* @param \Doctrine\ORM\EntityRepository
* @param \Doctrine\ORM\EntityManager
@@ -29,6 +46,8 @@ public function __construct(\Doctrine\ORM\EntityRepository $repository, \Doctrin
$this->repository = $repository;
}
+
+
/**
* @return \Doctrine\ORM\EntityManager
*/
@@ -37,6 +56,8 @@ public function getEntityManager()
return $this->entityManager;
}
+
+
/**
* @return \Doctrine\ORM\EntityRepository
*/
@@ -45,6 +66,8 @@ public function getRepository()
return $this->repository;
}
+
+
/**
* @return object
*/
@@ -55,9 +78,11 @@ public function create()
return $entity;
}
+
+
/**
- * @param object
- * @param boolean
+ * @param object $entity
+ * @param boolean $flush
*/
public function save($entity, $flush = self::FLUSH)
{
@@ -71,9 +96,11 @@ public function save($entity, $flush = self::FLUSH)
// }
}
+
+
/**
- * @param object
- * @param boolean
+ * @param object $entity
+ * @param boolean $flush
*/
public function remove($entity, $flush = self::FLUSH)
{
@@ -87,6 +114,8 @@ public function remove($entity, $flush = self::FLUSH)
// }
}
+
+
/**
* @return array
*/
@@ -95,12 +124,15 @@ public function findAll()
return $this->repository->findAll();
}
+
+
/**
- * @param string
+ * @param string $alias
* @return \Doctrine\ORM\QueryBuilder
*/
protected function createQueryBuilder($alias)
{
return $this->repository->createQueryBuilder($alias);
}
+
}
Please sign in to comment.
Something went wrong with that request. Please try again.