data = $plugin; parent::__construct(); } /** * Method for determining if the data should be considered private or not * * @return bool */ protected function is_private() { if ( ! current_user_can( 'update_plugins' ) ) { return true; } return false; } /** * Initializes the object * * @return void */ protected function init() { if ( empty( $this->fields ) ) { $this->fields = [ 'id' => function () { return ! empty( $this->data['Path'] ) ? Relay::toGlobalId( 'plugin', $this->data['Path'] ) : null; }, 'name' => function () { return ! empty( $this->data['Name'] ) ? $this->data['Name'] : null; }, 'pluginUri' => function () { return ! empty( $this->data['PluginURI'] ) ? $this->data['PluginURI'] : null; }, 'description' => function () { return ! empty( $this->data['Description'] ) ? $this->data['Description'] : null; }, 'author' => function () { return ! empty( $this->data['Author'] ) ? $this->data['Author'] : null; }, 'authorUri' => function () { return ! empty( $this->data['AuthorURI'] ) ? $this->data['AuthorURI'] : null; }, 'version' => function () { return ! empty( $this->data['Version'] ) ? $this->data['Version'] : null; }, 'path' => function () { return ! empty( $this->data['Path'] ) ? $this->data['Path'] : null; }, ]; } } }