hwmaier Posted February 12, 2015 Share Posted February 12, 2015 It would be beneficial if the FilenameArray class would have a count() method. Suggested implementation: class FilenameArray implements IteratorAggregate, Countable { ... /** * Returns the number of items in this FilenameArray. * * Fulfills Countable interface. * * @return int */ public function count() { return count($this->data); } Rationale: A count method can be used to check if any scripts or stylesheets are configured as shown in the following example: <?if (count($config->scripts)):?> <script type="text/javascript" src="<?=AllInOneMinify::JS($config->scripts?>"></script> <?endif?> The current implementation of FilenameArray does not implement the Countable interface and count() will return a 1 regardless of the number of elements in the FilenameArray. Link to comment Share on other sites More sharing options...
Pierre-Luc Posted February 16, 2015 Share Posted February 16, 2015 I would greatly suggest you post this in GitHub's issue/request tracker. Link to comment Share on other sites More sharing options...
hwmaier Posted February 16, 2015 Author Share Posted February 16, 2015 I would greatly suggest you post this in GitHub's issue/request tracker. Done. Refer to https://github.com/ryancramerdesign/ProcessWire/issues/929 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now