zend-feed icon indicating copy to clipboard operation
zend-feed copied to clipboard

Change static interface to dynamic

Open necromant2005 opened this issue 9 years ago • 6 comments

I know it may be a bit too complicated due as part of migration to zf3. It makes sense to change static zend-feed interface to dynamic.

class Reader 
{
    public function __construct(HttpClient $http = null, CacheAdapter $cache = null)

    public function import()
    {
        $cache   = $this->getCache();
        $client  = $this->getHttpClient();
        $cacheId = 'Zend_Feed_Reader_' . md5($uri);
        ...
   }
}

It will break back comparability with version 2.*. But It's necessary changes if we want to have clear, easy management code that can be used in any application without global static variables.

necromant2005 avatar Jan 17 '16 06:01 necromant2005

Having done the work to separate the plugin manager and http dependencies, I can attest to the difficulties in testing the compliment currently; static usage makes this quite cumbersome!

If we're going to break BC anyway, I'd argue we should also target PSR-6 interfaces (particularly since with is being done to provide psr-6 compatibility in zend-cache). That particular change would affect also the pubsdubhubbub subcomponent, but not the writer.

to;dr: go for it!

weierophinney avatar Feb 12 '16 12:02 weierophinney

Thank you Matthew! I'll start migration.

necromant2005 avatar Feb 12 '16 17:02 necromant2005

Hi Matthew,

I've migrated Zend-Feed reader https://github.com/necromant2005/zend-feed/tree/BUG19-mirgration-static-tdynamic tests passed: https://travis-ci.org/necromant2005/zend-feed/builds/110578421

I can merge all changes in one commit, if you prefer.

Cheers,

necromant2005 avatar Feb 20 '16 11:02 necromant2005

Also it will be great to migrate "writter" because it uses the same weird static plugin manager functionality /** * @var ExtensionManagerInterface */ protected static $extensionManager = null;

necromant2005 avatar Feb 20 '16 11:02 necromant2005

I've also migrated cache interface to PSR-6

necromant2005 avatar Feb 22 '16 05:02 necromant2005

This repository has been closed and moved to laminas/laminas-feed; a new issue has been opened at https://github.com/laminas/laminas-feed/issues/12.

weierophinney avatar Dec 31 '19 21:12 weierophinney