Set an array with all releases. The current release
must be re-set if this is set, and the current release
isn't in the array.
@param $releases An array with release information.
@throws Exception if the $releases parameter isn't an array.
168742
public function setReleases($releases)
    {
        if (!is_array($releases)) {
            throw new \Exception("The releases parameter must be an array.");
        }
        if (isset($this->currentRelease)) {
            if (!isset($releases[$this->currentRelease['version']])) {
                unset($this->currentRelease);
            }
            else {
                // Make sure the info about the current release is updated properly.
                $this->currentRelease = $releases[$this->currentRelease['version']];
            }
        }
        $this->releases = $releases;
    }
1353391
public function addFiles(array $files)
    {
        $added_files = 0;
        foreach ($files as $localName => $fileName) {
            if (is_null($fileName)) {
                if ($this->zip->addEmptyDir($localName) === false)
                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
            } else {
                if ($this->zip->addFile($fileName, $localName) === false)
                    throw new Exception($this->zip->getStatusString(), $this->zip->status);
                $added_files++;
            }
        }

        // reopen archive to save changes
        $archive_filename = $this->zip->filename;
        $this->zip->close();
        $this->open($archive_filename);

        return $added_files;
    }
487729
public function setMessages($messages)
    {
        if (!is_array($messages) && !$messages instanceof Traversable) {
            throw new Exception\InvalidArgumentException(sprintf(
                '%s expects an array or %s object of messages; received "%s"',
                __METHOD__,
                Traversable::class,
                (is_object($messages) ? get_class($messages) : gettype($messages))
            ));
        }

        foreach ($messages as $key => $messageSet) {
            if (!$this->has($key)) {
                $this->messages[$key] = $messageSet;
                continue;
            }

            $element = $this->get($key);
            $element->setMessages($messageSet);
        }

        return $this;
    }
550985
public void release(Collection<T> release)
    {
        List<Ref<T>> refs = new ArrayList<>();
        List<T> notPresent = null;
        for (T obj : release)
        {
            Ref<T> ref = references.remove(obj);
            if (ref == null)
            {
                if (notPresent == null)
                    notPresent = new ArrayList<>();
                notPresent.add(obj);
            }
            else
            {
                refs.add(ref);
            }
        }

        IllegalStateException notPresentFail = null;
        if (notPresent != null)
        {
            notPresentFail = new IllegalStateException("Could not release references to " + notPresent
                                                       + " as references to these objects were not held");
            notPresentFail.fillInStackTrace();
        }
        try
        {
            release(refs);
        }
        catch (Throwable t)
        {
            if (notPresentFail != null)
                t.addSuppressed(notPresentFail);
        }
        if (notPresentFail != null)
            throw notPresentFail;
    }
1237253
public function setAttributes(array $attributes)
    {
        foreach ($attributes as $attribute => $value) {
            $this->setAttribute($attribute, $value);
        }
    }
610459
protected function setDefaults($sets = array())
    {
        foreach ($sets as $set) {
            foreach ($set as $field => $fieldParams) {
                if ($fieldParams['type'] == 'single' && isset($fieldParams['default'])) {
                    $this->fieldData[$field] = $fieldParams['default'];
                }
            }
        }
    }
180354
public function set($values)
    {
        if (! is_array($values)) {
            $values = array($values);
        }
        $this->values = $values;
        $this->snapshot();
        $this->tracker->markOverridden();
        return true;
    }
1029624
public function setJsonKeys($values)
    {
        global $CFG, $PDOX;

        if ( ! is_array($values) ) throw new \Exception('setJsonKeys requires an array as parameter.');
        $old = $this->getJson();
        $old_json = json_decode($old);
        if ( $old_json == null ) $old_json = new \stdClass();
        foreach($values as $key => $value) {
            $old_json->{$key} = $value;
        }
        $new = json_encode($old_json);
        $this->setJson($new);
    }
1026634
protected function updateRecordSets(array &$sets)
    {
        if(is_null($this->recordUser)) {
            if(globals()->offsetExists('account')) {
                $this->setRecordUser(globals()->account->id);
            }
        }

        if ( ! isset($sets[ 'record_status' ])) {
            $sets[ 'record_status' ] = $this->recordStatus;
        }

        if ( ! isset($sets[ 'record_update_user' ])) {
            $sets[ 'record_update_user' ] = $this->recordUser;
        }

        $timestamp = $this->unixTimestamp === true ? strtotime(date('Y-m-d H:i:s')) : date('Y-m-d H:i:s');

        if ( ! isset($sets[ 'record_update_timestamp' ])) {
            $sets[ 'record_update_timestamp' ] = $timestamp;
        }
    }
328611
public function setParameters($parameters)
    {
        // type check, error must never occur, bad code of it does
        if (!is_array($parameters)) {
            throw new Exception("Expected parameters array got something else");
        }

        $this->_parameters = $parameters;
        $this->setInitialized(false);
    }
1094880
public function setArrays(array $arrays)
    {
        $this->data = (isset($arrays[0]) && is_array($arrays[0])) ?
            $arrays :
            [$arrays];
    }
778478
public function setProperties(array $properties = [])
    {
        foreach ($properties as $property => $value) {
            $method = 'set'.ucfirst($property);
            if (!method_exists($this, $method)) {
                throw new \RuntimeException("Undefined method $method.");
            }

            if (!in_array($property, $this->validProperties)) {
                throw new \Exception('You are trying to set invalid properties. Please check valid properties.');
            }

            $this->{$method}($value);
        }
    }
267880
public function setFields($fields): self
    {
        if (!is_iterable($fields)) {
            throw new Exception(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($fields)));
        }

        $this->fields = [];
        foreach ($fields as $field) {
            $this->addField(...$field);
        }

        return $this;
    }
641234
public function set(array $files)
    {
        if (!empty($files)) {
            foreach ($files as $_file) {
                $this->add($_file);
            }
        }
        return $this;
    }
471883
public function update(array $items = [])
    {
        foreach ($items as $key => $item) {
            $this->set($key, $item);
        }
    }
312695
public function set($actions)
    {
        if (! is_array($actions)) {
            $actions = func_get_args();
        }

        $this->clear();

        foreach ($actions as $action) {
            $this->push($action);
        }

        return $this->getDisplay();
    }
1250170
public function setFields (array $fields)
    {
        $this->_fields = array();
        foreach ($fields as $field) {
            $this->append($field);
        }
    }