1<?php
2
3/**
4 * Licensed to Jasig under one or more contributor license
5 * agreements. See the NOTICE file distributed with this work for
6 * additional information regarding copyright ownership.
7 *
8 * Jasig licenses this file to you under the Apache License,
9 * Version 2.0 (the "License"); you may not use this file except in
10 * compliance with the License. You may obtain a copy of the License at:
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 *
20 * PHP Version 7
21 *
22 * @file     CAS/ServiceBaseUrl/Static.php
23 * @category Authentication
24 * @package  PhpCAS
25 * @author   Henry Pan <git@phy25.com>
26 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
27 * @link     https://wiki.jasig.org/display/CASC/phpCAS
28 */
29
30
31/**
32 * Class that gets the server name of the PHP server by statically set
33 * hostname and port. This is used to generate service URL and PGT
34 * callback URL.
35 *
36 * @class    CAS_ServiceBaseUrl_Static
37 * @category Authentication
38 * @package  PhpCAS
39 * @author   Henry Pan <git@phy25.com>
40 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
41 * @link     https://wiki.jasig.org/display/CASC/phpCAS
42 */
43
44class CAS_ServiceBaseUrl_Static
45extends CAS_ServiceBaseUrl_Base
46{
47    private $_name = null;
48
49    public function __construct($name) {
50        if (is_string($name)) {
51            $this->_name = $this->removeStandardPort($name);
52        } else {
53            throw new CAS_TypeMismatchException($name, '$name', 'string');
54        }
55    }
56
57    /**
58     * Get the server name through static config.
59     *
60     * @return string the server hostname and port of the server configured
61     */
62    public function get()
63    {
64        phpCAS::traceBegin();
65        phpCAS::trace("Returning static server name: " . $this->_name);
66        phpCAS::traceEnd(true);
67        return $this->_name;
68    }
69}