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 5
21 *
22 * @file     CAS/Request/MultiRequestInterface.php
23 * @category Authentication
24 * @package  PhpCAS
25 * @author   Adam Franco <afranco@middlebury.edu>
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 * This interface defines a class library for performing multiple web requests
32 * in batches. Implementations of this interface may perform requests serially
33 * or in parallel.
34 *
35 * @class    CAS_Request_MultiRequestInterface
36 * @category Authentication
37 * @package  PhpCAS
38 * @author   Adam Franco <afranco@middlebury.edu>
39 * @license  http://www.apache.org/licenses/LICENSE-2.0  Apache License 2.0
40 * @link     https://wiki.jasig.org/display/CASC/phpCAS
41 */
42interface CAS_Request_MultiRequestInterface
43{
44
45    /*********************************************************
46     * Add Requests
47    *********************************************************/
48
49    /**
50     * Add a new Request to this batch.
51     * Note, implementations will likely restrict requests to their own concrete
52     * class hierarchy.
53     *
54     * @param CAS_Request_RequestInterface $request request interface
55     *
56     * @return void
57     * @throws CAS_OutOfSequenceException If called after the Request has been
58     * sent.
59     * @throws CAS_InvalidArgumentException If passed a Request of the wrong
60     * implmentation.
61     */
62    public function addRequest (CAS_Request_RequestInterface $request);
63
64    /**
65     * Retrieve the number of requests added to this batch.
66     *
67     * @return int number of request elements
68     */
69    public function getNumRequests ();
70
71    /*********************************************************
72     * 2. Send the Request
73    *********************************************************/
74
75    /**
76     * Perform the request. After sending, all requests will have their
77     * responses poulated.
78     *
79     * @return bool TRUE on success, FALSE on failure.
80     * @throws CAS_OutOfSequenceException If called multiple times.
81     */
82    public function send ();
83}
84