File tree Expand file tree Collapse file tree
Classes/Flowpack/ElasticSearch/ContentRepositoryAdaptor/Service Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ namespace Flowpack \ElasticSearch \ContentRepositoryAdaptor \Service ;
3+
4+ /* *
5+ * This script belongs to the TYPO3 Flow package "Flowpack.ElasticSearch.ContentRepositoryAdaptor". *
6+ * *
7+ * It is free software; you can redistribute it and/or modify it under *
8+ * the terms of the GNU Lesser General Public License, either version 3 *
9+ * of the License, or (at your option) any later version. *
10+ * *
11+ * The TYPO3 project - inspiring people to share! *
12+ * */
13+
14+ use Flowpack \ElasticSearch \ContentRepositoryAdaptor \Indexer \Error \ErrorInterface ;
15+ use TYPO3 \Flow \Annotations as Flow ;
16+
17+ /**
18+ * Error Handling Service
19+ *
20+ * @Flow\Scope("singleton")
21+ */
22+ class ErrorHandlingService implements \IteratorAggregate
23+ {
24+ protected $ errors = [];
25+
26+ /**
27+ * @param ErrorInterface $error
28+ */
29+ public function log (ErrorInterface $ error )
30+ {
31+ $ this ->errors [] = $ error ;
32+ $ error ->log ();
33+ }
34+
35+ /**
36+ * @return bool
37+ */
38+ public function hasError ()
39+ {
40+ return count ($ this ->errors ) > 0 ;
41+ }
42+
43+ /**
44+ * @return \ArrayIterator
45+ */
46+ public function getIterator ()
47+ {
48+ return new \ArrayIterator ($ this ->errors );
49+ }
50+ }
You can’t perform that action at this time.
0 commit comments