Fixed codestyle with cs-fixer

This commit is contained in:
Andrey
2013-06-19 16:29:10 +02:00
parent 1764d5f5c4
commit 946240c5c5
11 changed files with 38 additions and 326 deletions

View File

@@ -40,8 +40,8 @@ class Aggregate implements FeedInterface
private $em; private $em;
/** /**
* @param EntityManager $em * @param EntityManager $em
* @param array $feeds * @param array $feeds
* @param AggregateToken $token * @param AggregateToken $token
* *
* @return Aggregate * @return Aggregate
@@ -86,7 +86,7 @@ class Aggregate implements FeedInterface
* Creates an aggregate from given Feed id array. * Creates an aggregate from given Feed id array.
* *
* @param EntityManager $em * @param EntityManager $em
* @param array $feed_ids * @param array $feed_ids
* *
* @return Aggregate * @return Aggregate
*/ */
@@ -214,6 +214,7 @@ class Aggregate implements FeedInterface
if (0 > $page && $page <= $count / $pageSize) { if (0 > $page && $page <= $count / $pageSize) {
return true; return true;
} }
return false; return false;
} }

View File

@@ -40,7 +40,7 @@ class AggregateToken
/** /**
* Set usr_id * Set usr_id
* *
* @param integer $usrId * @param integer $usrId
* @return AggregateToken * @return AggregateToken
*/ */
public function setUsrId($usrId) public function setUsrId($usrId)
@@ -63,7 +63,7 @@ class AggregateToken
/** /**
* Set feed * Set feed
* *
* @param Aggregate $feed * @param Aggregate $feed
* @return AggregateToken * @return AggregateToken
*/ */
public function setFeed(\Entities\Feed $feed = null) public function setFeed(\Entities\Feed $feed = null)
@@ -90,7 +90,7 @@ class AggregateToken
/** /**
* Set value * Set value
* *
* @param string $value * @param string $value
* @return AggregateToken * @return AggregateToken
*/ */
public function setValue($value) public function setValue($value)

View File

@@ -280,7 +280,7 @@ class Feed implements FeedInterface
/** /**
* Returns the collection to which the feed belongs. * Returns the collection to which the feed belongs.
* *
* @param Application $app * @param Application $app
* *
* @return type * @return type
*/ */
@@ -524,6 +524,7 @@ class Feed implements FeedInterface
if (0 > $page && $page <= $count / $pageSize) { if (0 > $page && $page <= $count / $pageSize) {
return true; return true;
} }
return false; return false;
} }
} }

View File

@@ -1,106 +0,0 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class LazaretCheck extends \Entities\LazaretCheck implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_entityPersister = $entityPersister;
$this->_identifier = $identifier;
}
/** @private */
public function __load()
{
if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true;
if (method_exists($this, "__wakeup")) {
// call this after __isInitialized__to avoid infinite recursion
// but before loading to emulate what ClassMetadata::newInstance()
// provides.
$this->__wakeup();
}
if ($this->_entityPersister->load($this->_identifier, $this) === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
unset($this->_entityPersister, $this->_identifier);
}
}
/** @private */
public function __isInitialized()
{
return $this->__isInitialized__;
}
public function getId()
{
if ($this->__isInitialized__ === false) {
return (int) $this->_identifier["id"];
}
$this->__load();
return parent::getId();
}
public function setCheckClassname($checkClassname)
{
$this->__load();
return parent::setCheckClassname($checkClassname);
}
public function getCheckClassname()
{
$this->__load();
return parent::getCheckClassname();
}
public function setLazaretFile(\Entities\LazaretFile $lazaretFile = NULL)
{
$this->__load();
return parent::setLazaretFile($lazaretFile);
}
public function getLazaretFile()
{
$this->__load();
return parent::getLazaretFile();
}
public function getMessage()
{
$this->__load();
return parent::getMessage();
}
public function __sleep()
{
return array('__isInitialized__', 'id', 'checkClassname', 'lazaretFile');
}
public function __clone()
{
if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true;
$class = $this->_entityPersister->getClassMetadata();
$original = $this->_entityPersister->load($this->_identifier);
if ($original === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
foreach ($class->reflFields as $field => $reflProperty) {
$reflProperty->setValue($this, $reflProperty->getValue($original));
}
unset($this->_entityPersister, $this->_identifier);
}
}
}

View File

@@ -1,196 +0,0 @@
<?php
namespace Proxies\__CG__\Entities;
/**
* THIS CLASS WAS GENERATED BY THE DOCTRINE ORM. DO NOT EDIT THIS FILE.
*/
class ValidationParticipant extends \Entities\ValidationParticipant implements \Doctrine\ORM\Proxy\Proxy
{
private $_entityPersister;
private $_identifier;
public $__isInitialized__ = false;
public function __construct($entityPersister, $identifier)
{
$this->_entityPersister = $entityPersister;
$this->_identifier = $identifier;
}
/** @private */
public function __load()
{
if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true;
if (method_exists($this, "__wakeup")) {
// call this after __isInitialized__to avoid infinite recursion
// but before loading to emulate what ClassMetadata::newInstance()
// provides.
$this->__wakeup();
}
if ($this->_entityPersister->load($this->_identifier, $this) === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
unset($this->_entityPersister, $this->_identifier);
}
}
/** @private */
public function __isInitialized()
{
return $this->__isInitialized__;
}
public function getId()
{
if ($this->__isInitialized__ === false) {
return (int) $this->_identifier["id"];
}
$this->__load();
return parent::getId();
}
public function setUsrId($usrId)
{
$this->__load();
return parent::setUsrId($usrId);
}
public function getUsrId()
{
$this->__load();
return parent::getUsrId();
}
public function setUser(\User_Adapter $user)
{
$this->__load();
return parent::setUser($user);
}
public function getUser(\Alchemy\Phrasea\Application $app)
{
$this->__load();
return parent::getUser($app);
}
public function setIsAware($isAware)
{
$this->__load();
return parent::setIsAware($isAware);
}
public function getIsAware()
{
$this->__load();
return parent::getIsAware();
}
public function setIsConfirmed($isConfirmed)
{
$this->__load();
return parent::setIsConfirmed($isConfirmed);
}
public function getIsConfirmed()
{
$this->__load();
return parent::getIsConfirmed();
}
public function setCanAgree($canAgree)
{
$this->__load();
return parent::setCanAgree($canAgree);
}
public function getCanAgree()
{
$this->__load();
return parent::getCanAgree();
}
public function setCanSeeOthers($canSeeOthers)
{
$this->__load();
return parent::setCanSeeOthers($canSeeOthers);
}
public function getCanSeeOthers()
{
$this->__load();
return parent::getCanSeeOthers();
}
public function setReminded($reminded)
{
$this->__load();
return parent::setReminded($reminded);
}
public function getReminded()
{
$this->__load();
return parent::getReminded();
}
public function addData(\Entities\ValidationData $datas)
{
$this->__load();
return parent::addData($datas);
}
public function removeData(\Entities\ValidationData $datas)
{
$this->__load();
return parent::removeData($datas);
}
public function getDatas()
{
$this->__load();
return parent::getDatas();
}
public function setSession(\Entities\ValidationSession $session = NULL)
{
$this->__load();
return parent::setSession($session);
}
public function getSession()
{
$this->__load();
return parent::getSession();
}
public function isReleasable()
{
$this->__load();
return parent::isReleasable();
}
public function __sleep()
{
return array('__isInitialized__', 'id', 'usr_id', 'is_aware', 'is_confirmed', 'can_agree', 'can_see_others', 'reminded', 'datas', 'session');
}
public function __clone()
{
if (!$this->__isInitialized__ && $this->_entityPersister) {
$this->__isInitialized__ = true;
$class = $this->_entityPersister->getClassMetadata();
$original = $this->_entityPersister->load($this->_identifier);
if ($original === null) {
throw new \Doctrine\ORM\EntityNotFoundException();
}
foreach ($class->reflFields as $field => $reflProperty) {
$reflProperty->setValue($this, $reflProperty->getValue($original));
}
unset($this->_entityPersister, $this->_identifier);
}
}
}

View File

@@ -17,7 +17,7 @@ class OrderElementRepository extends EntityRepository
/** /**
* Finds a FeedPublisher based on a given Feed and a User_Adapter. * Finds a FeedPublisher based on a given Feed and a User_Adapter.
* *
* @param Feed $feed * @param Feed $feed
* @param \User_Adapter $user * @param \User_Adapter $user
* *
* @return FeedPublisher * @return FeedPublisher

View File

@@ -4,6 +4,7 @@ namespace Repositories;
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Doctrine\ORM\EntityRepository; use Doctrine\ORM\EntityRepository;
use Entities\Feed;
/** /**
* SessionRepository * SessionRepository
@@ -14,9 +15,9 @@ use Doctrine\ORM\EntityRepository;
class SessionRepository extends EntityRepository class SessionRepository extends EntityRepository
{ {
/** /**
* Returns all the feeds a user can access.
* *
* @param User_Adapter $user * @param User_Adapter $user
*
* @return \Doctrine\Common\Collections\Collection * @return \Doctrine\Common\Collections\Collection
*/ */
public function getAllForUser(\User_Adapter $user) public function getAllForUser(\User_Adapter $user)
@@ -35,11 +36,15 @@ class SessionRepository extends EntityRepository
ORDER BY f.updated_on DESC'; ORDER BY f.updated_on DESC';
$query = $this->_em->createQuery($dql); $query = $this->_em->createQuery($dql);
$feeds = $query->getResult();
return $feeds; return $query->getResult();
} }
/**
* Returns all the public feeds.
*
* @return Collection
*/
public function findAllPublic() public function findAllPublic()
{ {
$dql = 'SELECT f FROM Entities\Feed f $dql = 'SELECT f FROM Entities\Feed f
@@ -47,11 +52,18 @@ class SessionRepository extends EntityRepository
ORDER BY f.updated_on DESC'; ORDER BY f.updated_on DESC';
$query = $this->_em->createQuery($dql); $query = $this->_em->createQuery($dql);
$feeds = $query->getResult();
return $feeds; return $query->getResult();
} }
/**
* Returns the given feed if the user can access to it.
*
* @param Application $app
* @param \User_Adapter $user
* @param type $id
* @return Feed
*/
public function loadWithUser(Application $app, \User_Adapter $user, $id) public function loadWithUser(Application $app, \User_Adapter $user, $id)
{ {
$feed = $this->find($id); $feed = $this->find($id);
@@ -67,6 +79,12 @@ class SessionRepository extends EntityRepository
return null; return null;
} }
/**
* Returns all the feeds from a given array containing their id.
*
* @param array $feed_id
* @return Collection
*/
public function findByIdArray(array $feed_id) public function findByIdArray(array $feed_id)
{ {
$dql = 'SELECT f FROM Entities\Feed f $dql = 'SELECT f FROM Entities\Feed f
@@ -74,8 +92,7 @@ class SessionRepository extends EntityRepository
WHERE f.id IN (' . implode(",", $feed_id) . ')'; WHERE f.id IN (' . implode(",", $feed_id) . ')';
$query = $this->_em->createQuery($dql); $query = $this->_em->createQuery($dql);
$feeds = $query->getResult();
return $feeds; return $query->getResult();
} }
} }

View File

@@ -5,11 +5,9 @@ namespace Alchemy\Tests\Phrasea\Controller\Root;
require_once __DIR__ . '/../../../../../classes/FeedValidator.inc'; require_once __DIR__ . '/../../../../../classes/FeedValidator.inc';
use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Feed\Aggregate;
use Entities\Feed; use Entities\Feed;
use Entities\FeedEntry; use Entities\FeedEntry;
use Entities\FeedItem; use Entities\FeedItem;
use Alchemy\Phrasea\Feed\FeedLink;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
class RssFeedTest extends \PhraseanetWebTestCaseAbstract class RssFeedTest extends \PhraseanetWebTestCaseAbstract

View File

@@ -52,8 +52,7 @@ class AggregateLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
if ($format == "atom") { if ($format == "atom") {
$this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("application/atom+xml", $link->getMimetype());
$this->assertSame("AGGREGATE - Atom", $link->getTitle()); $this->assertSame("AGGREGATE - Atom", $link->getTitle());
} } elseif ($format == "rss") {
elseif ($format == "rss") {
$this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("application/rss+xml", $link->getMimetype());
$this->assertSame("AGGREGATE - RSS", $link->getTitle()); $this->assertSame("AGGREGATE - RSS", $link->getTitle());
} }

View File

@@ -44,8 +44,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
if ($format == "atom") { if ($format == "atom") {
$this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("application/atom+xml", $link->getMimetype());
$this->assertSame("Title - Atom", $link->getTitle()); $this->assertSame("Title - Atom", $link->getTitle());
} } elseif ($format == "rss") {
elseif ($format == "rss") {
$this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("application/rss+xml", $link->getMimetype());
$this->assertSame("Title - RSS", $link->getTitle()); $this->assertSame("Title - RSS", $link->getTitle());
} }
@@ -133,8 +132,7 @@ class FeedLinkGeneratorTest extends \PhraseanetPHPUnitAbstract
if ($format == "atom") { if ($format == "atom") {
$this->assertSame("application/atom+xml", $link->getMimetype()); $this->assertSame("application/atom+xml", $link->getMimetype());
$this->assertSame("Title - Atom", $link->getTitle()); $this->assertSame("Title - Atom", $link->getTitle());
} } elseif ($format == "rss") {
elseif ($format == "rss") {
$this->assertSame("application/rss+xml", $link->getMimetype()); $this->assertSame("application/rss+xml", $link->getMimetype());
$this->assertSame("Title - RSS", $link->getTitle()); $this->assertSame("Title - RSS", $link->getTitle());
} }