Load events

@param array $events
504492
protected function loadEvents(array $events = array())
    {
        foreach ($events as $event) {
            $method = 'set'.$event['type'].'s';
            $this->$method($event);
        }
    }
875359
public function loadEvent($name)
    {
        // 1. Load event data only once
        if (isset($this->loadedEvents[$name])) {
            return;
        }
        $this->loadedEvents[$name] = true;

        // 2. Get event handlers
        $events = $this->getEvents();
        if (!isset($events[$name])) {
            return;
        }

        // 3. Attach handlers to event
        $baseMethod = 'on' . ucfirst($name);
        foreach ($events[$name] as $priority => $pluginIds) {
            if ($priority && $priority != static::DEFAULT_PRIORITY) {
                $method = $baseMethod . $priority;
            } else {
                $method = $baseMethod;
            }

            foreach ($pluginIds as $pluginId) {
                $plugin = $this->getById($pluginId);
                if (method_exists($plugin, $method)) {
                    $this->event->on($name, [$plugin, $method], $priority);
                }
            }
        }
    }
531077
private static function addEventCallbacks(array $events = [])
    {
        $hooks = ['before' => 'ing', 'after' => 'ed'];

        foreach ($events as $event)
        {
            foreach ($hooks as $hook => $suffix)
            {
                $method = $hook . ucfirst($event) . 'e';
                $callback = $event . $suffix;

                self::addObservableEvent($method, $callback);
            }
        }
    }
1154853
public function hasMany(array $events)
    {
        foreach ($events as $event) {
            if (!$this->has($event)) {
                return false;
            }
        }

        return true;
    }
503591
public void setEvents(java.util.Collection<Event> events) {
        if (events == null) {
            this.events = null;
            return;
        }

        this.events = new java.util.ArrayList<Event>(events);
    }
252018
public function loadFromArray(array $entries)
     {
         foreach ($entries as $var=>$val) {
             switch ($var) {
                case 'name': $this->setName($val); break;
                case 'version': $this->setVersion($val); break;
                case 'relative_path': $this->setRelativePath($val); break;
                case 'assets_path':
                case 'path':
                    $this->setAssetsPath($val); break;
                case 'assets_presets': $this->setAssetsPresets($val); break;
                case 'layouts_path': $this->setLayoutsPaths(is_array($val) ? $val : array($val), null); break;
                case 'views_path': $this->setViewsPaths(is_array($val) ? $val : array($val), null); break;
                case 'views_functions': $this->setViewsFunctionsPaths(is_array($val) ? $val : array($val), null); break;
            }
         }
         return $this;
     }
517000
public function load($arr) {
        foreach($arr as $key=>$value) {
            if(array_key_exists($key, self::$KEYS)) {
                if($this->valid(self::$KEYS[$key], $value)) {
                    $this->$key = $value;
                }
            }
        }
    }
1313991
public function doesntExpectEvents($events)
    {
        $events = is_array($events) ? $events : func_get_args();

        $this->withoutEvents();

        $this->beforeApplicationDestroyed(function () use ($events) {
            $this->assertEmpty(
                $fired = $this->getFiredEvents($events),
                'These unexpected events were fired: ['.implode(', ', $fired).']'
            );
        });

        return $this;
    }
759159
public function setEventClasses($events)
    {
        foreach ($events as $iface => $cls) {
            $this->setEventClass($iface, $cls);
        }
    }
1274844
public function registerEvents($events)
    {
        if (empty($events)) {
            throw new \RuntimeException(sprintf('Empty argument passed %s', __FUNCTION__));
        }

        foreach ($events as $event => $namespace) {
            $parts = explode('@', $namespace);
            // attach all before and after event to handler
            $this->register("$event.before", $parts[0].'@before'.ucfirst(Inflector::pathAction(end($parts))))
                 ->register("$event", $parts[0].'@'.Inflector::pathAction(end($parts)))
                 ->register("$event.after", $parts[0].'@after'.ucfirst(Inflector::pathAction(end($parts))));
        }
    }
1150391
protected function loadHooks(array $services)
    {
        foreach ($services as $service => $value) {
            if (!isset($value[ 'hooks' ])) {
                continue;
            }
            foreach ($value[ 'hooks' ] as $key => $hook) {
                $this->hooks[ $key ][ $service ] = $hook;
            }
        }
    }
651958
private function populateTaskEvents(array &$process)
    {
        foreach ($process['tasks'] as &$task) {
            $task['events'] = [];
            foreach ($process['events'] as $event) {
                if ($event['task_id'] == $task['id']) {
                    $task['events'][] = $event;
                }
            }
        }
    }
548176
public function load(LoadResourceEvent $event)
    {
        $event->setData([
            'text' => $this->serializer->serialize($event->getResource()),
        ]);

        $event->stopPropagation();
    }
362051
public function dispatch(array $events)
    {
        foreach($events as $event)
        {
            $eventName = $this->getEventName($event);

            $this->event->fire($eventName, $event);

            $this->log->info("{$eventName} was fired.");
        }
    }
1165461
public function autoload($assets)
    {
        foreach ($assets as $position => $collections) {
            if (property_exists($this, $position)) {

                if ($collections instanceof \ArrayObject) {
                    $collections = $collections->getArrayCopy();
                }

                $this->{$position}->loadCollections($collections);
            } elseif ($position === 'packages') {
                $this->loadPackages($collections);
            } elseif ($position === 'css') {
                $this->loadCss($collections);
            } elseif ($position === 'js') {
                $this->loadJs($collections);
            }
        }
    }
69932
public function trigger($events, $args = [])
    {
        $args[] = $this;
        if (!is_array($events)) {
            $events = [$events];
        }

        foreach ($events as $event) {
            dispatcher()->trigger(static::class . '.' . $event, $args);
            dispatcher()->trigger(Record::class . '.' . $event, $args);
        }

        return $this;
    }
566247
public function subscribe($events)
    {
        $events->listen(
            [ TransactionSaving::class ],
            TransactionSubscriber::class . '@setDefaults'
        );

        $events->listen(
            [ TransactionSaving::class ],
            TransactionSubscriber::class . '@updateBalanceBeforeSave'
        );

        $events->listen(
            [ TransactionDeleting::class ],
            self::class . '@updateBalanceBeforeDelete'
        );
    }