Skip to content

Commit

Permalink
Fixes comments and adds license headers
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Weimann <mail@michael-weimann.eu>
  • Loading branch information
weeman1337 committed Dec 9, 2018
1 parent a4844b3 commit 428993d
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 33 deletions.
21 changes: 21 additions & 0 deletions lib/private/Avatar/GuestAvatar.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
<?php
declare(strict_types=1);

/**
* @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

namespace OC\Avatar;

use OC\Files\SimpleFS\InMemoryFile;
use OCP\ILogger;

Expand Down
20 changes: 20 additions & 0 deletions lib/private/Avatar/UserAvatar.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
<?php
declare(strict_types=1);

/**
* @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

namespace OC\Avatar;

use OC\NotSquareException;
Expand Down
59 changes: 27 additions & 32 deletions lib/private/Files/SimpleFS/InMemoryFile.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
<?php
declare(strict_types=1);

/**
* @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

namespace OC\Files\SimpleFS;

use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Files\SimpleFS\ISimpleFile;

Expand Down Expand Up @@ -39,63 +58,42 @@ public function __construct(string $name, string $contents) {
}

/**
* Returns the file name.
*
* @return string
* @since 11.0.0
* @inheritdoc
*/
public function getName() {
return $this->name;
}

/**
* Get the size in bytes
*
* @return int
* @since 11.0.0
* @inheritdoc
*/
public function getSize() {
return strlen($this->contents);
}

/**
* Get the ETag
*
* @return string
* @since 11.0.0
* @inheritdoc
*/
public function getETag() {
return '';
}

/**
* Get the last modification time
*
* @return int
* @since 11.0.0
* @inheritdoc
*/
public function getMTime() {
return time();
}

/**
* Get the content
*
* @throws NotPermittedException
* @throws NotFoundException
* @return string
* @since 11.0.0
* @inheritdoc
*/
public function getContent() {
return $this->contents;
}

/**
* Overwrite the file
*
* @param string|resource $data
* @throws NotPermittedException
* @since 11.0.0
* @inheritdoc
*/
public function putContent($data) {
$this->contents = $data;
Expand All @@ -109,10 +107,7 @@ public function delete() {
}

/**
* Get the MimeType
*
* @return string
* @since 11.0.0
* @inheritdoc
*/
public function getMimeType() {
$fileInfo = new \finfo(FILEINFO_MIME_TYPE);
Expand Down
2 changes: 1 addition & 1 deletion lib/public/IAvatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function remove();
* @param int $size -1 can be used to not scale the image
* @return ISimpleFile
* @throws NotFoundException
* @since 9.0.0 - switched from File to ISimpleFile since 14.0.0
* @since 9.0.0 - switched from File to ISimpleFile since 15.0.0
*/
public function getFile($size);

Expand Down
21 changes: 21 additions & 0 deletions tests/lib/Avatar/GuestAvatarTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,28 @@
<?php
declare(strict_types=1);

/**
* @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

namespace Test\Avatar;

use OC\Avatar\GuestAvatar;
use OC\Files\SimpleFS\InMemoryFile;
use OCP\ILogger;
Expand Down
20 changes: 20 additions & 0 deletions tests/lib/Files/SimpleFS/InMemoryFileTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
<?php
declare(strict_types=1);

/**
* @copyright Copyright (c) 2018, Michael Weimann <mail@michael-weimann.eu>
*
* @author Michael Weimann <mail@michael-weimann.eu>
*
* @license AGPL-3.0
*
* This code is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License, version 3,
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

namespace Test\File\SimpleFS;

use OC\Files\SimpleFS\InMemoryFile;
Expand Down

0 comments on commit 428993d

Please sign in to comment.