{@inheritdoc}
@throws \Exception
182878
protected function getValue($event)
    {
        if (!empty($this->owner->{$this->attribute})) {
            return $this->owner->{$this->attribute};
        }
        if ($this->value === null) {
            $uuid = $this->generateUUID();
        } else {
            $uuid = parent::getValue($event);
        }
        return $this->ensureUnique ? $this->makeUnique($uuid) : $uuid;
    }
626599
public function update()
    {
        $args    = func_get_args();
        $order = null;

        if (count($args) == 1 && $args[0] instanceof Order) {
            $order = $args[0];
        } elseif (count($args) == 2 && !empty($args[0]) && is_array($args[1])) {
            $order = $this->find($args[0]);
            $order->fill($args[1]);
        }

        if ($order instanceof Order) {
            if ($this->fireEvent('updating', array($order)) === false) {
                return false;
            }

            $order->setCaller($this);
            $order->save();

            $this->fireEvent('updated', array($order));

            return $order;
        }

        throw new Exception(sprintf(Exception::CANT_UPDATE_MODEL,
            'Subbly\\Model\\Order',
            $this->name()
        ));
    }
1048899
public function addException($exception)
    {
        if ($exception->getMessage()) {
            $this->message .= "\n".$exception->getMessage();
        }

        $this->exceptions[] = $exception;
    }
1288958
public function &__get($key)
    {
        if (array_key_exists($key, $this->_data)) {
            return $this->_data[$key];
        }
        if ($this->_parent !== null) {
            return $this->_parent->__get($key);
        }
        throw new Exception("Undefined variable `{$key}`.");
    }
883544
public function execute($data) {

        try {
            $config = $this->sanitizeConfig($data);
            $this->isConciliate($config);
            if (! $this->doCancel($config))
                throw new \Exception('impossible to cancel.');

            $this->doUpdates($config);
            return true;
        } catch (\Exception $exception) {
            throw $exception;
        }
    }
1197877
public function stopAction(\Exception $exception = null)
    {
        $action = array_pop($this->actionStack);
        $this->lastActionIndex--;
        $action['time'] = microtime(true) - $action['time'] - $action['subtrahend'];
        if (null !== $exception) {
            $action['exception'] = $exception->getMessage();
        }
        unset($action['subtrahend']);
        $this->addSubtrahend($this->actionStack, $action['time']);
        $this->addSubtrahend($this->processorStack, $action['time']);
        $this->actions[] = $action;
        if (empty($this->actionStack) && $this->stopwatch) {
            $this->stopwatch->stop($this->getStopwatchName());
        }
    }
260089
public function setResponse($response)
    {
        if (!$this->is_rest) {
            $this->response->setSecurityHeaders();
        }

        if ($response instanceof View && $this->response_type == 'html' && !$this->is_rest) {
            $this->response->raw($response->render());
        } elseif (($this->is_rest || $this->response_type == 'json' || is_array($response)) ||
            (is_object($response) && !($response instanceof View))
        ) {
            if ($response instanceof View) {
                throw new Exception(
                    translate('Response can not be a instance of cordillera\\middlewares\\View object'),
                    500,
                    Exception::BADARGUMENTS
                );
            }
            $this->response->json($response);
        }
    }
65872
public function init()
    {
        $this->conf = $this->getConfiguration();
        if (!isset($this->conf)) {
            throw new Exception("Adapter configuration not set, cannot initialize");
        }
        $this->adapters = array();
        foreach ($this->conf['adapters'] as $key => $adapter) {
            $adapterConf = ArrayHelper::merge($this->conf['common'], $adapter);

            $adapterConf['paymentHandler'] = $this;
            $adapterConf['adapterTag'] = $key;
            $this->adapters[$key] = \Yii::createObject($adapterConf);
        }
    }
1019073
public function invoke($node, NodeInterface $parent): void
    {
        if (! $node instanceof Node\Stmt\Namespace_ || ! $parent instanceof PhpFileModelInterface) {
            throw new Exception('NamespaceNodeParser is made to parse a namespace node');
        }

        if ($node->name instanceof Node\Name) {
            $parent->setNamespace($node->name->parts);
        }

        $this->preParseUses($node->stmts, $parent);

        $this->parseSubNodes($node->stmts, $parent);
    }
1300087
public function validate($value)
        {
            if (!in_array(gettype($value), $this->types)) {
                throw new Exception('Type of value "'.gettype($value)."' is not compatible with ".get_class($this));
            }
        }
1157785
public function generate()
    {
        if (!$this->iKnowWhatIAmDoing) {
            throw new \Exception('You don\'t know what you\'re doing!');
        }

        $this->cleanUp();

        $schema = $this->getSchema();

        echo "Interfaces generation...\r\n";
        $this->generateInterfaces();

        echo "Class generation...\r\n";
        $this->generateClasses($schema);

        if ($this->backwardCompatibility) {
            $this->php7ClassNames = false;
            $this->generateClasses($schema);
            $this->php7ClassNames = true;
        }
    }
912376
public function create($resource)
    {
        $className = $this->getResourceClassName($resource->type);
        if (!class_exists($className)) {
            throw new Exception(
                'Unknown resource type "' . $resource->type . '".',
                Exception::UNKNOWN_RESOURCE_TYPE
            );
        }

        /** @var AbstractResource $object */
        $object = $this->objectManager->get($className);

        foreach ($resource as $property => $value) {
            if (!ObjectAccess::isPropertySettable($object, $property)) {
                continue;
            }
            ObjectAccess::setProperty($object, $property, $value);
        }

        $this->postProcessResources($object);

        return $object;
    }
18593
public function execute($request): void
    {
        RequestNotSupportedException::assertSupports($this, $request);

        /** @var SyliusPaymentInterface $payment */
        $payment = $request->getModel();

        /** @var OrderInterface $order */
        $order = $payment->getOrder();

        $this->gateway->execute($status = new GetStatus($payment));
        if ($status->isNew()) {
            try {
                $this->gateway->execute($convert = new Convert($payment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            } catch (RequestNotSupportedException $e) {
                $totalAmount = $order->getTotal();
                $payumPayment = new PayumPayment();
                $payumPayment->setNumber($order->getNumber());
                $payumPayment->setTotalAmount($totalAmount);
                $payumPayment->setCurrencyCode($order->getCurrencyCode());
                $payumPayment->setClientEmail($order->getCustomer()->getEmail());
                $payumPayment->setClientId($order->getCustomer()->getId());
                $payumPayment->setDescription($this->paymentDescriptionProvider->getPaymentDescription($payment));
                $payumPayment->setDetails($payment->getDetails());

                $this->gateway->execute($convert = new Convert($payumPayment, 'array', $request->getToken()));
                $payment->setDetails($convert->getResult());
            }
        }

        $details = ArrayObject::ensureArrayObject($payment->getDetails());

        try {
            $request->setModel($details);
            $this->gateway->execute($request);
        } finally {
            $payment->setDetails((array) $details);
        }
    }
1321640
public function compile()
    {
        if($this->compiledExists() === false)
        {
            if(is_file($this->filepath) === false)
            {
                throw new \Exception('File "'.$this->filepath.'" does not exists.');
            }

            $this->raw = file_get_contents($this->filepath);

            if($this->options['add-source-line-numbers'])
                $this->prepared = $this->addLinesNumbers($this->raw);
            else
                $this->prepared = $this->raw;

            $this->removeComments();
            $this->resolveExtending();
            $this->compileRenders();
            $this->compileEchoes();
            $this->compileConditions();
            $this->compileLoops();
            $this->compileSpecialStatements();
            $this->prepareSections();
            $this->findSections();
            $this->replaceSections();
        }
    }
651033
public function offsetGet($key)
    {
        if (!isset($this->keys[$key])) {
            throw new \Exception($key);
        }

        if (
          !is_object($this->values[$key])
          || !method_exists($this->values[$key], '__invoke')
        ) {
            return $this->values[$key];
        }

        $value = $this->values[$key]($this);
        $this->values[$key] = $value;
        return  $value;
    }
941129
public function execute() {
        if(is_null($this->client)) {
            $this->client = $this->getConnection();
        }
        if(is_null($this->query)) {
            throw new Exception('No query');
        }

        list($query_data, $meta) = $this->constructQuery($this->source, $this->query, $this->aggs, $this->post_query, $this->settings);

        $results_set = $this->query($query_data, $meta);
        $results = $this->processResults($results_set, $meta);
        $results = $this->postProcessResults($this->post_query, $results, $meta);

        return $results;
    }
9220
public function extract()
    {
        if (!isset($this->config['sourcePath'], $this->config['languages'])) {
            throw new Exception('The configuration must specify "sourcePath" and "languages".');
        }

        foreach ($this->config['sourcePath'] as $sourcePath) {
            if (!is_dir($sourcePath)) {
                throw new Exception("The source path {$sourcePath} is not a valid directory.");
            }
        }

        if (empty($this->config['format']) || !in_array($this->config['format'], ['php', 'po', 'db'])) {
            throw new Exception('Format should be either "php", "po" or "db".');
        }
        if (in_array($this->config['format'], ['php', 'po'])) {
            if (!isset($this->config['messagePath'])) {
                throw new Exception('The configuration file must specify "messagePath".');
            } elseif (!is_dir($this->config['messagePath'])) {
                throw new Exception("The message path {$this->config['messagePath']} is not a valid directory.");
            }
        }
        if (empty($this->config['languages'])) {
            throw new Exception("Languages cannot be empty.");
        }

        $files = [];
        foreach ( $this->config['sourcePath'] as $sourcePath ) {
            $files = array_merge(
                array_values($files),
                array_values(FileHelper::findFiles(realpath($sourcePath), $this->config))
            );
        }

        $messages = [];
        foreach ($files as $file) {
            $messages = array_merge_recursive($messages, $this->extractMessages($file, $this->config['translator']));
        }
        if (in_array($this->config['format'], ['php', 'po'])) {
            foreach ($this->config['languages'] as $language) {
                $dir = $this->config['messagePath'] . DIRECTORY_SEPARATOR . $language;
                if (!is_dir($dir)) {
                    @mkdir($dir);
                }
                if ($this->config['format'] === 'po') {
                    $catalog = isset($this->config['catalog']) ? $this->config['catalog'] : 'messages';
                    return $this->saveMessagesToPO($messages, $dir, $this->config['overwrite'], $this->config['removeUnused'], $this->config['sort'], $catalog);
                } else {
                    return $this->saveMessagesToPHP($messages, $dir, $this->config['overwrite'], $this->config['removeUnused'], $this->config['sort']);
                }
            }
        } elseif ($this->config['format'] === 'db') {
            $db = \Yii::$app->get(isset($this->config['db']) ? $this->config['db'] : 'db');
            if (!$db instanceof \yii\db\Connection) {
                throw new Exception('The "db" option must refer to a valid database application component.');
            }
            $sourceMessageTable = isset($this->config['sourceMessageTable']) ? $this->config['sourceMessageTable'] : '{{%source_message}}';
            $messageTable = isset($this->config['messageTable']) ? $this->config['messageTable'] : '{{%message}}';
            return $this->saveMessagesToDb(
                $messages,
                $db,
                $sourceMessageTable,
                $messageTable,
                $this->config['removeUnused'],
                $this->config['languages']
            );
        }
    }