Skip to content

Commit

Permalink
bug #9998 Improve the ShippingBundle doc (Konafets)
Browse files Browse the repository at this point in the history
This PR was merged into the 1.2 branch.

Discussion
----------

| Q               | A
| --------------- | -----
| Branch?         | 1.3
| Bug fix?        | no
| New feature?    | no
| BC breaks?      | no
| Deprecations?   | no
| License         | MIT

* Implement the methods
* Add setters
* Fix the getter call

Commits
-------

20c4847 Improve the text
ff50446 Add type hints
  • Loading branch information
pamil authored Dec 12, 2018
2 parents 280bdc5 + ff50446 commit c59941b
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions docs/components_and_bundles/components/Shipping/basic_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ In all examples is used an exemplary class implementing **ShippableInterface**,
<?php
declare(strict_types=1);
use Sylius\Component\Shipping\Model\ShippableInterface;
use Sylius\Component\Shipping\Model\ShippingCategoryInterface;
Expand All @@ -20,96 +22,121 @@ In all examples is used an exemplary class implementing **ShippableInterface**,
private $category;
/**
* @var int
* @var float
*/
private $weight;
/**
* @var int
* @var float
*/
private $volume;
/**
* @var int
* @var float
*/
private $width;
/**
* @var int
* @var float
*/
private $height;
/**
* @var int
* @var float
*/
private $depth;
/**
* {@inheritdoc}
*/
public function getShippingWeight()
public function getShippingWeight(): float
{
return $this->weight;
}
/**
* @param int $weight
* {@inheritdoc}
*/
public function setShippingWeight($weight)
public function setShippingWeight(float $weight): void
{
$this->weight = $weight;
}
/**
* {@inheritdoc}
*/
public function getShippingVolume()
public function getShippingVolume(): float
{
return $this->volume;
}
/**
* @param int $volume
*/
public function setShippingVolume($volume)
public function setShippingVolume(float $volume)
{
$this->volume = $volume;
}
/**
* {@inheritdoc}
*/
public function getShippingWidth()
public function getShippingWidth(): float
{
// TODO: Implement getShippingWidth() method.
return $this->width;
}
/**
* {@inheritdoc}
*/
public function getShippingHeight()
public function setShippingWidth(float $width)
{
// TODO: Implement getShippingHeight() method.
$this->width = $width;
}
/**
* {@inheritdoc}
*/
public function getShippingDepth()
public function getShippingHeight(): float
{
// TODO: Implement getShippingDepth() method.
return $this->height;
}
/**
* {@inheritdoc}
*/
public function getShippingCategory()
public function setShippingHeight(float $height)
{
$this->height = $height;
}
/**
* {@inheritdoc}
*/
public function getShippingDepth(): float
{
return $this->depth;
}
/**
* {@inheritdoc}
*/
public function setShippingDepth(float $depth)
{
$this->depth = $depth;
}
/**
* {@inheritdoc}
*/
public function getShippingCategory(): ShippingCategoryInterface
{
return $this->category;
}
/**
* @param ShippingCategoryInterface $category
* {@inheritdoc}
*/
public function setShippingCategory(ShippingCategoryInterface $category)
{
Expand All @@ -126,7 +153,7 @@ methods respectively. The name is mutable, so you can change them by calling and
Shipping Method
---------------

Every shipping method has three identifiers, an ID code and name. You can access those by calling ``->getId()``, ``->gerCode()`` and ``->getName()``
Every shipping method has three identifiers, an ID code and name. You can access those by calling ``->getId()``, ``->getCode()`` and ``->getName()``
methods respectively. The name is mutable, so you can change them by calling ``->setName('FedEx')`` on the shipping method instance.

Setting Shipping Category
Expand Down Expand Up @@ -154,8 +181,7 @@ Every shipping method can have shipping category. You can simply set or unset it
Shipping Method Translation
---------------------------

**ShippingMethodTranslation** allows shipping method's name translation according to given locales. To see how to use translation
please go to :ref:`component_resource_translations_usage`.
**ShippingMethodTranslation** allows shipping method's name translation according to given locales. To see how to use translation please go to :ref:`component_resource_translations_usage`.


Shipment Item
Expand Down

0 comments on commit c59941b

Please sign in to comment.