Rebased, fixed codestyle

This commit is contained in:
Andrey
2013-06-18 11:16:32 +02:00
parent 082de0b7ce
commit c8b62c02db
28 changed files with 91 additions and 108 deletions

View File

@@ -22,7 +22,6 @@ use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
*

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Controller\Prod;
use Alchemy\Phrasea\Feed\Aggregate;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Exception\SessionNotFound;
use Silex\Application as SilexApplication;

View File

@@ -13,7 +13,6 @@ namespace Alchemy\Phrasea\Controller\Root;
use Entities\Feed;
use Alchemy\Phrasea\Feed\Aggregate;
use Symfony\Component\HttpFoundation\Response;
use Silex\Application;
use Silex\ControllerProviderInterface;
@@ -111,7 +110,6 @@ class RSSFeeds implements ControllerProviderInterface
$page = (int) $request->query->get('page');
$page = $page < 1 ? 1 : $page;
return $app['feed.formatter-strategy']('cooliris')->createResponse($feed, $page, null, 'Phraseanet', $app);
})
->bind('feed_public_cooliris');

View File

@@ -34,6 +34,7 @@ class FeedServiceProvider implements ServiceProviderInterface
$collection = new LinkGeneratorCollection();
$collection->pushGenerator($app['feed.user-link-generator']);
$collection->pushGenerator($app['feed.aggregate-link-generator']);
return $collection;
});
$app['feed.rss-formatter'] = $app->share(function($app) {

View File

@@ -83,6 +83,7 @@ class Aggregate implements FeedInterface
if (count($this->feeds) == 0) {
return null;
}
return $this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds, $offset_start, $how_many);
}
@@ -131,6 +132,7 @@ class Aggregate implements FeedInterface
if (count($this->feeds) > 0) {
return count($this->em->getRepository('Entities\FeedEntry')->findByFeeds($this->feeds));
}
return 0;
}

View File

@@ -2,8 +2,6 @@
namespace Alchemy\Phrasea\Feed;
use Doctrine\ORM\Mapping as ORM;
/**
* FeedToken
*/
@@ -24,7 +22,6 @@ class AggregateToken
*/
private $feed;
/**
* Get id
*
@@ -38,7 +35,7 @@ class AggregateToken
/**
* Set usr_id
*
* @param integer $usrId
* @param integer $usrId
* @return FeedToken
*/
public function setUsrId($usrId)
@@ -61,7 +58,7 @@ class AggregateToken
/**
* Set feed
*
* @param \Entities\Feed $feed
* @param \Entities\Feed $feed
* @return FeedToken
*/
public function setFeed(\Entities\Feed $feed = null)
@@ -85,11 +82,10 @@ class AggregateToken
*/
private $value;
/**
* Set value
*
* @param string $value
* @param string $value
* @return FeedToken
*/
public function setValue($value)

View File

@@ -32,6 +32,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
$content = $this->format($feed, $page, $user, $generator);
$response = new Response($content, 200, array('Content-Type' => 'application/atom+xml'));
$response->setCharset('UTF-8');
return $response;
}
@@ -76,8 +77,7 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
if (null !== $user) {
$feedlink = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
}
else {
} else {
$feedlink = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
}
@@ -156,4 +156,3 @@ class AtomFormatter extends FeedFormatterAbstract implements FeedFormatterInterf
return $entry_node;
}
}

View File

@@ -33,6 +33,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
$content = $this->format($feed, $page, $user, $generator, $app);
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
$response->setCharset('UTF-8');
return $response;
}
@@ -61,8 +62,7 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
if (null !== $user) {
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
}
else {
} else {
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
}
@@ -265,4 +265,3 @@ class CoolirisFormatter extends FeedFormatterAbstract implements FeedFormatterIn
return $this;
}
}

View File

@@ -38,9 +38,9 @@ abstract class FeedFormatterAbstract
/**
*
* @param DOMDocument $document
* @param DOMNode $item
* @param FeedItem $content
* @param DOMDocument $document
* @param DOMNode $item
* @param FeedItem $content
* @return FeedFormaterInterface
*/
protected function addContent(Application $app, \DOMDocument $document, \DOMNode $item, FeedItem $content)

View File

@@ -10,9 +10,9 @@ interface FeedFormatterInterface
* Returns a string representation of the feed
*
* @param FeedInterface $feed
* @param type $page
* @param type $page
* @param \User_Adapter $user
* @param type $generator
* @param type $generator
*
* @return string
*/

View File

@@ -34,6 +34,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
$content = $this->format($feed, $page, $user, $generator);
$response = new Response($content, 200, array('Content-Type' => 'application/rss+xml'));
$response->setCharset('UTF-8');
return $response;
}
@@ -64,8 +65,7 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
if (null !== $user) {
$link = $this->linkGenerator->generate($feed, $user, static::FORMAT, $page);
}
else {
} else {
$link = $this->linkGenerator->generatePublic($feed, static::FORMAT, $page);
}
@@ -203,4 +203,3 @@ class RssFormatter extends FeedFormatterAbstract implements FeedFormatterInterfa
return $item;
}
}

View File

@@ -38,6 +38,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
if (null !== $page) {
$params['page'] = $page;
}
return new FeedLink(
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
@@ -50,6 +51,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
if (null !== $page) {
$params['page'] = $page;
}
return new FeedLink(
$this->generator->generate('feed_user_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),
@@ -78,6 +80,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
if (null !== $page) {
$params['page'] = $page;
}
return new FeedLink(
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
sprintf('%s - %s', $aggregate->getTitle(), 'Atom'),
@@ -89,6 +92,7 @@ class AggregateLinkGenerator implements LinkGeneratorInterface
if (null !== $page) {
$params['page'] = $page;
}
return new FeedLink(
$this->generator->generate('feed_public_aggregated', $params, UrlGenerator::ABSOLUTE_URL),
sprintf('%s - %s', $aggregate->getTitle(), 'RSS'),

View File

@@ -29,9 +29,9 @@ class FeedLink implements FeedLinkInterface
protected $uri;
/**
* @param string $uri
* @param string $title
* @param string $mimetype
* @param string $uri
* @param string $title
* @param string $mimetype
*
* @return FeedLink
*/

View File

@@ -62,6 +62,7 @@ class FeedLinkGenerator implements LinkGeneratorInterface
if (null !== $page) {
$params['page'] = $page;
}
return new FeedLink(
$this->generator->generate('feed_user', $params, UrlGenerator::ABSOLUTE_URL),
sprintf('%s - %s', $feed->getTitle(), 'RSS'),

View File

@@ -9,10 +9,10 @@ interface LinkGeneratorInterface
/**
*
* @param \Alchemy\Phrasea\Feed\FeedInterface $feed
* @param \User_Adapter $user
* @param type $format
* @param type $page
* @param type $renew
* @param \User_Adapter $user
* @param type $format
* @param type $page
* @param type $renew
*
* @throws InvalidArgumentException
*/
@@ -21,8 +21,8 @@ interface LinkGeneratorInterface
/**
*
* @param \Alchemy\Phrasea\Feed\FeedInterface $feed
* @param type $format
* @param type $page
* @param type $format
* @param type $page
*
* @throws InvalidArgumentException
*/

View File

@@ -17,7 +17,7 @@ namespace Alchemy\Phrasea\Feed\RSS;
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
class FeedRSSImage implements FeedRSSImageInterface
class Image implements FeedRSSImageInterface
{
/**
*
@@ -57,9 +57,9 @@ class FeedRSSImage implements FeedRSSImageInterface
/**
*
* @param string $url
* @param string $title
* @param string $link
* @param string $url
* @param string $title
* @param string $link
* @return FeedRSSImage
*/
public function __construct($url, $title, $link)
@@ -73,7 +73,7 @@ class FeedRSSImage implements FeedRSSImageInterface
/**
*
* @param type $description
* @param type $description
* @return FeedRSSImage
*/
public function setDescription($description)
@@ -85,7 +85,7 @@ class FeedRSSImage implements FeedRSSImageInterface
/**
*
* @param int $width
* @param int $width
* @return FeedRSSImage
*/
public function setWidth($width)
@@ -97,7 +97,7 @@ class FeedRSSImage implements FeedRSSImageInterface
/**
*
* @param int $height
* @param int $height
* @return FeedRSSImage
*/
public function setHeight($height)

View File

@@ -17,7 +17,7 @@ namespace Alchemy\Phrasea\Feed\RSS;
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
* @link www.phraseanet.com
*/
interface FeedXMLRSSImageInterface
interface ImageInterface
{
public function __construct($url, $title, $link);

View File

@@ -132,7 +132,7 @@ interface SearchEngineInterface
/**
* Add an entry to index
*
* @param FeedEntry $entry
* @param FeedEntry $entry
* @return SearchEngineInterface
* @throws RuntimeException
*/
@@ -141,7 +141,7 @@ interface SearchEngineInterface
/**
* Remove an entry to index
*
* @param FeedEntry $entry
* @param FeedEntry $entry
* @return SearchEngineInterface
* @throws RuntimeException
*/
@@ -150,7 +150,7 @@ interface SearchEngineInterface
/**
* Update an entry in the index
*
* @param FeedEntry $entry
* @param FeedEntry $entry
* @return SearchEngineInterface
* @throws RuntimeException
*/

View File

@@ -2,8 +2,6 @@
namespace Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* AggregateToken
*/
@@ -24,11 +22,10 @@ class AggregateToken
*/
private $value;
/**
* Get id
*
* @return integer
* @return integer
*/
public function getId()
{
@@ -38,20 +35,20 @@ class AggregateToken
/**
* Set usr_id
*
* @param integer $usrId
* @param integer $usrId
* @return AggregateToken
*/
public function setUsrId($usrId)
{
$this->usr_id = $usrId;
return $this;
}
/**
* Get usr_id
*
* @return integer
* @return integer
*/
public function getUsrId()
{
@@ -61,23 +58,23 @@ class AggregateToken
/**
* Set value
*
* @param string $value
* @param string $value
* @return AggregateToken
*/
public function setValue($value)
{
$this->value = $value;
return $this;
}
/**
* Get value
*
* @return string
* @return string
*/
public function getValue()
{
return $this->value;
}
}
}

View File

@@ -4,7 +4,6 @@ namespace Entities;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Feed\FeedInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* Feed
@@ -88,7 +87,7 @@ class Feed implements FeedInterface
/**
* Set public
*
* @param boolean $public
* @param boolean $public
* @return Feed
*/
public function setIsPublic($public)
@@ -111,7 +110,7 @@ class Feed implements FeedInterface
/**
* Set icon_url
*
* @param boolean $iconUrl
* @param boolean $iconUrl
* @return Feed
*/
public function setIconUrl($iconUrl)
@@ -134,7 +133,7 @@ class Feed implements FeedInterface
/**
* Set base_id
*
* @param integer $baseId
* @param integer $baseId
* @return Feed
*/
public function setBaseId($baseId)
@@ -157,7 +156,7 @@ class Feed implements FeedInterface
/**
* Set title
*
* @param string $title
* @param string $title
* @return Feed
*/
public function setTitle($title)
@@ -180,7 +179,7 @@ class Feed implements FeedInterface
/**
* Add publishers
*
* @param \Entities\FeedPublisher $publishers
* @param \Entities\FeedPublisher $publishers
* @return Feed
*/
public function addPublisher(\Entities\FeedPublisher $publishers)
@@ -213,7 +212,7 @@ class Feed implements FeedInterface
/**
* Add entries
*
* @param \Entities\FeedEntry $entries
* @param \Entities\FeedEntry $entries
* @return Feed
*/
public function addEntry(\Entities\FeedEntry $entries)
@@ -243,6 +242,7 @@ class Feed implements FeedInterface
if (null === $how_many) {
return $this->entries;
}
return $this->entries->slice($offset_start, $how_many);
}
@@ -276,6 +276,7 @@ class Feed implements FeedInterface
{
if ($collection === null) {
$this->base_id = null;
return;
}
$this->base_id = $collection->get_base_id();
@@ -284,7 +285,7 @@ class Feed implements FeedInterface
/**
* Set created_on
*
* @param \DateTime $createdOn
* @param \DateTime $createdOn
* @return Feed
*/
public function setCreatedOn($createdOn)
@@ -307,7 +308,7 @@ class Feed implements FeedInterface
/**
* Set updated_on
*
* @param \DateTime $updatedOn
* @param \DateTime $updatedOn
* @return Feed
*/
public function setUpdatedOn($updatedOn)
@@ -352,7 +353,7 @@ class Feed implements FeedInterface
/**
* Set subtitle
*
* @param string $subtitle
* @param string $subtitle
* @return Feed
*/
public function setSubtitle($subtitle)
@@ -394,7 +395,7 @@ class Feed implements FeedInterface
/**
* Add tokens
*
* @param \Entities\FeedToken $tokens
* @param \Entities\FeedToken $tokens
* @return Feed
*/
public function addToken(\Entities\FeedToken $tokens)
@@ -427,7 +428,7 @@ class Feed implements FeedInterface
/**
* Add entries
*
* @param \Entities\FeedEntry $entries
* @param \Entities\FeedEntry $entries
* @return Feed
*/
public function addEntrie(\Entities\FeedEntry $entries)

View File

@@ -2,8 +2,6 @@
namespace Entities;
use Doctrine\ORM\Mapping as ORM;
/**
* FeedEntry
*/
@@ -80,7 +78,7 @@ class FeedEntry
/**
* Set title
*
* @param string $title
* @param string $title
* @return FeedEntry
*/
public function setTitle($title)
@@ -103,7 +101,7 @@ class FeedEntry
/**
* Set subtitle
*
* @param string $subtitle
* @param string $subtitle
* @return FeedEntry
*/
public function setSubtitle($subtitle)
@@ -126,7 +124,7 @@ class FeedEntry
/**
* Set author_name
*
* @param string $authorName
* @param string $authorName
* @return FeedEntry
*/
public function setAuthorName($authorName)
@@ -149,7 +147,7 @@ class FeedEntry
/**
* Set author_email
*
* @param string $authorEmail
* @param string $authorEmail
* @return FeedEntry
*/
public function setAuthorEmail($authorEmail)
@@ -172,7 +170,7 @@ class FeedEntry
/**
* Set created
*
* @param \DateTime $createdOn
* @param \DateTime $createdOn
* @return FeedEntry
*/
public function setCreatedOn($createdOn)
@@ -195,7 +193,7 @@ class FeedEntry
/**
* Set updated
*
* @param \DateTime $updated
* @param \DateTime $updated
* @return FeedEntry
*/
public function setUpdatedOn($updatedOn)
@@ -218,7 +216,7 @@ class FeedEntry
/**
* Add items
*
* @param \Entities\FeedItem $items
* @param \Entities\FeedItem $items
* @return FeedEntry
*/
public function addItem(\Entities\FeedItem $items)
@@ -251,7 +249,7 @@ class FeedEntry
/**
* Set publisher
*
* @param \Entities\FeedPublisher $publisher
* @param \Entities\FeedPublisher $publisher
* @return FeedEntry
*/
public function setPublisher(\Entities\FeedPublisher $publisher = null)
@@ -274,7 +272,7 @@ class FeedEntry
/**
* Set feed
*
* @param \Entities\Feed $feed
* @param \Entities\Feed $feed
* @return FeedEntry
*/
public function setFeed(\Entities\Feed $feed = null)

View File

@@ -52,7 +52,7 @@ class FeedItem
/**
* Set record_id
*
* @param integer $recordId
* @param integer $recordId
* @return FeedItem
*/
public function setRecordId($recordId)
@@ -75,7 +75,7 @@ class FeedItem
/**
* Set sbas_id
*
* @param integer $sbasId
* @param integer $sbasId
* @return FeedItem
*/
public function setSbasId($sbasId)
@@ -98,7 +98,7 @@ class FeedItem
/**
* Set entry
*
* @param \Entities\FeedEntry $entry
* @param \Entities\FeedEntry $entry
* @return FeedItem
*/
public function setEntry(\Entities\FeedEntry $entry = null)
@@ -122,11 +122,10 @@ class FeedItem
*/
private $ord;
/**
* Set ord
*
* @param integer $ord
* @param integer $ord
* @return FeedItem
*/
public function setOrd($ord)
@@ -149,7 +148,7 @@ class FeedItem
/**
* Set created_on
*
* @param \DateTime $createdOn
* @param \DateTime $createdOn
* @return FeedItem
*/
public function setCreatedOn($createdOn)
@@ -172,7 +171,7 @@ class FeedItem
/**
* Set updated_on
*
* @param \DateTime $updatedOn
* @param \DateTime $updatedOn
* @return FeedItem
*/
public function setUpdatedOn($updatedOn)

View File

@@ -3,7 +3,6 @@
namespace Entities;
use Alchemy\Phrasea\Application;
use Doctrine\ORM\Mapping as ORM;
/**
* FeedPublisher
@@ -35,7 +34,6 @@ class FeedPublisher
*/
private $feed;
/**
* Get id
*
@@ -49,7 +47,7 @@ class FeedPublisher
/**
* Set usr_id
*
* @param integer $usrId
* @param integer $usrId
* @return FeedPublisher
*/
public function setUsrId($usrId)
@@ -72,7 +70,7 @@ class FeedPublisher
/**
* Set owner
*
* @param boolean $owner
* @param boolean $owner
* @return FeedPublisher
*/
public function setIsOwner($owner)
@@ -95,7 +93,7 @@ class FeedPublisher
/**
* Set feed
*
* @param \Entities\Feed $feed
* @param \Entities\Feed $feed
* @return FeedPublisher
*/
public function setFeed(\Entities\Feed $feed = null)
@@ -115,7 +113,6 @@ class FeedPublisher
return $this->feed;
}
/**
* Get user
*
@@ -131,7 +128,7 @@ class FeedPublisher
/**
* Set created_on
*
* @param \DateTime $createdOn
* @param \DateTime $createdOn
* @return FeedPublisher
*/
public function setCreatedOn($createdOn)

View File

@@ -2,8 +2,6 @@
namespace Entities;
use Doctrine\ORM\Mapping as ORM;
class FeedToken
{
/**
@@ -21,7 +19,6 @@ class FeedToken
*/
private $feed;
/**
* Get id
*
@@ -35,7 +32,7 @@ class FeedToken
/**
* Set usr_id
*
* @param integer $usrId
* @param integer $usrId
* @return FeedToken
*/
public function setUsrId($usrId)
@@ -58,7 +55,7 @@ class FeedToken
/**
* Set feed
*
* @param \Entities\Feed $feed
* @param \Entities\Feed $feed
* @return FeedToken
*/
public function setFeed(\Entities\Feed $feed = null)
@@ -82,11 +79,10 @@ class FeedToken
*/
private $value;
/**
* Set value
*
* @param string $value
* @param string $value
* @return FeedToken
*/
public function setValue($value)

View File

@@ -3,7 +3,6 @@
namespace Repositories;
use Doctrine\ORM\EntityRepository;
use Entities\Feed;
/**
* AggregateTokenRepository

View File

@@ -16,7 +16,7 @@ class SessionRepository extends EntityRepository
/**
*
* @param User_Adapter $user
* @param User_Adapter $user
* @return \Doctrine\Common\Collections\Collection
*/
public function getAllForUser(\User_Adapter $user)

View File

@@ -1583,8 +1583,8 @@ class API_V1_adapter extends API_V1_Abstract
/**
* Retrieve detailled informations about one feed
*
* @param Feed $feed
* @param type $user
* @param Feed $feed
* @param type $user
* @return array
*/
protected function list_publication(Feed $feed, $user)
@@ -1607,8 +1607,8 @@ class API_V1_adapter extends API_V1_Abstract
* Retrieve all entries of one feed
*
* @param FeedInterface $feed
* @param int $offset_start
* @param int $how_many
* @param int $offset_start
* @param int $how_many
* @return array
*/
protected function list_publications_entries(FeedInterface $feed, $offset_start = 0, $how_many = 5)

View File

@@ -43,8 +43,7 @@ class LoadOneFeed extends AbstractFixture implements FixtureInterface
$feed->addPublisher($publisher);
if (isset($this->title) && $this->title !== null) {
$feed->setTitle($this->title);
}
else {
} else {
$feed->setTitle("test");
}