Add parameters Kinvey needs to properly process the file.

@param  Guzzle\Common\Event
@return void
176630
public function beforePrepare(Event $event)
	{
		$command = $event['command'];
		$operation = $command->getOperation();
		$client = $command->getClient();

		if ($command->getName() !== 'createEntity') return;
		if ($command['collection'] !== 'files' && $client->getCollectionName() !== 'files') return;

		$file = new File($command['path']);

		$operation->setResponseClass('GovTribe\LaravelKinvey\Client\KinveyFileResponse');

		$operation->addParam(new Parameter(array(
			'name' => 'path',
			'type' => 'string',
			'default' => $command['path'],
		)));

		$operation->addParam(new Parameter(array(
			'name' => '_public',
			'location' => 'json',
			'type' => 'boolean',
			'default' => isset($command['_public']) ? $command['_public'] : false,
		)));

		$operation->addParam(new Parameter(array(
			'name' => '_filename',
			'location' => 'json',
			'type' => 'string',
			'default' => !isset($command['_filename']) ? $file->getBaseName() : $command['_filename'],
		)));

		$operation->addParam(new Parameter(array(
			'name' => 'size',
			'location' => 'json',
			'type' => 'integer',
			'default' => $file->getSize(),
		)));

		$operation->addParam(new Parameter(array(
			'name' => 'mimeType',
			'location' => 'json',
			'type' => 'string',
			'default' => $file->getMimeType(),
		)));
	}
1205514
protected function beforeValidate($event)
    {
        if ($this->autoSave) {
            $this->owner->{$this->uploadAttribute} = $this->getUploadedFile();
        }
    }
969075
public function actionDownload($event)
    {
        $results = $event->object->serve();
        if (!$results || !empty($results['error'])) {
            $errorMessage = isset($results['error']) ? $results['error'] : 'Unknown error';
            throw new HttpException(500, $errorMessage);
        }
        $event->handled = true;
    }
364552
public function onPostAutoloadDump(Event $event) {
    $args = $event->isDevMode() ? '' : ' --no-dev';
    $finder = new ExecutableFinder();
    $hhvm = $finder->find('hhvm', 'hhvm');
    $executor = new ProcessExecutor($this->io);
    $command = $hhvm . ' ' . ProcessExecutor::escape($this->vendor.'/bin/hh-autoload.hack') . $args;
    $executor->execute($command);
  }
1038342
public function beforePrepare(Event $event)
	{
		$command = $event['command'];
		$client = $command->getClient();
		$config =  $client->getConfig();

		// Check if this command requires authentication.
		if ($command->getOperation()->hasParam('appKey'))
		{
			// Inject the Kinvey app key.
			$command['appKey'] = $config->get('appKey');

			// If the command is missing the 'authMode' key, get it from the client.
			if (!$command['authMode'] && !is_null($command->getClient()->getAuthMode()))
			{
				$command['authMode'] = $command->getClient()->getAuthMode();
			}

			if(!$command['authMode']) throw new ValidationException('authMode is required');
			if(!in_array($command['authMode'], $this->authModes)) throw new ValidationException('Invalid authMode : ' . $command['authMode']);

			// Based on the command's authMode', get the correct credentials.
			switch (true)
			{

				// Username and password
				case ($command['authMode'] === 'user'):

					if(!$command['username']) throw new ValidationException('username is required when using the user authMode');
					if(!$command['password']) throw new ValidationException('password is required when using the user authMode');

					$username = $command['username'];
					$password = $command['password'];
					$scheme = 'Basic';
					break;

				// Session tokens
				case ($token = Session::get('kinvey')):
				case ($token = $client->getAuthToken());
				case ($command['authMode'] === 'session'):

					$token = null;

					if ($command['token']) $token = $command['token'];
					if ($client->getAuthToken()) $token = $client->getAuthToken();
					if (Session::get('kinvey')) $token = Session::get('kinvey');

					if(!$token) throw new ValidationException('token is required when using the the session authMode');

					$username = $token;
					$password = null;
					$scheme = 'Kinvey';
					break;

				// App authentication and user sign-up
				case ($command->getOperation()->getName() === 'createEntity' && $command['collection'] === 'user'):
				case ($command['authMode'] === 'app'):

					$username = $config->get('appKey');
					$password = $config->get('appSecret');
					$scheme = 'Basic';
					break;

				// Admin mode
				case ($command['authMode'] === 'admin'):

					$username = $config->get('appKey');
					$password = $config->get('masterSecret');
					$scheme = 'Basic';
					break;
			}

			// Inject the authorization header.
			$command['authHeader'] = $this->getAuthHeader($scheme, $username, $password);
		}
	}
883339
public function after($event = []) {
		$modelDynSchema = ClassRegistry::init('CakeLdap.DynSchema');
		$modelDynSchema->updateSchema($event, $this->connection);
	}
69410
public function onRequestSent(Event $event)
    {
        $request = $event['request'];
        $response = $event['response'];

        if ($request->getParams()->get('cache.hit') === null &&
            $this->canCache->canCacheRequest($request) &&
            $this->canCache->canCacheResponse($response)
        ) {
            $this->storage->cache($request, $response);
        }

        $this->addResponseHeaders($request, $response);
    }
479954
public function beforePrepare(Event $event)
	{
		$command = $event['command'];
		$operation = $command->getOperation();

		if ($command->getName() !== 'updateEntity' && $command->offsetExists('_id') === true) return;

		$operation->addParam(new Parameter(array(
			'name' => 'body_id',
			'location' => 'json',
			'type' => 'string',
			'default' => $command->offsetGet('_id'),
			'static' => true,
			'sentAs' => '_id'
		)));
	}
1138897
public function onKernelRequest(GetResponseEvent $event): void
    {
        if (!$event->isMasterRequest()) {
            return;
        }

        $request = $event->getRequest();
        $attributes = $request->attributes;
        if ($attributes->get(SetIsApiRequestListener::API_FLAG_NAME) !== true) {
            return;
        }

        if (!$attributes->has('itemType')) {
            return;
        }

        $config = $this->loadConfig($attributes->get('itemType'));

        $customParams = $request->query->get('customParams', []);
        if (!is_array($customParams)) {
            throw new RuntimeException(
                sprintf(
                    'Invalid custom parameters specification for "%s" item type.',
                    $attributes->get('itemType')
                )
            );
        }

        $config->addParameters($customParams);

        $configLoadEvent = new ConfigLoadEvent($config);

        Kernel::VERSION_ID >= 40300 ?
            $this->eventDispatcher->dispatch($configLoadEvent, ContentBrowserEvents::CONFIG_LOAD) :
            $this->eventDispatcher->dispatch(ContentBrowserEvents::CONFIG_LOAD, $configLoadEvent);

        $this->container->set('netgen_content_browser.current_config', $config);
    }
278058
public function onLoad(LoadFileEvent $event)
    {
        $event->setData([
            'isHtml' => 'text/html' === $event->getResource()->getMimeType(),
            'content' => utf8_encode(file_get_contents($event->getPath())),
        ]);

        $event->stopPropagation();
    }
1166423
public function operation($event){
        if ($event->name == UploadImg::EVENT_AFTER_VALIDATE
            && empty($this->owner->imageFile)){
            return;
        }
        if(!$this->createTool()){
            return;
        }
        if(
            $this->owner->isthumb&&
            $this->operate==self::IMG_THUMB){
            $this->thumbImg();
        }
        if(
            $this->owner->iswater&&
            $this->operate==self::IMG_WATER){
            $this->waterImg();
        }
    }
645376
public function onCommandBeforePrepare(Event $event) {
        /** @var Command $command */
        $command = $event['command'];
        if (in_array($command->getName(), $this->commands)) {
            // Get the interesting parameters
            $source = $command->get($this->sourceParameter);
            $body = $command->get($this->bodyParameter);

            // If a file path is passed in then get the file handle
            if (is_string($source) && file_exists($source)) {
                $body = fopen($source, 'rb');
            }

            // Prepare the body parameter and remove the source file parameter
            if (null !== $body) {
                $command->remove($this->sourceParameter);
                $command->set($this->bodyParameter, EntityBody::factory($body));
            } else {
                throw new InvalidArgumentException(
                        "You must specify a non-null value for the {$this->bodyParameter} or {$this->sourceParameter} parameters.");
            }
        }
    }
211559
protected function attachRows($event)
    {
        if (\is_array($event->component->rows)) {
            foreach ($event->component->rows as $row) {
                if (isset($row->modelParent, $row->modelChild)) {
                    $add_params = ['model_parent' => $row->modelParent, 'model_child' => $row->modelChild];

                    if ($event->request->has($row->name)) {
                        if (\is_array($event->request->get($row->name))) {
                            foreach ($event->request->get($row->name) as $value) {
                                $params[$value] = $add_params;
                            }
                            if (isset($params)) {
                                $event->model->getLink($row->modelChild)->sync($params);
                            }
                        } elseif (! \is_object($event->request->get($row->name))) {
                            $params[$event->request->get($row->name)] = $add_params;
                            $event->model->getLink($row->modelChild)->sync($params);
                        }
                    }
                }
            }
        }
    }
1294791
def add_event(self, event, prepend=False):
        
        if prepend:
            self._events.insert(0, event)
        else:
            self._events.append(event)
806351
public function buildFromEvent(Event $event)
    {
        $this->setEvent($event);

        $configs = $this->getConfigFilesByComposer();
        $this->addFindersByConfigs($configs);

        // We have to initialize composer autoload
        require_once 'vendor/autoload.php';

        $this->build();
    }
1115665
public function addRequestAttributes(FilterViewBuilderParametersEvent $event)
    {
        $request = $event->getRequest();

        if (!$this->isAdmin($request)) {
            return;
        }

        $parameterBag = $event->getParameters();

        if ($parameterBag->has('locationId') && null !== $parameterBag->get('locationId')) {
            $location = $this->loadLocation($parameterBag->get('locationId'));
            $parameterBag->set('location', $location);
        }

        if ($this->hasContentLanguage($request, $parameterBag)) {
            /** @var Location $location */
            $location = $parameterBag->get('location');

            $languageCode = $parameterBag->get('languageCode') ?? $location->contentInfo->mainLanguageCode;

            $content = $this->loadContent($location->contentInfo->id, $languageCode);
            $parameterBag->set('content', $content);
        }
    }
884812
public static function postInstall(Event $event): void
    {
        require_once $event->getComposer()->getConfig()->get('vendor-dir').'/autoload.php';

        self::clearCompiled();
    }