@param Invoke\Error $unit

@return Result\AbstractResult
437503
private function handleErrorUnit(Invoke\Error $unit): Result\AbstractResult
    {
        return new Result\Error(null, $unit->getBaseException());
    }
718177
public function validate($value)
    {
        return is_int($value) ? Ok::unit() : Error::unit([ Error::NON_INT ]);
    }
1211451
public function to($unit, $decimals = null, $round = true)
    {
        if (!isset($this->value)) {
            throw new InvalidArgumentException('From value not set');
        }

        if (is_array($unit)) {
            return $this->toMany($unit, $decimals, $round);
        }

        $key = strtolower($unit);

        if (empty($this->units[$key]['base'])) {
            throw new OutOfBoundsException('Unit does not exist');
        }

        if (!isset($this->base_unit)) {
            $this->base_unit = $this->units[$key]['base'];
        }

        if ($this->units[$key]['base'] != $this->base_unit) {
            throw new InvalidArgumentException('Cannot convert between units of different types');
        }

        if (is_callable($this->units[$key]['conversion'])) {
            $result = $this->units[$unit]['conversion']($this->value, true);
        } else {
            $result = $this->value / $this->units[$key]['conversion'];
        }

        if (!isset($decimals)) {
            return $result;
        }

        if ($round) {
            return round($result, $decimals);
        }

        $shifter = $decimals ? pow(10, $decimals) : 1;
        return floor($result * $shifter) / $shifter;
    }
1107783
private function mapUnits($units)
    {
        $imagickUnits = [
            Imagick::RESOLUTION_PIXELSPERCENTIMETER => 'PixelsPerCentimeter',
            Imagick::RESOLUTION_PIXELSPERINCH       => 'PixelsPerInch',
            Imagick::RESOLUTION_UNDEFINED           => 'undefined',
        ];

        if (!isset($imagickUnits[$units])) {
            return $imagickUnits[Imagick::RESOLUTION_UNDEFINED];
        }

        return $imagickUnits[$units];
    }
1225444
public static function formatNumber( $float, $unit = 1, $precision = 0 )
	{
		Deprecation::getInstance()->setExceptionVersion( '0.8' )
			->message(  'Use one of the other methods instead' );
		if( (int) $unit )
		{
			$float	= $float / $unit;
			if( is_int( $precision ) )
				$float	= round( $float, $precision );
		}
		return $float;
	}
580565
public function asError($status = self::INTERNAL_ERROR)
    {
        if ($this->error_views) {
            $stream = $this->error_views->getStream($status);
        } else {
            $stream = null;
        }
        return Response::error($status, $this->data, $stream);
    }
1092205
public function saveUnit(Unit $unit)
    {
        $propelUnit = UnitQuery::create()->findOneByDomainAndKey($unit->getDomain(), $unit->getKey());
        if (!$propelUnit) {
            $propelUnit = new PropelUnit();
        }
        $propelUnit->updateFromModel($unit);
        $propelUnit->save();
    }
561473
public function to($unit)
    {
        $this->value = $this->convert($this->unit, $unit, $this->value);
        $this->unit = $unit;
        return $this;
    }
1139534
protected function unit(&$unit)
    {
        $s = $this->count;

        if ($this->match('([0-9]*(\.)?[0-9]+)([%a-zA-Z]+)?', $m, false)) {
            if (strlen($this->buffer) === $this->count || ! ctype_digit($this->buffer[$this->count])) {
                $this->whitespace();

                $unit = new Node\Number($m[1], empty($m[3]) ? '' : $m[3]);

                return true;
            }

            $this->seek($s);
        }

        return false;
    }
123242
public function getErrors($column = null)
    {
        if (is_null($column)) {
            return $this->errors;
        }

        return isset($this->errors[$column.self::ERROR]) ? $this->errors[$column.self::ERROR] : null;
    }
574351
private static function errorHandler(ContainerInterface $container): ErrorHandlerInterface
    {
        if (!$container->has(ErrorHandlerInterface::class)) {
            return new ErrorHandler();
        }

        return $container->get(ErrorHandlerInterface::class);
    }
985164
public function validate($value)
    {
        return is_string($value) ? Ok::unit() : Error::unit([ Error::NON_STRING ]);
    }
750320
public function error($argument = null)
    {
        if (is_callable($argument)) {
            return parent::error($argument);
        } else {
            if (isset($this->container['response'])) {
                try {
                    return parent::error($argument);
                } catch (\Slim\Exception\Stop $e) {
                    // noop
                }
            } else {
                $this->callErrorHandler($argument);
                // noop
            }
        }
    }
857873
private function mapUnits($units)
    {
        switch ($units) {
            case \Imagick::RESOLUTION_PIXELSPERCENTIMETER:
                return 'PixelsPerCentimeter';
            case \Imagick::RESOLUTION_PIXELSPERINCH:
                return 'PixelsPerInch';
            case \Imagick::RESOLUTION_UNDEFINED:
                return null;
        }
    }
1373858
public function addRealUnit($unit, $value = 1)
    {
        switch ($unit) {
            // @call addRealUnit
            case 'micro':
            // @call addRealUnit
            case 'microsecond':
                /* @var CarbonInterface $this */
                $diff = $this->microsecond + $value;
                $time = $this->getTimestamp();
                $seconds = (int) floor($diff / static::MICROSECONDS_PER_SECOND);
                $time += $seconds;
                $diff -= $seconds * static::MICROSECONDS_PER_SECOND;
                $microtime = str_pad($diff, 6, '0', STR_PAD_LEFT);
                $tz = $this->tz;

                return $this->tz('UTC')->modify("@$time.$microtime")->tz($tz);
            // @call addRealUnit
            case 'milli':
            // @call addRealUnit
            case 'millisecond':
                return $this->addRealUnit('microsecond', $value * static::MICROSECONDS_PER_MILLISECOND);
                break;
            // @call addRealUnit
            case 'second':
                break;
            // @call addRealUnit
            case 'minute':
                $value *= static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'hour':
                $value *= static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'day':
                $value *= static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'week':
                $value *= static::DAYS_PER_WEEK * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'month':
                $value *= 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'quarter':
                $value *= static::MONTHS_PER_QUARTER * 30 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'year':
                $value *= 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'decade':
                $value *= static::YEARS_PER_DECADE * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'century':
                $value *= static::YEARS_PER_CENTURY * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            // @call addRealUnit
            case 'millennium':
                $value *= static::YEARS_PER_MILLENNIUM * 365 * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE;
                break;
            default:
                if ($this->localStrictModeEnabled ?? static::isStrictModeEnabled()) {
                    throw new InvalidArgumentException("Invalid unit for real timestamp add/sub: '$unit'");
                }

                return $this;
        }

        /* @var CarbonInterface $this */
        return $this->setTimestamp($this->getTimestamp() + $value);
    }
536931
public function error($exception)
    {
        $response = new Response();

        // Set the default error response
        $response->setContent('There has been a problem serving this request.');
        $response->headers->set('content-type', 'text/html');
        $response->setStatusCode(Response::HTTP_INTERNAL_SERVER_ERROR);

        // Execute the user defined error callback
        if (is_callable($this->error)) {
            $response = call_user_func($this->error, $response, $exception);
        }

        // Send the response
        $response->send();
    }
1335800
public function unit($invoiceLineHandle, $unit)
    {
        $units      = new Unit($this->client_raw);
        $unitHandle = $units->getHandle($unit);

        $this->client
            ->CurrentInvoiceLine_SetUnit(
                array(
                    'currentInvoiceLineHandle' => $invoiceLineHandle,
                    'valueHandle'              => $unitHandle
                )
            );

        return true;
    }