Skip to content

Commit

Permalink
Merge pull request #66 from Soullivaneuh/exceptions-namespaces
Browse files Browse the repository at this point in the history
Move all exceptions on Exception namespace
  • Loading branch information
alexdebril committed Jun 5, 2015
2 parents 030ec8c + baf0547 commit c074319
Show file tree
Hide file tree
Showing 25 changed files with 102 additions and 58 deletions.
2 changes: 1 addition & 1 deletion Controller/StreamController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Debril\RssAtomBundle\Provider\FeedContentProviderInterface;
use Debril\RssAtomBundle\Exception\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException;

class StreamController extends Controller
{
Expand Down
2 changes: 2 additions & 0 deletions Driver/FileDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace Debril\RssAtomBundle\Driver;

use Debril\RssAtomBundle\Exception\DriverUnreachableResourceException;

/**
* Class FileDriver.
*/
Expand Down
2 changes: 2 additions & 0 deletions Driver/HttpCurlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
namespace Debril\RssAtomBundle\Driver;

use Debril\RssAtomBundle\Exception\DriverUnreachableResourceException;

/**
* Class HttpCurlDriver.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Driver;

use Debril\RssAtomBundle\Exception\RssAtomException;
namespace Debril\RssAtomBundle\Exception;

/**
* Class DriverUnreachableResourceException.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Exception;
namespace Debril\RssAtomBundle\Exception\FeedException;

use Debril\RssAtomBundle\Exception\FeedException;

/**
* Class FeedCannotBeReadException.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Exception;
namespace Debril\RssAtomBundle\Exception\FeedException;

use Debril\RssAtomBundle\Exception\FeedException;

/**
* Class FeedForbiddenException.
Expand Down
20 changes: 20 additions & 0 deletions Exception/FeedException/FeedNotFoundException.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

/**
* Rss/Atom Bundle for Symfony 2.
*
*
* @license http://opensource.org/licenses/lgpl-3.0.html LGPL
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Exception\FeedException;

use Debril\RssAtomBundle\Exception\FeedException;

/**
* Class FeedNotFoundException.
*/
class FeedNotFoundException extends FeedException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Exception;
namespace Debril\RssAtomBundle\Exception\FeedException;

use Debril\RssAtomBundle\Exception\FeedException;

/**
* Class FeedNotModifiedException.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
* @copyright (c) 2013, Alexandre Debril
*/

namespace Debril\RssAtomBundle\Exception;
namespace Debril\RssAtomBundle\Exception\FeedException;

use Debril\RssAtomBundle\Exception\FeedException;

/**
* Class FeedServerErrorException.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
namespace Debril\RssAtomBundle\Exception;

/**
* Class FeedNotFoundException.
* Class ParserException.
*/
class FeedNotFoundException extends FeedException
class ParserException extends RssAtomException
{
}
12 changes: 6 additions & 6 deletions Protocol/FeedReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
use Debril\RssAtomBundle\Driver\HttpDriverInterface;
use Debril\RssAtomBundle\Driver\HttpDriverResponse;
use Debril\RssAtomBundle\Protocol\Parser\Factory;
use Debril\RssAtomBundle\Protocol\Parser\ParserException;
use Debril\RssAtomBundle\Exception\FeedCannotBeReadException;
use Debril\RssAtomBundle\Exception\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedNotModifiedException;
use Debril\RssAtomBundle\Exception\FeedServerErrorException;
use Debril\RssAtomBundle\Exception\FeedForbiddenException;
use Debril\RssAtomBundle\Exception\ParserException;
use Debril\RssAtomBundle\Exception\FeedException\FeedCannotBeReadException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotModifiedException;
use Debril\RssAtomBundle\Exception\FeedException\FeedServerErrorException;
use Debril\RssAtomBundle\Exception\FeedException\FeedForbiddenException;

/**
* Class to read any kind of supported feeds (RSS, ATOM, and more if you need).
Expand Down
2 changes: 1 addition & 1 deletion Protocol/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

use SimpleXMLElement;
use DateTime;
use Debril\RssAtomBundle\Protocol\Parser\ParserException;
use Debril\RssAtomBundle\Exception\ParserException;
use Debril\RssAtomBundle\Protocol\Parser\Factory;
use Debril\RssAtomBundle\Protocol\Parser\Media;

Expand Down
20 changes: 0 additions & 20 deletions Protocol/Parser/ParserException.php

This file was deleted.

2 changes: 1 addition & 1 deletion Provider/DoctrineFeedContentProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
namespace Debril\RssAtomBundle\Provider;

use Doctrine\Bundle\DoctrineBundle\Registry;
use Debril\RssAtomBundle\Exception\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
Expand Down
2 changes: 1 addition & 1 deletion Provider/FeedContentProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface FeedContentProviderInterface
/**
* @param array $options
*
* @throws \Debril\RssAtomBundle\Exception\FeedNotFoundException
* @throws \Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException
*
* @return \Debril\RssAtomBundle\Protocol\FeedOutInterface
*/
Expand Down
2 changes: 1 addition & 1 deletion Provider/MockProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

use Debril\RssAtomBundle\Protocol\Parser\FeedContent;
use Debril\RssAtomBundle\Protocol\Parser\Item;
use Debril\RssAtomBundle\Exception\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException;

class MockProvider implements FeedContentProviderInterface
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Driver/FileDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function tearDown()
* @covers Debril\RssAtomBundle\Driver\FileDriver::getResponse
*
* @todo Implement testGetResponse().
* @expectedException Debril\RssAtomBundle\Driver\DriverUnreachableResourceException
* @expectedException Debril\RssAtomBundle\Exception\DriverUnreachableResourceException
*/
public function testGetResponseException()
{
Expand Down
4 changes: 3 additions & 1 deletion Tests/Driver/HttpCurlDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Debril\RssAtomBundle\Driver;

use Debril\RssAtomBundle\Exception\DriverUnreachableResourceException;

/**
* Generated by PHPUnit_SkeletonGenerator 1.2.0 on 2013-02-06 at 23:48:53.
*/
Expand Down Expand Up @@ -54,7 +56,7 @@ public function testGetResponse()

/**
* @covers Debril\RssAtomBundle\Driver\HttpCurlDriver::getResponse
* @expectedException Debril\RssAtomBundle\Driver\DriverUnreachableResourceException
* @expectedException \Debril\RssAtomBundle\Exception\DriverUnreachableResourceException
*/
public function testGetResponseException()
{
Expand Down
14 changes: 7 additions & 7 deletions Tests/Protocol/FeedReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function testGetDriver()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::getFeedContent
* @expectedException Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException Debril\RssAtomBundle\Exception\ParserException
*/
public function testGetFeedContentException()
{
Expand Down Expand Up @@ -219,7 +219,7 @@ public function testGetAccurateParser()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::getAccurateParser
* @expectedException Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException Debril\RssAtomBundle\Exception\ParserException
*/
public function testGetAccurateParserException()
{
Expand All @@ -230,7 +230,7 @@ public function testGetAccurateParserException()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::parseBody
* @expectedException Debril\RssAtomBundle\Exception\FeedNotModifiedException
* @expectedException Debril\RssAtomBundle\Exception\FeedException\FeedNotModifiedException
*/
public function testParseBody304()
{
Expand All @@ -241,7 +241,7 @@ public function testParseBody304()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::parseBody
* @expectedException Debril\RssAtomBundle\Exception\FeedNotFoundException
* @expectedException Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException
*/
public function testParseBody404()
{
Expand All @@ -252,7 +252,7 @@ public function testParseBody404()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::parseBody
* @expectedException Debril\RssAtomBundle\Exception\FeedServerErrorException
* @expectedException Debril\RssAtomBundle\Exception\FeedException\FeedServerErrorException
*/
public function testParseBody500()
{
Expand All @@ -263,7 +263,7 @@ public function testParseBody500()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::parseBody
* @expectedException Debril\RssAtomBundle\Exception\FeedForbiddenException
* @expectedException Debril\RssAtomBundle\Exception\FeedException\FeedForbiddenException
*/
public function testParseBody403()
{
Expand All @@ -274,7 +274,7 @@ public function testParseBody403()

/**
* @covers Debril\RssAtomBundle\Protocol\FeedReader::parseBody
* @expectedException Debril\RssAtomBundle\Exception\FeedCannotBeReadException
* @expectedException Debril\RssAtomBundle\Exception\FeedException\FeedCannotBeReadException
*/
public function testParseBodyUnknownError()
{
Expand Down
6 changes: 3 additions & 3 deletions Tests/Protocol/Parser/AtomParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ protected function tearDown()
/**
* @covers Debril\RssAtomBundle\Protocol\Parser::parse
* @covers Debril\RssAtomBundle\Protocol\Parser\AtomParser::canHandle
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testCannotHandle()
{
Expand All @@ -57,7 +57,7 @@ public function testCanHandle()

/**
* @covers Debril\RssAtomBundle\Protocol\Parser\AtomParser::checkBodyStructure
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testParseError()
{
Expand Down Expand Up @@ -122,7 +122,7 @@ public function testSetDateFormats($default)
/**
* @covers Debril\RssAtomBundle\Protocol\Parser::guessDateFormat
* @dataProvider getDefaultFormats
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testGuessDateFormatException($default)
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/Protocol/Parser/RdfParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testCanHandle()

/**
* @covers Debril\RssAtomBundle\Protocol\Parser\RdfParser::checkBodyStructure
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testParseError()
{
Expand Down Expand Up @@ -102,7 +102,7 @@ public function testSetDateFormats($default)
/**
* @covers Debril\RssAtomBundle\Protocol\Parser::guessDateFormat
* @dataProvider getDefaultFormats
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testGuessDateFormatException($default)
{
Expand Down
4 changes: 2 additions & 2 deletions Tests/Protocol/Parser/RssParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function testCanHandle()

/**
* @covers Debril\RssAtomBundle\Protocol\Parser\RssParser::checkBodyStructure
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testParseError()
{
Expand Down Expand Up @@ -158,7 +158,7 @@ public function testSetDateFormats($default)
/**
* @covers Debril\RssAtomBundle\Protocol\Parser::guessDateFormat
* @dataProvider getDefaultFormats
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testGuessDateFormatException(array $default)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Protocol/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testGetSystemTimezone()

/**
* @covers Debril\RssAtomBundle\Protocol\Parser::convertToDateTime
* @expectedException \Debril\RssAtomBundle\Protocol\Parser\ParserException
* @expectedException \Debril\RssAtomBundle\Exception\ParserException
*/
public function testConvertToDateTimeException()
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/Provider/MockProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testGetContent()

/**
* @covers Debril\RssAtomBundle\Provider\MockProvider::getFeedContent
* @expectedException \Debril\RssAtomBundle\Exception\FeedNotFoundException
* @expectedException \Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException
*/
public function testGet404()
{
Expand Down
32 changes: 32 additions & 0 deletions UPGRADE-2.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
UPGRADE FROM 1.x to 2.0
=======================

### Exceptions namespaces

All exceptions of this bundle was moved to `Debril\RssAtomBundle\Exception` namespace.

Feed exceptions are now on `Debril\RssAtomBundle\Exception\FeedException` namespace.

Before:

```php
use Debril\RssAtomBundle\Driver\DriverUnreachableResourceException;
use Debril\RssAtomBundle\Protocol\Parser\ParserException;
use Debril\RssAtomBundle\Exception\FeedCannotBeReadException;
use Debril\RssAtomBundle\Exception\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedNotModifiedException;
use Debril\RssAtomBundle\Exception\FeedServerErrorException;
use Debril\RssAtomBundle\Exception\FeedForbiddenException;
```

After:

```php
use Debril\RssAtomBundle\Exception\DriverUnreachableResourceException;
use Debril\RssAtomBundle\Exception\ParserException;
use Debril\RssAtomBundle\Exception\FeedException\FeedCannotBeReadException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotFoundException;
use Debril\RssAtomBundle\Exception\FeedException\FeedNotModifiedException;
use Debril\RssAtomBundle\Exception\FeedException\FeedServerErrorException;
use Debril\RssAtomBundle\Exception\FeedException\FeedForbiddenException;
```

0 comments on commit c074319

Please sign in to comment.