Transforms a string (number) to an object (issue).

@param string $number

@return object|array|null

@throws TransformationFailedException if object (issue) is not found.
16504
public function reverseTransform($key)
    {
        if (!$key) {
            return;
        }

        if ($this->multiple) {
            $keys = explode($this->glue, $key);
            $items = $this->om
                ->getRepository($this->class)
                ->findBy(array($this->primaryKey => $keys))
            ;

            if (count($keys) != count($items)) {
                throw new TransformationFailedException(sprintf("Can't find all items in %s this keys", $key));
            }

            return $items;
        }

        $item = $this->om
            ->getRepository($this->class)
            ->findOneBy(array($this->primaryKey => $key))
        ;

        if (null === $item) {
            throw new TransformationFailedException(sprintf("Can't find the %s item", $key));
        }

        return $item;
    }
1038668
public function transform($string)
    {
        foreach ($this->collection->getTransformers() as $transformer) {
            $string = $transformer->transform($string);
        }
        return $string;
    }
594110
public function transform($value): ?int
    {
        if (null === $value) {
            return null;
        }

        if (!$value instanceof Content) {
            throw new TransformationFailedException('Expected a ' . Content::class . ' object.');
        }

        return $value->id;
    }
1093484
public function reverseTransform($value)
    {
        if (empty($value)) {
            return null;
        }

        if (!is_numeric($value)) {
            throw new TransformationFailedException(
                sprintf('Expected a numeric, got %s instead', gettype($value))
            );
        }

        return Value::fromTimestamp($value);
    }
335989
public function transform($value)
    {
        if (null === $value) {
            return '';
        } elseif ($value instanceof Collection) {
            $values = $value->toArray();
        } elseif (is_array($value)) {
            $values = $value;
        } else {
            throw new TransformationFailedException('TagTransformer expects to transform an array or Collection value');
        }

        $propertyAccessor = $this->propertyAccessor;
        $property = $this->property;
        $values = array_map(function ($value) use ($propertyAccessor, $property) {
            return $propertyAccessor->getValue($value, $property);
        }, $values);

        return implode(',', $values);
    }
470741
public static function fromFloat($number)
    {
        if (is_float($number) === false) {
            throw new \InvalidArgumentException('Floating point value expected');
        }

        return self::fromString(sprintf('%.14F', $number));
    }
628303
public function transformToWords($number, $locale)
    {
        $localeClassName = $this->resolveLocaleClassName($locale);
        $transformer = new $localeClassName();

        return trim($transformer->toWords($number));
    }
30113
public function transform($value)
    {
        if ($value === null || $value == '') {
            return null;
        }
        if (!($value instanceof Page)) {
            throw new TransformationFailedException('Expected an instance of a concrete5 page object.');
        }
        return intval($value->getCollectionID());
    }
242049
public function revokeNumberAsyncWithHttpInfo($number)
    {
        $returnType = '';
        $request = $this->revokeNumberRequest($number);

        return $this->client
            ->sendAsync($request, $this->createHttpClientOption())
            ->then(
                function ($response) use ($returnType) {
                    return [null, $response->getStatusCode(), $response->getHeaders()];
                },
                function ($exception) {
                    $response = $exception->getResponse();
                    $statusCode = $response->getStatusCode();
                    throw new ApiException(
                        sprintf(
                            '[%d] Error connecting to the API (%s)',
                            $statusCode,
                            $exception->getRequest()->getUri()
                        ),
                        $statusCode,
                        $response->getHeaders(),
                        $response->getBody()
                    );
                }
            );
    }
1257033
private function initFromString($number)
    {
        if (!preg_match("/^(?<sign>[-+])?(?<integerPart>\d+)(?:\.(?<fractionalPart>\d+))?$/", $number, $parts)) {
            throw new \InvalidArgumentException(
                sprintf('"%s" cannot be interpreted as a number', print_r($number, true))
            );
        }

        $this->isNegative = ('-' === $parts['sign']);

        // extract the integer part and remove leading zeroes and plus sign
        $integerPart = ltrim($parts['integerPart'], '0');

        $fractionalPart = '';
        if (array_key_exists('fractionalPart', $parts)) {
            // extract the fractional part and remove trailing zeroes
            $fractionalPart = rtrim($parts['fractionalPart'], '0');
        }

        $this->exponent = strlen($fractionalPart);
        $this->coefficient = $integerPart . $fractionalPart;

        // when coefficient is '0' or a sequence of '0'
        if ('' === $this->coefficient) {
            $this->coefficient = '0';
        }
    }
884117
public function reverseTransform($value)
    {
        if (\in_array($value, $this->falseValues, true)) {
            return false;
        }

        if (!\is_string($value)) {
            throw new TransformationFailedException('Expected a string.');
        }

        return true;
    }
308585
public function transform($value)
    {
        if (null !== $value && 1 !== $this->divisor) {
            if (!is_numeric($value)) {
                throw new TransformationFailedException('Expected a numeric.');
            }
            $value /= $this->divisor;
        }

        return parent::transform($value);
    }
256319
public function format($number) {
        if (!($this->numberParsed instanceof \libphonenumber\PhoneNumber)) {
            throw new \RuntimeException(__CLASS__ . '::format() method must be called after '.__CLASS__.'::isValid()');
        }

        $retVal = $this->instance->format($this->numberParsed, \libphonenumber\PhoneNumberFormat::E164);
        
        // remove + sign
        return substr($retVal, 1);
    }
434036
public function reverseTransform($value)
    {
        if (!$value) {
            return null;
        }

        if (!is_string($value)) {
            throw new TransformationFailedException('Expected a string.');
        }

        if (!$value || !$this->parseUrl($value)) {
            throw new TransformationFailedException('Empty or invalid string.');
        }

        $video = $this->videoManager->findByVideoId($this->videoId);

        if (!$video) {
            $video = $this->videoManager->createVideo();

            $video->setVideoId($this->videoId);
            $video->setType($this->videoType);
            $video->setUrl($value);
        }

        return $video;
    }
20306
public function transform($value)
    {
        if (null !== $value && !is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        if ('' === $value || null === $value) {
            return null;
        }

        return [$value];
    }
778597
public function reverseTransform($value)
    {
        if (!is_scalar($value)) {
            throw new TransformationFailedException('Expected a scalar.');
        }

        if ('' === $value) {
            return null;
        }

        $result = $value;

        if (!is_numeric($result)) {
            throw new TransformationFailedException('Value is not numeric.');
        }

        if (\is_string($result)) {
            if (false !== mb_strpos($result, '.')) {
                $result = (float) $result;
            } else {
                $result = (int) $result;
            }
        }

        if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) {
            throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like.');
        }

        return $this->round($result);
    }
485730
public static function fromString($number)
    {
        $decimalSeparatorPosition = strpos($number, '.');
        if ($decimalSeparatorPosition === false) {
            return new self($number, '');
        }

        return new self(
            substr($number, 0, $decimalSeparatorPosition),
            rtrim(substr($number, $decimalSeparatorPosition + 1), '0')
        );
    }