@param array $trailer

@return bool
@throws \Exception
355034
protected function processarTrailer(array $trailer)
    {
        $this->getTrailer()
            ->setQuantidadeTitulos((int) $this->rem(164, 171, $trailer))
            ->setQuantidadeEntradas((int) $this->totais['entradas'])
            ->setQuantidadeLiquidados((int) $this->totais['liquidados'])
            ->setQuantidadeBaixados((int) $this->totais['baixados'])
            ->setQuantidadeAlterados((int) $this->totais['alterados']);

        return true;
    }
646465
final public function sort(array $attributes = array())
    {
        $productImage   = $this->find($attributes['movingId']);
        $positionEntity = $this->find($attributes['movedId']);

        if ($productImage instanceof ProductImage) {
            if ($this->fireEvent('sorting', array($productImage)) === false) {
                return false;
            }

            $productImage->setCaller($this);
            $productImage->{$attributes['type']}($positionEntity);

            $this->fireEvent('sorted', array($productImage));

            return $productImage;
        }

        throw new Exception(sprintf(Exception::CANT_UPDATE_MODEL,
            'Subbly\\Model\\Product',
            $this->name()
        ));
    }
337165
protected function _checkManifestIsValid( $location, array $manifest )
	{
		if ( isset( $this->_extensions[$manifest['name']] ) ) {
			$location2 = $this->_extensions[$manifest['name']]['location'];
			$msg = 'Extension "%1$s" exists twice in "%2$s" and in "%3$s"';
			throw new Exception( sprintf( $msg, $manifest['name'], $location, $location2 ) );
		}

		if ( !isset( $manifest['depends'] ) || !is_array( $manifest['depends'] ) ) {
			throw new Exception( sprintf( 'Incorrect dependency configuration in manifest "%1$s"', $location ) );
		}
	}
716007
public function demoteTo($role)
    {
        $transaction = static::getDb()->beginTransaction();
        try {
            $this->scenario = 'role';
            $this->role = $role;
            if (!$this->save()) {
                throw new Exception('User saving error!');
            }
            if (Podium::getInstance()->rbac->getRolesByUser($this->id)
                && !Podium::getInstance()->rbac->revoke(Podium::getInstance()->rbac->getRole(Rbac::ROLE_MODERATOR), $this->id)) {
                throw new Exception('User role revoking error!');
            }
            if (!Podium::getInstance()->rbac->assign(Podium::getInstance()->rbac->getRole(Rbac::ROLE_USER), $this->id)) {
                throw new Exception('User role assigning error!');
            }
            if ((new Query())->from(Mod::tableName())->where(['user_id' => $this->id])->exists()
                && !Podium::getInstance()->db->createCommand()->delete(Mod::tableName(), ['user_id' => $this->id])->execute()) {
                throw new Exception('Moderator deleting error!');
            }
            Activity::updateRole($this->id, User::ROLE_MEMBER);

            $transaction->commit();
            Log::info('User demoted', $this->id, __METHOD__);
            return true;
        } catch (Exception $e) {
            $transaction->rollBack();
            Log::error($e->getMessage(), null, __METHOD__);
        }
        return false;
    }
934449
public function events($app = NULL)
    {
        try {

            if (is_null($app))
                throw new Exception("App name is not provided or is null", 503);

            $uri = "/events";
            $getObj = array('app' => $app);

            $result = $this->pestObject->get($uri, $getObj);
            return $result;


        } catch (Exception $e) {
            $this->phpariObject->lasterror = $e->getMessage();
            $this->phpariObject->lasttrace = $e->getTraceAsString();
            return false;
        }
    }
1300127
protected function validateMove($pos)
	{
		if ($this->getLeftValue() <= $pos && $this->getRightValue() >= $pos) {
			
			return false;
//			$dump = static::dump($this);
//			throw new Exception\InvalidOperation("The move not allowed for {$dump} to position $pos");
		}
		
		return true;
	}
1122916
public function check(array $config): bool
    {
        try {
            if (Arr::get($config, 'default_connection', true)) {
                DB::connection()->getPdo();
            }

            foreach (Arr::get($config, 'connections', []) as $connection) {
                DB::connection($connection)->getPdo();
            }

            return true;
        } catch (\Exception $e) {
            $this->message = $e->getMessage();
        }
        return false;
    }
1133405
public function checkResponse($response) {
    if (!is_array($response)) {
      return FALSE;
    }

    $responseParams = array();
    foreach ($this->responseFields as $k => $mandatory) {
      if (isset($response[$k])) {
        $responseParams[$k] = $response[$k];
      }
      elseif (!isset($response[$k]) && $mandatory) {
        throw new \Exception('expected response field ' . $k . ' is missing');
      }
    }

    return $responseParams;
  }
8297
public function isOne($role)
    {
        foreach ($this->getArrayFrom($role) as $role) {
            if ($this->hasRole($role)) {
                return true;
            }
        }

        return false;
    }
498734
protected function load( $component, $args = [] ) {
		$args = (array) $args;

		if ( ! property_exists( $this, $component ) ) {
			return false;
		}

		$class = $this->$component;

		if ( ! is_string( $class ) ) {
			return false;
		}
		if ( ! class_exists( $class ) ) {
			throw new \Exception( sprintf( 'Can not find class "%s" for Component "%s" in parent Component "%s"', $class, $component, __CLASS__ ) );
		}
		$this->$component = $this->container->create( $class, $args );

		return true;
	}
594375
protected function checkManifest(array $manifest)
    {
        $requiredFields = array(
            'name',
            'version',
        );

        foreach ($requiredFields as $fieldName) {
            if (empty($manifest[$fieldName])) {
                return false;
            }
        }

        return true;
    }
1364089
public function setPostfields(array $array)
	{
		if (!is_null($this->getGetfield()))
		{
			throw new \Exception('You can only choose get OR post fields (post fields include put).');
		}
		if (isset($array['status']) && substr($array['status'], 0, 1) === '@')
		{
			$array['status'] = sprintf("\0%s", $array['status']);
		}
		foreach ($array as $key => &$value)
		{
			if (is_bool($value))
			{
				$value = ($value === true) ? 'true' : 'false';
			}
		}
		$this->postfields = $array;
		// rebuild oAuth
		if (isset($this->oauth['oauth_signature']))
		{
			$this->buildOauth($this->url, $this->requestMethod);
		}
		return $this;
	}
1051556
public function checkBefore($date, $latest)
    {
        try {
            return $this->toTimestamp($date) < $this->toTimestamp($latest);
        } catch (InvalidArgumentException $e) {
            return false;
        }
    }
616021
static public function sendException($exception, $description = ''){
		if (!sfConfig::get('app_amg_sentry_enabled', false)) {
			return true;
		}
		return self::getInstance()->captureException($exception, $description);
	}
561319
private function validateTwigTemplate($template)
    {
        $loader = $this->twig->getLoader();
        if (!$loader->exists($template)) {
            throw new \Exception(sprintf(
                'Unable to find template "%s".',
                $template
            ));
        }
    }
1221998
public static function autocreate_directory($directory)
    {
        if (!file_exists($directory)) {
            mkdir($directory, 0777, true);
        }

        if (!is_writable($directory)) {
            throw new \Exception("Directory \"{$directory}\" is not writable");
        }
    }
469341
public function create($options = [])
    {
        $capsule = $this->_database->getCapsule();
        if (empty($options) || !is_array($options)) {
            throw new \Exception('Create options must not be empty and must be an instance of an array!');
        }

        // filter out options not given in fillable array
        $this->filter($options);

        $options['created_at'] = date('Y-m-d h:i:s');
        $options['updated_at'] = $options['created_at'];

        if ($capsule->table($this->table)->insert($options)) {
            return true;
        } else {
            return false;
        }
    }