Return the fields which contain personal data.

@param collection $items a reference to the collection to use to store the metadata.
@return collection the updated collection of metadata items.
9841
public static function get_metadata(collection $items) : collection {
        $items->add_database_table(
            'glossary_entries',
            [
                'glossaryid'    => 'privacy:metadata:glossary_entries:glossaryid',
                'userid'        => 'privacy:metadata:glossary_entries:userid',
                'concept'       => 'privacy:metadata:glossary_entries:concept',
                'definition'    => 'privacy:metadata:glossary_entries:definition',
                'attachment'    => 'privacy:metadata:glossary_entries:attachment',
                'timemodified'  => 'privacy:metadata:glossary_entries:timemodified',
            ],
            'privacy:metadata:glossary_entries'
        );

        $items->add_subsystem_link('core_files', [], 'privacy:metadata:core_files');
        $items->add_subsystem_link('core_comment', [], 'privacy:metadata:core_comments');
        $items->add_subsystem_link('core_tag', [], 'privacy:metadata:core_tag');
        $items->add_subsystem_link('core_rating', [], 'privacy:metadata:core_rating');
        return $items;
    }
900010
protected function getArrayItems($items)
    {
        if (is_array($items)) {
            return $items;
        } elseif ($items instanceof self) {
            return $items->all();
        }

        return (array) $items;
    }
589383
public static function get_metadata(collection $collection) : collection {

        $sessionfields = [
                'userid' => 'privacy:metadata:mnet_session:userid',
                'username' => 'privacy:metadata:mnet_session:username',
                'token' => 'privacy:metadata:mnet_session:token',
                'mnethostid' => 'privacy:metadata:mnet_session:mnethostid',
                'useragent' => 'privacy:metadata:mnet_session:useragent',
                'expires' => 'privacy:metadata:mnet_session:expires'
        ];

        $collection->add_database_table('mnet_session', $sessionfields, 'privacy:metadata:mnet_session');

        $logfields = [
                'hostid' => 'privacy:metadata:mnet_log:hostid',
                'remoteid' => 'privacy:metadata:mnet_log:remoteid',
                'time' => 'privacy:metadata:mnet_log:time',
                'userid' => 'privacy:metadata:mnet_log:userid',
                'ip' => 'privacy:metadata:mnet_log:ip',
                'course' => 'privacy:metadata:mnet_log:course',
                'coursename' => 'privacy:metadata:mnet_log:coursename',
                'module' => 'privacy:metadata:mnet_log:module',
                'cmid' => 'privacy:metadata:mnet_log:cmid',
                'action' => 'privacy:metadata:mnet_log:action',
                'url' => 'privacy:metadata:mnet_log:url',
                'info' => 'privacy:metadata:mnet_log:info'
        ];

        $collection->add_database_table('mnet_log', $logfields, 'privacy:metadata:mnet_log');

        $externalfields = [
                'address' => 'privacy:metadata:mnet_external:address',
                'aim' => 'privacy:metadata:mnet_external:aim',
                'alternatename' => 'privacy:metadata:mnet_external:alternatename',
                'autosubscribe' => 'privacy:metadata:mnet_external:autosubscribe',
                'calendartype' => 'privacy:metadata:mnet_external:calendartype',
                'city' => 'privacy:metadata:mnet_external:city',
                'country' => 'privacy:metadata:mnet_external:country',
                'currentlogin' => 'privacy:metadata:mnet_external:currentlogin',
                'department' => 'privacy:metadata:mnet_external:department',
                'description' => 'privacy:metadata:mnet_external:description',
                'email' => 'privacy:metadata:mnet_external:email',
                'emailstop' => 'privacy:metadata:mnet_external:emailstop',
                'firstaccess' => 'privacy:metadata:mnet_external:firstaccess',
                'firstname' => 'privacy:metadata:mnet_external:firstname',
                'firstnamephonetic' => 'privacy:metadata:mnet_external:firstnamephonetic',
                'icq' => 'privacy:metadata:mnet_external:icq',
                'id' => 'privacy:metadata:mnet_external:id',
                'idnumber' => 'privacy:metadata:mnet_external:idnumber',
                'imagealt' => 'privacy:metadata:mnet_external:imagealt',
                'institution' => 'privacy:metadata:mnet_external:institution',
                'lang' => 'privacy:metadata:mnet_external:lang',
                'lastaccess' => 'privacy:metadata:mnet_external:lastaccess',
                'lastlogin' => 'privacy:metadata:mnet_external:lastlogin',
                'lastname' => 'privacy:metadata:mnet_external:lastname',
                'lastnamephonetic' => 'privacy:metadata:mnet_external:lastnamephonetic',
                'maildigest' => 'privacy:metadata:mnet_external:maildigest',
                'maildisplay' => 'privacy:metadata:mnet_external:maildisplay',
                'middlename' => 'privacy:metadata:mnet_external:middlename',
                'msn' => 'privacy:metadata:mnet_external:msn',
                'phone1' => 'privacy:metadata:mnet_external:phone1',
                'pnone2' => 'privacy:metadata:mnet_external:phone2',
                'picture' => 'privacy:metadata:mnet_external:picture',
                'policyagreed' => 'privacy:metadata:mnet_external:policyagreed',
                'skype' => 'privacy:metadata:mnet_external:skype',
                'suspended' => 'privacy:metadata:mnet_external:suspended',
                'timezone' => 'privacy:metadata:mnet_external:timezone',
                'trackforums' => 'privacy:metadata:mnet_external:trackforums',
                'trustbitmask' => 'privacy:metadata:mnet_external:trustbitmask',
                'url' => 'privacy:metadata:mnet_external:url',
                'username' => 'privacy:metadata:mnet_external:username',
                'yahoo' => 'privacy:metadata:mnet_external:yahoo',
        ];

        $collection->add_external_location_link('moodle', $externalfields, 'privacy:metadata:external:moodle');

        $collection->add_external_location_link('mahara', $externalfields, 'privacy:metadata:external:mahara');

        return $collection;
    }
1285664
protected function getMetaboxData(Collection $fields)
    {
        $data = [];

        foreach ($fields as $field) {
            $data[$field['name']] = $field['value'];
        }

        return $data;
    }
935933
protected function setItemListElementAttribute($items)
    {
        foreach($items as $pos=>$item) {
            $items[$pos] = $this->getNestedContext(ListItem::class, [
                'position' => $pos + 1,
                'item' => $item
            ]);
        }

        return $items;
    }
801644
public function setItems($items)
    {
        $this->items = ($items instanceof Collection) ? $items : Collection::make($items);

        return $this;
    }
435640
private function createModelCollectionFromActions(array $actions, array &$items)
    {
        $models = new DefaultCollection();
        foreach ($actions as $action) {
            $models->push($action['model']);
            $items[] = $action['item'];
        }

        return $models;
    }
863606
public function containsAll($items)
    {
        $values = $this->getValues();
        foreach($items as $item)
        {
            if (!in_array($item, $values, true))
            {
                return false;
            }
        }
        return true;
    }
1066839
public function prepareItems($items)
    {
        if (!is_array($items)) {
            return $items;
        } elseif (self::isAssoc($items)) {
            $items = $this->prepareItem($items);
        } else {
            foreach ($items as $key => $item) {
                $items[ $key ] = $this->prepareItem($item);
            }
        }
        return $items;
    }
572712
public function collection(Collection $collection)
    {
        $entries = new Entries();

        foreach ($collection as $order) {
            $entry = new Entry($order);

            $entry
                ->field('id')
                ->field('firstname')
                ->field('lastname')
                ->field('address1')
                ->field('address2')
                ->field('zipcode')
                ->field('city')
                ->field('country')
                ->field('phone_work')
                ->field('phone_home')
                ->field('phone_mobile')
                ->field('other_informations')
            ;

            $entries->addEntry($entry);
        }

        return $entries->toArray();
    }
757110
protected function getArrayableItems($items)
		{
			if ($items instanceof self) {
				$items = $items->all();
			} elseif ($items instanceof Arrayable) {
				$items = $items->toArray();
			}

			return $items;
		}
1216228
public function add($items)
    {
        if (is_array($items)) {
            $this->collection[] = new RecordField($items);
        } elseif (is_object($items) && $items instanceof RecordField) {
            $this->collection[] = $items;
        }

        return $this;
    }
834349
public static function getArrayableItems($items)
    {
        if ($items instanceof ManagesItemsTrait || $items instanceof ManagesItemsInterface) {
            return $items->getAll();

        } elseif ($items instanceof Traversable) {
            return iterator_to_array($items);
        }

        return (array)$items;
    }
550330
protected function setByArtistAttribute($items)
    {
        if ( ! is_array($items))
        {
            return $items;
        }

        //Check if not multidimensional array (for backward compatibility)
        if((count($items) == count($items, COUNT_RECURSIVE)))
        {
            return $this->getNestedContext(MusicGroup::class, $items);
        }

        //multiple artists
        return array_map(function ($item) {
            return $this->getNestedContext(MusicGroup::class, $item);
        }, $items);
    }
745577
public static function get_metadata(collection $collection) : collection {
        $assigngrades = [
                'userid' => 'privacy:metadata:userid',
                'timecreated' => 'privacy:metadata:timecreated',
                'timemodified' => 'timemodified',
                'grader' => 'privacy:metadata:grader',
                'grade' => 'privacy:metadata:grade',
                'attemptnumber' => 'attemptnumber'
        ];
        $assignoverrides = [
                'groupid' => 'privacy:metadata:groupid',
                'userid' => 'privacy:metadata:userid',
                'allowsubmissionsfromdate' => 'allowsubmissionsfromdate',
                'duedate' => 'duedate',
                'cutoffdate' => 'cutoffdate'
        ];
        $assignsubmission = [
                'userid' => 'privacy:metadata:userid',
                'timecreated' => 'privacy:metadata:timecreated',
                'timemodified' => 'timemodified',
                'status' => 'gradingstatus',
                'groupid' => 'privacy:metadata:groupid',
                'attemptnumber' => 'attemptnumber',
                'latest' => 'privacy:metadata:latest'
        ];
        $assignuserflags = [
                'userid' => 'privacy:metadata:userid',
                'assignment' => 'privacy:metadata:assignmentid',
                'locked' => 'locksubmissions',
                'mailed' => 'privacy:metadata:mailed',
                'extensionduedate' => 'extensionduedate',
                'workflowstate' => 'markingworkflowstate',
                'allocatedmarker' => 'allocatedmarker'
        ];
        $assignusermapping = [
                'assignment' => 'privacy:metadata:assignmentid',
                'userid' => 'privacy:metadata:userid'
        ];
        $collection->add_database_table('assign_grades', $assigngrades, 'privacy:metadata:assigngrades');
        $collection->add_database_table('assign_overrides', $assignoverrides, 'privacy:metadata:assignoverrides');
        $collection->add_database_table('assign_submission', $assignsubmission, 'privacy:metadata:assignsubmissiondetail');
        $collection->add_database_table('assign_user_flags', $assignuserflags, 'privacy:metadata:assignuserflags');
        $collection->add_database_table('assign_user_mapping', $assignusermapping, 'privacy:metadata:assignusermapping');
        $collection->add_user_preference('assign_perpage', 'privacy:metadata:assignperpage');
        $collection->add_user_preference('assign_filter', 'privacy:metadata:assignfilter');
        $collection->add_user_preference('assign_markerfilter', 'privacy:metadata:assignmarkerfilter');
        $collection->add_user_preference('assign_workflowfilter', 'privacy:metadata:assignworkflowfilter');
        $collection->add_user_preference('assign_quickgrading', 'privacy:metadata:assignquickgrading');
        $collection->add_user_preference('assign_downloadasfolders', 'privacy:metadata:assigndownloadasfolders');

        // Link to subplugins.
        $collection->add_plugintype_link('assignsubmission', [],'privacy:metadata:assignsubmissionpluginsummary');
        $collection->add_plugintype_link('assignfeedback', [], 'privacy:metadata:assignfeedbackpluginsummary');
        $collection->add_subsystem_link('core_message', [], 'privacy:metadata:assignmessageexplanation');

        return $collection;
    }
147051
protected function getArrayableItems($items)
    {
        if (is_array($items)) {
            return $items;
        }
        if ($items instanceof self) {
            return $items->all();
        }
        if (is_object($items) && method_exists($items, 'toArray')) {
            return $items->toArray();
        }
        if (is_object($items) && method_exists($items, 'toJson')) {
            return json_decode($items->toJson(), true);
        }
        if ($items instanceof JsonSerializable) {
            return $items->jsonSerialize();
        }
        if ($items instanceof Traversable) {
            return iterator_to_array($items);
        }

        return (array) $items;
    }
1006114
public function setItems($items)
    {
        $newItems = new ItemBag();
        foreach ($items as $item) {
            $newItems->add(new Item($item->getParameters()));
        }

        return parent::setItems($newItems);
    }