<commit_before><?php
/**
 * Nextcloud - passman
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2016
 */

namespace OCA\Passman\Controller;

use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\ApiController;
use OCA\Passman\Service\CredentialService;
use \OC_App;

class InternalController extends ApiController {
	private $userId;
	private $credentialService;

	public function __construct($AppName,
								IRequest $request,
								$UserId,
								CredentialService $credentialService) {
		parent::__construct($AppName, $request);
		$this->userId = $UserId;
		$this->credentialService = $credentialService;
	}

	/**
	 * @NoAdminRequired
	 */
	public function remind($credential_id) {
		$credential = $this->credentialService->getCredentialById($credential_id, $this->userId);
		$credential->setExpireTime(time() + (24 * 60 * 60));
		$this->credentialService->upd($credential);

		$manager = \OC::$server->getNotificationManager();
		$notification = $manager->createNotification();
		$notification->setApp('passman')
			->setObject('credential', $credential_id)
			->setUser($this->userId);
		$manager->markProcessed($notification);
	}

	/**
	 * @NoAdminRequired
	 */
	public function read($credential_id) {

		$credential = $this->credentialService->getCredentialById($credential_id, $this->userId);
		$credential->setExpireTime(0);
		$this->credentialService->upd($credential);

		$manager = \OC::$server->getNotificationManager();
		$notification = $manager->createNotification();
		$notification->setApp('passman')
			->setObject('credential', $credential_id)
			->setUser($this->userId);
		$manager->markProcessed($notification);
	}

	/**
	 * @NoAdminRequired
	 */
	public function getAppVersion() {
		return new JSONResponse(array('version' => OC_App::getAppVersion('passman')));
	}

	/**
	 * @NoAdminRequired
	 */
	public function generatePerson() {
		$random_person = json_decode(file_get_contents('http://api.namefake.com/'));
		return new JSONResponse($random_person);
	}

}<commit_msg>Fix travis errors in internal controller<commit_after><?php
/**
 * Nextcloud - passman
 *
 * This file is licensed under the Affero General Public License version 3 or
 * later. See the COPYING file.
 *
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2016
 */

namespace OCA\Passman\Controller;

use OCP\IRequest;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\ApiController;
use OCA\Passman\Service\CredentialService;


class InternalController extends ApiController {
	private $userId;
	private $credentialService;

	public function __construct($AppName,
								IRequest $request,
								$UserId,
								CredentialService $credentialService) {
		parent::__construct($AppName, $request);
		$this->userId = $UserId;
		$this->credentialService = $credentialService;
	}

	/**
	 * @NoAdminRequired
	 */
	public function remind($credential_id) {
		$credential = $this->credentialService->getCredentialById($credential_id, $this->userId);
		$credential->setExpireTime(time() + (24 * 60 * 60));
		$this->credentialService->upd($credential);

		$manager = \OC::$server->getNotificationManager();
		$notification = $manager->createNotification();
		$notification->setApp('passman')
			->setObject('credential', $credential_id)
			->setUser($this->userId);
		$manager->markProcessed($notification);
	}

	/**
	 * @NoAdminRequired
	 */
	public function read($credential_id) {

		$credential = $this->credentialService->getCredentialById($credential_id, $this->userId);
		$credential->setExpireTime(0);
		$this->credentialService->upd($credential);

		$manager = \OC::$server->getNotificationManager();
		$notification = $manager->createNotification();
		$notification->setApp('passman')
			->setObject('credential', $credential_id)
			->setUser($this->userId);
		$manager->markProcessed($notification);
	}

	/**
	 * @NoAdminRequired
	 */
	public function getAppVersion() {
		return new JSONResponse(array('version' => OC_App::getAppVersion('passman')));
	}

	/**
	 * @NoAdminRequired
	 */
	public function generatePerson() {
		$random_person = json_decode(file_get_contents('http://api.namefake.com/'));
		return new JSONResponse($random_person);
	}

}
{'fraction_non_alphanumeric': 0.15291656983499885, 'fraction_numerical': 0.005577504066930049, 'mean_word_length': 5.096317280453258, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 69, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2470150', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1334, 'n_words': 237}