Skip to content

Commit

Permalink
Add ability to retrieve ContentExtractor
Browse files Browse the repository at this point in the history
Usefull if you just want to clean an html without fetching an url.
  • Loading branch information
j0k3r committed May 12, 2017
1 parent 83087f7 commit caee5f7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Graby.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,17 @@ public function setLogger(LoggerInterface $logger)
$this->httpClient->setLogger($logger);
}

/**
* Get the Content Extractor.
* Can be used to clean html content without fetching an url.
*
* @return ContentExtractor
*/
public function getExtractor()
{
return $this->extractor;
}

/**
* Return a config.
*
Expand Down
2 changes: 2 additions & 0 deletions tests/GrabyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Tests\Graby;

use Graby\Extractor\ContentExtractor;
use Graby\Graby;

class GrabyTest extends \PHPUnit_Framework_TestCase
Expand All @@ -11,6 +12,7 @@ public function testConstructDefault()
$graby = new Graby(['debug' => true]);

$this->assertTrue($graby->getConfig('debug'));
$this->assertInstanceof(ContentExtractor::class, $graby->getExtractor());
}

/**
Expand Down

0 comments on commit caee5f7

Please sign in to comment.