Issues (6)

src/StreamParser.php (1 issue)

1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: sergio.rodenas
5
 * Date: 12/5/18
6
 * Time: 0:00
7
 */
8
9
namespace Rodenastyle\StreamParser;
10
11
12
use Rodenastyle\StreamParser\Parsers\CSVParser;
13
use Rodenastyle\StreamParser\Parsers\JSONParser;
14
use Rodenastyle\StreamParser\Parsers\XMLParser;
15
use Rodenastyle\StreamParser\Traits\Facade;
16
use Tightenco\Collect\Support\Collection;
17
18
class StreamParser
19
{
20
	use Facade;
21
22
	private function __construct()
23
	{
24
		Collection::macro('recursive', function () {
25 14
			return $this->map(function ($value) {
0 ignored issues
show
The method map() does not exist on Rodenastyle\StreamParser\StreamParser. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

25
			return $this->/** @scrutinizer ignore-call */ map(function ($value) {

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
26 14
				if (is_array($value) || is_object($value)) {
27 14
					return (new Collection($value))->recursive();
28
				}
29 14
				return $value;
30 14
			});
31 25
		});
32 25
	}
33
34 11
	private function xml(String $source){
35 11
		return (new XMLParser())->from($source);
36
	}
37
38 4
	private function json(String $source){
39 4
		return (new JSONParser())->from($source);
40
	}
41
42 10
	private function csv(String $source){
43 10
		return (new CSVParser())->from($source);
44
	}
45
}