Created
February 9, 2017 14:31
-
-
Save adampiotrowski/f68dfa5707e427774226e7b00dacecfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace RedIsBad\Bundle\AppBundle\Provider; | |
| use WellCommerce\Bundle\CoreBundle\DependencyInjection\AbstractContainerAware; | |
| use WellCommerce\Bundle\ShippingBundle\Provider\ShippingMethodOptionsProviderInterface; | |
| /** | |
| * Class InpostOptionsProvider | |
| * | |
| * @package RedIsBad\Bundle\AppBundle | |
| */ | |
| class InpostOptionsProvider extends AbstractContainerAware implements ShippingMethodOptionsProviderInterface | |
| { | |
| public function getShippingOptions() : array | |
| { | |
| $cacheDir = $this->getKernel()->getCacheDir(); | |
| $user = $this->container->getParameter('inpost_user'); | |
| $pass = $this->container->getParameter('inpost_pass'); | |
| $client = new InpostClient($user, $pass, $cacheDir); | |
| $paczkomaty = $client->inpost_get_machine_list(); | |
| $tmp = ['' => '--- wybierz ---']; | |
| foreach ($paczkomaty as $paczkomat) { | |
| $tmp[$paczkomat['name']] = sprintf( | |
| '%s - %s %s %s', | |
| $paczkomat['name'], | |
| $paczkomat['town'], | |
| $paczkomat['street'], | |
| $paczkomat['buildingnumber'] | |
| ); | |
| } | |
| return $tmp; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment