@@ -848,29 +848,29 @@ discard block |
||
| 848 | 848 | * @throws MemberNotFoundException |
| 849 | 849 | */ |
| 850 | 850 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 851 | - if ($this->get($prefix . 'single_id', $data) === '') { |
|
| 851 | + if ($this->get($prefix.'single_id', $data) === '') { |
|
| 852 | 852 | throw new MemberNotFoundException(); |
| 853 | 853 | } |
| 854 | 854 | |
| 855 | - $this->setId($this->get($prefix . 'member_id', $data)); |
|
| 856 | - $this->setCircleId($this->get($prefix . 'circle_id', $data)); |
|
| 857 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
| 858 | - $this->setUserId($this->get($prefix . 'user_id', $data)); |
|
| 859 | - $this->setUserType($this->getInt($prefix . 'user_type', $data)); |
|
| 860 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
| 861 | - $this->setLevel($this->getInt($prefix . 'level', $data)); |
|
| 862 | - $this->setStatus($this->get($prefix . 'status', $data)); |
|
| 863 | - $this->setDisplayName($this->get($prefix . 'cached_name', $data)); |
|
| 864 | - $this->setNotes($this->getArray($prefix . 'note', $data)); |
|
| 865 | - $this->setContactId($this->get($prefix . 'contact_id', $data)); |
|
| 866 | - $this->setContactMeta($this->get($prefix . 'contact_meta', $data)); |
|
| 867 | - |
|
| 868 | - $cachedUpdate = $this->get($prefix . 'cached_update', $data); |
|
| 855 | + $this->setId($this->get($prefix.'member_id', $data)); |
|
| 856 | + $this->setCircleId($this->get($prefix.'circle_id', $data)); |
|
| 857 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
| 858 | + $this->setUserId($this->get($prefix.'user_id', $data)); |
|
| 859 | + $this->setUserType($this->getInt($prefix.'user_type', $data)); |
|
| 860 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
| 861 | + $this->setLevel($this->getInt($prefix.'level', $data)); |
|
| 862 | + $this->setStatus($this->get($prefix.'status', $data)); |
|
| 863 | + $this->setDisplayName($this->get($prefix.'cached_name', $data)); |
|
| 864 | + $this->setNotes($this->getArray($prefix.'note', $data)); |
|
| 865 | + $this->setContactId($this->get($prefix.'contact_id', $data)); |
|
| 866 | + $this->setContactMeta($this->get($prefix.'contact_meta', $data)); |
|
| 867 | + |
|
| 868 | + $cachedUpdate = $this->get($prefix.'cached_update', $data); |
|
| 869 | 869 | if ($cachedUpdate !== '') { |
| 870 | 870 | $this->setDisplayUpdate(DateTime::createFromFormat('Y-m-d H:i:s', $cachedUpdate)->getTimestamp()); |
| 871 | 871 | } |
| 872 | 872 | |
| 873 | - $joined = $this->get($prefix . 'joined', $data); |
|
| 873 | + $joined = $this->get($prefix.'joined', $data); |
|
| 874 | 874 | if ($joined !== '') { |
| 875 | 875 | $this->setJoined(DateTime::createFromFormat('Y-m-d H:i:s', $joined)->getTimestamp()); |
| 876 | 876 | } |
@@ -961,7 +961,7 @@ discard block |
||
| 961 | 961 | public static function parseLevelInt(int $level): int { |
| 962 | 962 | if (!array_key_exists($level, self::$DEF_LEVEL)) { |
| 963 | 963 | $all = implode(', ', array_keys(self::$DEF_LEVEL)); |
| 964 | - throw new ParseMemberLevelException('Available levels: ' . $all, 121); |
|
| 964 | + throw new ParseMemberLevelException('Available levels: '.$all, 121); |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | return $level; |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | |
| 981 | 981 | if (!$level) { |
| 982 | 982 | $all = implode(', ', array_values(self::$DEF_LEVEL)); |
| 983 | - throw new ParseMemberLevelException('Available levels: ' . $all, 121); |
|
| 983 | + throw new ParseMemberLevelException('Available levels: '.$all, 121); |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | return (int)$level; |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | $type = array_search($typeString, Member::$TYPE); |
| 1002 | 1002 | if ($type === false) { |
| 1003 | 1003 | $all = implode(', ', array_values(self::$TYPE)); |
| 1004 | - throw new UserTypeNotFoundException('Available types: ' . $all); |
|
| 1004 | + throw new UserTypeNotFoundException('Available types: '.$all); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | return (int)$type; |
@@ -677,9 +677,9 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | $display = $circle->getDisplayName(); |
| 679 | 679 | if ($circle->getSource() === Member::TYPE_CIRCLE) { |
| 680 | - $display .= ' (Circle owned by ' . $circle->getOwner()->getDisplayName() . ')'; |
|
| 680 | + $display .= ' (Circle owned by '.$circle->getOwner()->getDisplayName().')'; |
|
| 681 | 681 | } else { |
| 682 | - $display .= ' (' . Circle::$DEF_SOURCE[$circle->getSource()] . ')'; |
|
| 682 | + $display .= ' ('.Circle::$DEF_SOURCE[$circle->getSource()].')'; |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | $share->setSharedWithDisplayName($display); |
@@ -785,20 +785,20 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 787 | 787 | $shareTime = new DateTime(); |
| 788 | - $shareTime->setTimestamp($this->getInt($prefix . 'stime', $data)); |
|
| 789 | - |
|
| 790 | - $this->setId($this->get($prefix . 'id', $data)) |
|
| 791 | - ->setShareType($this->getInt($prefix . 'share_type', $data)) |
|
| 792 | - ->setPermissions($this->getInt($prefix . 'permissions', $data)) |
|
| 793 | - ->setItemType($this->get($prefix . 'item_type', $data)) |
|
| 794 | - ->setItemSource($this->getInt($prefix . 'item_source', $data)) |
|
| 795 | - ->setItemTarget($this->get($prefix . 'item_target', $data)) |
|
| 796 | - ->setFileSource($this->getInt($prefix . 'file_source', $data)) |
|
| 797 | - ->setFileTarget($this->get($prefix . 'file_target', $data)) |
|
| 798 | - ->setSharedWith($this->get($prefix . 'share_with', $data)) |
|
| 799 | - ->setSharedBy($this->get($prefix . 'uid_initiator', $data)) |
|
| 800 | - ->setShareOwner($this->get($prefix . 'uid_owner', $data)) |
|
| 801 | - ->setToken($this->get($prefix . 'token', $data)) |
|
| 788 | + $shareTime->setTimestamp($this->getInt($prefix.'stime', $data)); |
|
| 789 | + |
|
| 790 | + $this->setId($this->get($prefix.'id', $data)) |
|
| 791 | + ->setShareType($this->getInt($prefix.'share_type', $data)) |
|
| 792 | + ->setPermissions($this->getInt($prefix.'permissions', $data)) |
|
| 793 | + ->setItemType($this->get($prefix.'item_type', $data)) |
|
| 794 | + ->setItemSource($this->getInt($prefix.'item_source', $data)) |
|
| 795 | + ->setItemTarget($this->get($prefix.'item_target', $data)) |
|
| 796 | + ->setFileSource($this->getInt($prefix.'file_source', $data)) |
|
| 797 | + ->setFileTarget($this->get($prefix.'file_target', $data)) |
|
| 798 | + ->setSharedWith($this->get($prefix.'share_with', $data)) |
|
| 799 | + ->setSharedBy($this->get($prefix.'uid_initiator', $data)) |
|
| 800 | + ->setShareOwner($this->get($prefix.'uid_owner', $data)) |
|
| 801 | + ->setToken($this->get($prefix.'token', $data)) |
|
| 802 | 802 | ->setShareTime($shareTime); |
| 803 | 803 | |
| 804 | 804 | // if (($password = $this->get('personal_password', $data, '')) !== '') { |
@@ -807,9 +807,9 @@ discard block |
||
| 807 | 807 | // $share->setPassword($this->get('password', $data, '')); |
| 808 | 808 | // } |
| 809 | 809 | |
| 810 | - $this->setChildId($this->getInt($prefix . 'child_id', $data)) |
|
| 811 | - ->setChildFileTarget($this->get($prefix . 'child_file_target', $data)) |
|
| 812 | - ->setChildPermissions($this->getInt($prefix . 'child_permissions', $data)) |
|
| 810 | + $this->setChildId($this->getInt($prefix.'child_id', $data)) |
|
| 811 | + ->setChildFileTarget($this->get($prefix.'child_file_target', $data)) |
|
| 812 | + ->setChildPermissions($this->getInt($prefix.'child_permissions', $data)) |
|
| 813 | 813 | ->setProviderId(ShareByCircleProvider::IDENTIFIER) |
| 814 | 814 | ->setStatus(Ishare::STATUS_ACCEPTED); |
| 815 | 815 | |
@@ -418,15 +418,15 @@ |
||
| 418 | 418 | * @throws FederatedUserNotFoundException |
| 419 | 419 | */ |
| 420 | 420 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 421 | - if ($this->get($prefix . 'single_id', $data) === '') { |
|
| 421 | + if ($this->get($prefix.'single_id', $data) === '') { |
|
| 422 | 422 | throw new FederatedUserNotFoundException(); |
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - $this->setSingleId($this->get($prefix . 'single_id', $data)); |
|
| 426 | - $this->setUserId($this->get($prefix . 'user_id', $data)); |
|
| 427 | - $this->setUserType($this->getInt($prefix . 'user_type', $data)); |
|
| 428 | - $this->setDisplayName($this->get($prefix . 'cached_name', $data)); |
|
| 429 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
| 425 | + $this->setSingleId($this->get($prefix.'single_id', $data)); |
|
| 426 | + $this->setUserId($this->get($prefix.'user_id', $data)); |
|
| 427 | + $this->setUserType($this->getInt($prefix.'user_type', $data)); |
|
| 428 | + $this->setDisplayName($this->get($prefix.'cached_name', $data)); |
|
| 429 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
| 430 | 430 | |
| 431 | 431 | $this->getManager()->manageImportFromDatabase($this, $data, $prefix); |
| 432 | 432 | |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | class RemoteInstance extends NCSignatory implements IQueryRow, JsonSerializable { |
| 47 | 47 | use TArrayTools; |
| 48 | 48 | |
| 49 | - public const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
| 50 | - public const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
| 51 | - public const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
| 52 | - public const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
| 53 | - public const TYPE_GLOBALSCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
| 49 | + public const TYPE_UNKNOWN = 'Unknown'; // not trusted |
|
| 50 | + public const TYPE_PASSIVE = 'Passive'; // Minimum information about Federated Circles are broadcasted if a member belongs to the circle. |
|
| 51 | + public const TYPE_EXTERNAL = 'External'; // info about Federated Circles and their members are broadcasted if a member belongs to the circle. |
|
| 52 | + public const TYPE_TRUSTED = 'Trusted'; // everything about Federated Circles are broadcasted. |
|
| 53 | + public const TYPE_GLOBALSCALE = 'GlobalScale'; // every Circle is broadcasted, |
|
| 54 | 54 | |
| 55 | 55 | public static $LIST_TYPE = [ |
| 56 | 56 | self::TYPE_UNKNOWN, |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | ]; |
| 527 | 527 | |
| 528 | 528 | if ($this->getAuthSigned() !== '') { |
| 529 | - $data[self::AUTH_SIGNED] = $this->getAlgorithm() . ':' . $this->getAuthSigned(); |
|
| 529 | + $data[self::AUTH_SIGNED] = $this->getAlgorithm().':'.$this->getAuthSigned(); |
|
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | if (!empty($this->getAliases())) { |
@@ -545,17 +545,17 @@ discard block |
||
| 545 | 545 | * @throws RemoteNotFoundException |
| 546 | 546 | */ |
| 547 | 547 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 548 | - if ($this->getInt($prefix . 'id', $data) === 0) { |
|
| 548 | + if ($this->getInt($prefix.'id', $data) === 0) { |
|
| 549 | 549 | throw new RemoteNotFoundException(); |
| 550 | 550 | } |
| 551 | 551 | |
| 552 | - $this->setDbId($this->getInt($prefix . 'id', $data)); |
|
| 553 | - $this->import($this->getArray($prefix . 'item', $data)); |
|
| 554 | - $this->setOrigData($this->getArray($prefix . 'item', $data)); |
|
| 555 | - $this->setType($this->get($prefix . 'type', $data)); |
|
| 556 | - $this->setInterface($this->getInt($prefix . 'interface', $data)); |
|
| 557 | - $this->setInstance($this->get($prefix . 'instance', $data)); |
|
| 558 | - $this->setId($this->get($prefix . 'href', $data)); |
|
| 552 | + $this->setDbId($this->getInt($prefix.'id', $data)); |
|
| 553 | + $this->import($this->getArray($prefix.'item', $data)); |
|
| 554 | + $this->setOrigData($this->getArray($prefix.'item', $data)); |
|
| 555 | + $this->setType($this->get($prefix.'type', $data)); |
|
| 556 | + $this->setInterface($this->getInt($prefix.'interface', $data)); |
|
| 557 | + $this->setInstance($this->get($prefix.'instance', $data)); |
|
| 558 | + $this->setId($this->get($prefix.'href', $data)); |
|
| 559 | 559 | |
| 560 | 560 | return $this; |
| 561 | 561 | } |
@@ -92,26 +92,26 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | // specific value |
| 95 | - public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 96 | - public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 97 | - public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 95 | + public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. |
|
| 96 | + public const CFG_SINGLE = 1; // Circle with only one single member. |
|
| 97 | + public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. |
|
| 98 | 98 | |
| 99 | 99 | // bitwise |
| 100 | - public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 101 | - public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 102 | - public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 103 | - public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 104 | - public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 105 | - public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 106 | - public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 107 | - public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 108 | - public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 109 | - public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 110 | - public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 111 | - public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 112 | - public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 113 | - public const CFG_FEDERATED = 32768; // Federated |
|
| 114 | - public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 100 | + public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited |
|
| 101 | + public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it |
|
| 102 | + public const CFG_OPEN = 16; // Circle is open, people can join |
|
| 103 | + public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted |
|
| 104 | + public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator |
|
| 105 | + public const CFG_FRIEND = 128; // Members of the circle can invite their friends |
|
| 106 | + public const CFG_PROTECTED = 256; // Password protected to join/request |
|
| 107 | + public const CFG_NO_OWNER = 512; // no owner, only members |
|
| 108 | + public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity |
|
| 109 | + public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles |
|
| 110 | + public const CFG_LOCAL = 4096; // Local even on GlobalScale |
|
| 111 | + public const CFG_ROOT = 8192; // Circle cannot be inside another Circle |
|
| 112 | + public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle |
|
| 113 | + public const CFG_FEDERATED = 32768; // Federated |
|
| 114 | + public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle |
|
| 115 | 115 | |
| 116 | 116 | public static $DEF_CFG_MAX = 131071; |
| 117 | 117 | |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | */ |
| 479 | 479 | public function addInheritedMembers(array $members): self { |
| 480 | 480 | $knownIds = array_map( |
| 481 | - function (Member $member): string { |
|
| 481 | + function(Member $member): string { |
|
| 482 | 482 | return $member->getId(); |
| 483 | 483 | }, $this->inheritedMembers |
| 484 | 484 | ); |
@@ -892,23 +892,23 @@ discard block |
||
| 892 | 892 | * @throws CircleNotFoundException |
| 893 | 893 | */ |
| 894 | 894 | public function importFromDatabase(array $data, string $prefix = ''): IQueryRow { |
| 895 | - if ($this->get($prefix . 'unique_id', $data) === '') { |
|
| 895 | + if ($this->get($prefix.'unique_id', $data) === '') { |
|
| 896 | 896 | throw new CircleNotFoundException(); |
| 897 | 897 | } |
| 898 | 898 | |
| 899 | - $this->setSingleId($this->get($prefix . 'unique_id', $data)) |
|
| 900 | - ->setName($this->get($prefix . 'name', $data)) |
|
| 901 | - ->setDisplayName($this->get($prefix . 'display_name', $data)) |
|
| 902 | - ->setSanitizedName($this->get($prefix . 'sanitized_name', $data)) |
|
| 903 | - ->setConfig($this->getInt($prefix . 'config', $data)) |
|
| 904 | - ->setSource($this->getInt($prefix . 'source', $data)) |
|
| 905 | - ->setInstance($this->get($prefix . 'instance', $data)) |
|
| 906 | - ->setSettings($this->getArray($prefix . 'settings', $data)) |
|
| 907 | - ->setContactAddressBook($this->getInt($prefix . 'contact_addressbook', $data)) |
|
| 908 | - ->setContactGroupName($this->get($prefix . 'contact_groupname', $data)) |
|
| 909 | - ->setDescription($this->get($prefix . 'description', $data)); |
|
| 910 | - |
|
| 911 | - $creation = $this->get($prefix . 'creation', $data); |
|
| 899 | + $this->setSingleId($this->get($prefix.'unique_id', $data)) |
|
| 900 | + ->setName($this->get($prefix.'name', $data)) |
|
| 901 | + ->setDisplayName($this->get($prefix.'display_name', $data)) |
|
| 902 | + ->setSanitizedName($this->get($prefix.'sanitized_name', $data)) |
|
| 903 | + ->setConfig($this->getInt($prefix.'config', $data)) |
|
| 904 | + ->setSource($this->getInt($prefix.'source', $data)) |
|
| 905 | + ->setInstance($this->get($prefix.'instance', $data)) |
|
| 906 | + ->setSettings($this->getArray($prefix.'settings', $data)) |
|
| 907 | + ->setContactAddressBook($this->getInt($prefix.'contact_addressbook', $data)) |
|
| 908 | + ->setContactGroupName($this->get($prefix.'contact_groupname', $data)) |
|
| 909 | + ->setDescription($this->get($prefix.'description', $data)); |
|
| 910 | + |
|
| 911 | + $creation = $this->get($prefix.'creation', $data); |
|
| 912 | 912 | $this->setCreation(DateTime::createFromFormat('Y-m-d H:i:s', $creation)->getTimestamp()); |
| 913 | 913 | |
| 914 | 914 | $this->setPopulation($this->getInt('population', $this->getSettings())); |
@@ -138,7 +138,7 @@ |
||
| 138 | 138 | */ |
| 139 | 139 | public function setBody(string $body): self { |
| 140 | 140 | $this->body = $body; |
| 141 | - $this->setDigest('SHA-256=' . base64_encode(hash("sha256", utf8_encode($body), true))); |
|
| 141 | + $this->setDigest('SHA-256='.base64_encode(hash("sha256", utf8_encode($body), true))); |
|
| 142 | 142 | |
| 143 | 143 | return $this; |
| 144 | 144 | } |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | $item = new $class(); |
| 294 | 294 | if (!$item instanceof IDeserializable && !$item instanceof JsonSerializable) { |
| 295 | 295 | throw new InvalidItemException( |
| 296 | - $class . ' does not implement IDeserializable and JsonSerializable' |
|
| 296 | + $class.' does not implement IDeserializable and JsonSerializable' |
|
| 297 | 297 | ); |
| 298 | 298 | } |
| 299 | 299 | |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | foreach ($keys as $key) { |
| 421 | 421 | if (!$this->haveKey($key)) { |
| 422 | 422 | if ($must) { |
| 423 | - throw new MalformedArrayException($key . ' missing in ' . json_encode($this->keys())); |
|
| 423 | + throw new MalformedArrayException($key.' missing in '.json_encode($this->keys())); |
|
| 424 | 424 | } |
| 425 | 425 | |
| 426 | 426 | return false; |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | */ |
| 82 | 82 | public function createSimpleSignatory(NCSignatory $signatory): void { |
| 83 | 83 | $app = $this->setup('app', '', self::$SIGNATORIES_APP); |
| 84 | - $signatory->setKeyId($signatory->getId() . '#main-key'); |
|
| 84 | + $signatory->setKeyId($signatory->getId().'#main-key'); |
|
| 85 | 85 | $signatory->setKeyOwner($signatory->getId()); |
| 86 | 86 | $this->generateKeys($signatory); |
| 87 | 87 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $line; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - return substr($line, 0, $length - 5) . ' (..)'; |
|
| 99 | + return substr($line, 0, $length - 5).' (..)'; |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | /** |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | protected function feedStringWithParams(string $line, array $params): string { |
| 135 | 135 | $ak = array_keys($params); |
| 136 | 136 | foreach ($ak as $k) { |
| 137 | - $line = str_replace('{' . $k . '}', (string)$params[$k], $line); |
|
| 137 | + $line = str_replace('{'.$k.'}', (string)$params[$k], $line); |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return $line; |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $s = ['B', 'KB', 'MB', 'GB', 'TB', 'PB']; |
| 189 | 189 | $e = floor(log($bytes, 1024)); |
| 190 | 190 | |
| 191 | - return round($bytes / pow(1024, $e), 2) . ' ' . $s[$e]; |
|
| 191 | + return round($bytes / pow(1024, $e), 2).' '.$s[$e]; |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | $second = time(); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - $f = new DateTime('@' . $first); |
|
| 215 | - $s = new DateTime('@' . $second); |
|
| 214 | + $f = new DateTime('@'.$first); |
|
| 215 | + $s = new DateTime('@'.$second); |
|
| 216 | 216 | $duration = $second - $first; |
| 217 | 217 | if ($short) { |
| 218 | 218 | $minutes = $this->get('minutes', $words, 'M'); |
@@ -220,16 +220,16 @@ discard block |
||
| 220 | 220 | $days = $this->get('days', $words, 'D'); |
| 221 | 221 | |
| 222 | 222 | if ($duration < 60) { |
| 223 | - return $f->diff($s)->format('<1' . $minutes); |
|
| 223 | + return $f->diff($s)->format('<1'.$minutes); |
|
| 224 | 224 | } |
| 225 | 225 | if ($duration < 3600) { |
| 226 | - return $f->diff($s)->format('%i' . $minutes); |
|
| 226 | + return $f->diff($s)->format('%i'.$minutes); |
|
| 227 | 227 | } |
| 228 | 228 | if ($duration < 86400) { |
| 229 | - return $f->diff($s)->format('%h' . $hours . ', %i' . $minutes); |
|
| 229 | + return $f->diff($s)->format('%h'.$hours.', %i'.$minutes); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | - return $f->diff($s)->format('%a' . $days . ', %h' . $hours . ', %i' . $minutes); |
|
| 232 | + return $f->diff($s)->format('%a'.$days.', %h'.$hours.', %i'.$minutes); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $seconds = $this->get('seconds', $words, 'seconds'); |
@@ -237,22 +237,22 @@ discard block |
||
| 237 | 237 | $hours = $this->get('hours', $words, 'hours'); |
| 238 | 238 | $days = $this->get('days', $words, 'days'); |
| 239 | 239 | if ($duration < 60) { |
| 240 | - return $f->diff($s)->format('%s ' . $seconds); |
|
| 240 | + return $f->diff($s)->format('%s '.$seconds); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if ($duration < 3600) { |
| 244 | - return $f->diff($s)->format('%i ' . $minutes . ' and %s ' . $seconds); |
|
| 244 | + return $f->diff($s)->format('%i '.$minutes.' and %s '.$seconds); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | if ($duration < 86400) { |
| 248 | - return $f->diff($s)->format('%h ' . $hours . ', %i ' . $minutes . ' and %s ' . $seconds); |
|
| 248 | + return $f->diff($s)->format('%h '.$hours.', %i '.$minutes.' and %s '.$seconds); |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | return $f->diff($s)->format( |
| 252 | - '%a ' . $days . |
|
| 253 | - ', %h ' . $hours . |
|
| 254 | - ', %i ' . $minutes . |
|
| 255 | - ' and %s ' . $seconds |
|
| 252 | + '%a '.$days. |
|
| 253 | + ', %h '.$hours. |
|
| 254 | + ', %i '.$minutes. |
|
| 255 | + ' and %s '.$seconds |
|
| 256 | 256 | ); |
| 257 | 257 | } |
| 258 | 258 | } |