TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
Mirrors.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Extensionmanager\Domain\Model
;
3
4
/*
5
* This file is part of the TYPO3 CMS project.
6
*
7
* It is free software; you can redistribute it and/or modify it under
8
* the terms of the GNU General Public License, either version 2
9
* of the License, or any later version.
10
*
11
* For the full copyright and license information, please read the
12
* LICENSE.txt file that was distributed with this source code.
13
*
14
* The TYPO3 project - inspiring people to share!
15
*/
16
21
class
Mirrors
extends
\TYPO3\CMS\Extbase\DomainObject\AbstractEntity
22
{
28
protected
$mirrors
= [];
29
37
protected
$currentMirror
;
38
45
protected
$isRandomSelection
=
true
;
46
53
public
function
setSelect
($mirrorId =
null
)
54
{
55
if
($mirrorId ===
null
) {
56
$this->isRandomSelection =
true
;
57
}
else
{
58
if
(is_int($mirrorId) && $mirrorId >= 1 && $mirrorId <= count($this->mirrors)) {
59
$this->currentMirror = $mirrorId - 1;
60
}
61
}
62
}
63
72
public
function
getMirror
()
73
{
74
$sumMirrors = count($this->mirrors);
75
if
($sumMirrors > 0) {
76
if
(!is_int($this->currentMirror)) {
77
$this->currentMirror = rand(0, $sumMirrors - 1);
78
}
79
return
$this->mirrors[
$this->currentMirror
];
80
}
81
return
null
;
82
}
83
89
public
function
getMirrorUrl
()
90
{
91
$mirror = $this->
getMirror
();
92
$mirrorUrl = $mirror[
'host'
] . $mirror[
'path'
];
93
return
'https://'
. $mirrorUrl;
94
}
95
102
public
function
getMirrors
()
103
{
104
return
$this->mirrors
;
105
}
106
113
public
function
setMirrors
(array
$mirrors
)
114
{
115
if
(count(
$mirrors
) >= 1) {
116
$this->mirrors =
$mirrors
;
117
}
118
}
119
}
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\$currentMirror
int $currentMirror
Definition:
Mirrors.php:35
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\getMirrors
array getMirrors()
Definition:
Mirrors.php:99
TYPO3\CMS\Extbase\DomainObject\AbstractEntity
Definition:
AbstractEntity.php:22
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\setSelect
setSelect($mirrorId=null)
Definition:
Mirrors.php:50
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors
Definition:
Mirrors.php:22
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\getMirrorUrl
string getMirrorUrl()
Definition:
Mirrors.php:86
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\$mirrors
array $mirrors
Definition:
Mirrors.php:27
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\setMirrors
setMirrors(array $mirrors)
Definition:
Mirrors.php:110
TYPO3\CMS\Extensionmanager\Domain\Model
Definition:
Dependency.php:2
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\$isRandomSelection
bool $isRandomSelection
Definition:
Mirrors.php:42
TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors\getMirror
array getMirror()
Definition:
Mirrors.php:69
doxygen
typo3
sysext
extensionmanager
Classes
Domain
Model
Mirrors.php
Generated on Tue Oct 5 2021 01:57:35 for TYPO3CMS by
1.8.18