]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Log/ParsedLogIterator.php
Merge pull request #9 from nupplaphil/dependabot/composer/guzzlehttp/guzzle-6.5.8
[friendica.git] / src / Model / Log / ParsedLogIterator.php
index 856edb38fd8be912e31067746153469151761c41..d3a5650397d6bd14646b4fb2e5766a28928a8968 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2021, Friendica
+ * @copyright Copyright (C) 2010-2022, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -60,7 +60,7 @@ class ParsedLogIterator implements \Iterator
         * @param string $filename      File to open
         * @return $this
         */
-       public function open(string $filename)
+       public function open(string $filename): ParsedLogIterator
        {
                $this->reader->open($filename);
                return $this;
@@ -70,7 +70,7 @@ class ParsedLogIterator implements \Iterator
         * @param int $limit            Max num of lines to read
         * @return $this
         */
-       public function withLimit(int $limit)
+       public function withLimit(int $limit): ParsedLogIterator
        {
                $this->limit = $limit;
                return $this;
@@ -80,7 +80,7 @@ class ParsedLogIterator implements \Iterator
         * @param array $filters                filters per column
         * @return $this
         */
-       public function withFilters(array $filters)
+       public function withFilters(array $filters): ParsedLogIterator
        {
                $this->filters = $filters;
                return $this;
@@ -90,7 +90,7 @@ class ParsedLogIterator implements \Iterator
         * @param string $search        string to search to filter lines
         * @return $this
         */
-       public function withSearch(string $search)
+       public function withSearch(string $search): ParsedLogIterator
        {
                $this->search = $search;
                return $this;
@@ -100,10 +100,10 @@ class ParsedLogIterator implements \Iterator
         * Check if parsed log line match filters.
         * Always match if no filters are set.
         *
-        * @param ParsedLogLine $parsedlogline
-        * @return bool
+        * @param ParsedLogLine $parsedlogline ParsedLogLine instance
+        * @return bool Wether the parse log line matches
         */
-       private function filter($parsedlogline)
+       private function filter(ParsedLogLine $parsedlogline): bool
        {
                $match = true;
                foreach ($this->filters as $filter => $filtervalue) {
@@ -126,7 +126,7 @@ class ParsedLogIterator implements \Iterator
         * @param ParsedLogLine $parsedlogline
         * @return bool
         */
-       private function search($parsedlogline)
+       private function search(ParsedLogLine $parsedlogline): bool
        {
                if ($this->search != "") {
                        return strstr($parsedlogline->logline, $this->search) !== false;
@@ -156,7 +156,7 @@ class ParsedLogIterator implements \Iterator
        /**
         * Fetch next parsed log line which match with filters or search and
         * set it as current iterator value.
-        * 
+        *
         * @see Iterator::next()
         * @return void
         */
@@ -173,7 +173,7 @@ class ParsedLogIterator implements \Iterator
 
        /**
         * Rewind the iterator to the first matching log line
-        * 
+        *
         * @see Iterator::rewind()
         * @return void
         */
@@ -186,7 +186,7 @@ class ParsedLogIterator implements \Iterator
 
        /**
         * Return current parsed log line number
-        * 
+        *
         * @see Iterator::key()
         * @see ReversedFileReader::key()
         * @return int
@@ -198,7 +198,7 @@ class ParsedLogIterator implements \Iterator
 
        /**
         * Return current iterator value
-        * 
+        *
         * @see Iterator::current()
         * @return ?ParsedLogLing
         */
@@ -209,7 +209,7 @@ class ParsedLogIterator implements \Iterator
 
        /**
         * Checks if current iterator value is valid, that is, not null
-        * 
+        *
         * @see Iterator::valid()
         * @return bool
         */