ENH Add generic types (#86)
This commit is contained in:
parent
4bcdf97157
commit
cc43a120c8
|
@ -14,6 +14,8 @@ use SilverStripe\TextExtraction\Extractor\FileTextExtractor;
|
||||||
* Adds an additional property which is the cached contents, which is populated on demand.
|
* Adds an additional property which is the cached contents, which is populated on demand.
|
||||||
*
|
*
|
||||||
* @author mstephens
|
* @author mstephens
|
||||||
|
*
|
||||||
|
* @extends DataExtension<File>
|
||||||
*/
|
*/
|
||||||
class FileTextExtractable extends DataExtension
|
class FileTextExtractable extends DataExtension
|
||||||
{
|
{
|
||||||
|
@ -85,7 +87,6 @@ class FileTextExtractable extends DataExtension
|
||||||
*/
|
*/
|
||||||
public function extractFileAsText($disableCache = false)
|
public function extractFileAsText($disableCache = false)
|
||||||
{
|
{
|
||||||
/** @var File $file */
|
|
||||||
$file = $this->owner;
|
$file = $this->owner;
|
||||||
if (!$disableCache) {
|
if (!$disableCache) {
|
||||||
$text = $this->getTextCache()->load($file);
|
$text = $this->getTextCache()->load($file);
|
||||||
|
|
|
@ -87,7 +87,6 @@ abstract class FileTextExtractor
|
||||||
|
|
||||||
// Ensure we have a File instance to work with
|
// Ensure we have a File instance to work with
|
||||||
if (is_string($file)) {
|
if (is_string($file)) {
|
||||||
/** @var File $fileObject */
|
|
||||||
$fileObject = File::create();
|
$fileObject = File::create();
|
||||||
$fileObject->setFromLocalFile($file);
|
$fileObject->setFromLocalFile($file);
|
||||||
$file = $fileObject;
|
$file = $fileObject;
|
||||||
|
|
Loading…
Reference in New Issue