• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eiriksm / finn-transfer-sdk / 7205895344

14 Dec 2023 07:44AM UTC coverage: 70.48%. Remained the same
7205895344

push

github

web-flow
Resolved issue with undefined stream_for (#14)

0 of 1 new or added line in 1 file covered. (0.0%)

499 of 708 relevant lines covered (70.48%)

2.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Client.php
1
<?php
2

3
namespace eiriksm\FinnTransfer;
4

5
use GuzzleHttp\Psr7\MultipartStream;
6
use GuzzleHttp\Psr7\Request;
7
use GuzzleHttp\Psr7\Utils;
8

9
class Client implements ClientInterface
10
{
11

12
  /**
13
   * @return bool
14
   */
15
    public function isZip()
16
    {
17
        return $this->isZip;
×
18
    }
19

20
  /**
21
   * @param bool $isZip
22
   */
23
    public function setIsZip($isZip)
24
    {
25
        $this->isZip = $isZip;
×
26
    }
27

28
    const PROD_URL = 'https://www.finn.no/finn/import/fileimport';
29

30
    protected $url = 'https://import.finn.no/finn/import/fileimport';
31

32
    private $isZip = false;
33

34
  /**
35
   * @return string
36
   */
37
    public function getRequestBody()
38
    {
39
        return $this->requestBody;
×
40
    }
41

42
  /**
43
   * @var string
44
   */
45
    private $requestBody;
46

47
  /**
48
   * @var Request
49
   */
50
    protected $request;
51

52
    public function setLiveMode()
53
    {
54
        $this->url = self::PROD_URL;
×
55
    }
56

57
  /**
58
   * @param string $url
59
   */
60
    public function setUrl($url)
61
    {
62
        $this->url = $url;
×
63
    }
64

65
  /**
66
   * @var \GuzzleHttp\Client
67
   */
68
    protected $client;
69

70
  /**
71
   * @return \eiriksm\FinnTransfer\Client
72
   */
73
    public function getClient()
74
    {
75
        return $this->client;
×
76
    }
77

78
  /**
79
   * @param mixed $client
80
   */
81
    public function setClient($client)
82
    {
83
        $this->client = $client;
×
84
    }
85

86
  /**
87
   * Send something.
88
   *
89
   * @param string $body
90
   *
91
   * @return mixed|\Psr\Http\Message\ResponseInterface
92
   */
93
    public function transfer($body, $type = 'xml')
94
    {
NEW
95
        $post_body = Utils::streamFor($body);
×
96
        $multipart = new MultipartStream([
×
97
        [
×
98
        'name' => 'fil',
×
99
        'contents' => $post_body,
×
100
        'filename' => "file.$type"
×
101
        ]
×
102
        ]);
×
103
        $this->request = new Request('POST', $this->url, [], $multipart);
×
104
        if (!$this->isZip) {
×
105
            $this->requestBody = $body;
×
106
        }
107
        $res = $this->client->send($this->request);
×
108
        return $res;
×
109
    }
110

111
  /**
112
   * @param string $requestBody
113
   */
114
    public function setRequestBody($requestBody)
115
    {
116
        $this->requestBody = $requestBody;
×
117
    }
118

119
  /**
120
   * @return \GuzzleHttp\Psr7\Request
121
   */
122
    public function getRequest()
123
    {
124
        return $this->request;
×
125
    }
126
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc