Code Duplication    Length = 16-16 lines in 3 locations

src/Smsa.php 3 locations

@@ 78-93 (lines=16) @@
75
     *
76
     * @return SMSAResponse with array of cities with their route code.
77
     */
78
    public function cities(): SMSAResponse
79
    {
80
        $result = $this->service->getRTLCities(
81
            $payload = new GetRTLCities($this->passKey)
82
        );
83
84
        if (false === $result) {
85
            return $this->failedRequest('getRTLCities', $payload);
86
        }
87
88
        return $this->successResponse(
89
            'getRTLCities',
90
            $payload,
91
            $this->parseCityResult($result->getGetRTLCitiesResult()->getAny())
92
        );
93
    }
94
95
    /**
96
     * Fetch all retails in a particular city.
@@ 106-121 (lines=16) @@
103
     *
104
     * @return SMSAResponse with array of retails in given city.
105
     */
106
    public function retailsIn($cityCode): SMSAResponse
107
    {
108
        $result = $this->service->getRTLRetails(
109
            $payload = new GetRTLRetails($cityCode, $this->passKey)
110
        );
111
112
        if (false === $result) {
113
            return $this->failedRequest('getRTLCities', $payload);
114
        }
115
116
        return $this->successResponse(
117
            'getRTLCities',
118
            $payload,
119
            $this->parseRetailsResult($result->getGetRTLRetailsResult()->getAny())
120
        );
121
    }
122
123
    /**
124
     * Fetch all Smsa Express retails
@@ 130-145 (lines=16) @@
127
     *
128
     * @return SMSAResponse with list of all retails with details
129
     */
130
    public function retails(): SMSAResponse
131
    {
132
        $result = $this->service->getAllRetails(
133
            $payload = new GetAllRetails($this->passKey)
134
        );
135
136
        if (false === $result) {
137
            return $this->failedRequest('getAllRetails', $payload);
138
        }
139
140
        return $this->successResponse(
141
            'getAllRetails',
142
            $payload,
143
            $this->parseRetailsResult($result->getGetAllRetailsResult()->getAny())
144
        );
145
    }
146
147
    /**
148
     * Track a shipment by its awb