Commit ec37e734b3e21f09688b2e3065eba561581d5107
1 parent
7b17b712
Exists in
master
and in
1 other branch
[FEAT] Subindo implementações e ajustes de serviços
Showing
55 changed files
with
883 additions
and
189 deletions
Show diff stats
composer.lock
@@ -227,23 +227,24 @@ | @@ -227,23 +227,24 @@ | ||
227 | }, | 227 | }, |
228 | { | 228 | { |
229 | "name": "slim/slim", | 229 | "name": "slim/slim", |
230 | - "version": "3.7.0", | 230 | + "version": "3.8.1", |
231 | "source": { | 231 | "source": { |
232 | "type": "git", | 232 | "type": "git", |
233 | "url": "https://github.com/slimphp/Slim.git", | 233 | "url": "https://github.com/slimphp/Slim.git", |
234 | - "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef" | 234 | + "reference": "5385302707530b2bccee1769613ad769859b826d" |
235 | }, | 235 | }, |
236 | "dist": { | 236 | "dist": { |
237 | "type": "zip", | 237 | "type": "zip", |
238 | - "url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef", | ||
239 | - "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef", | 238 | + "url": "https://api.github.com/repos/slimphp/Slim/zipball/5385302707530b2bccee1769613ad769859b826d", |
239 | + "reference": "5385302707530b2bccee1769613ad769859b826d", | ||
240 | "shasum": "" | 240 | "shasum": "" |
241 | }, | 241 | }, |
242 | "require": { | 242 | "require": { |
243 | - "container-interop/container-interop": "^1.1", | 243 | + "container-interop/container-interop": "^1.2", |
244 | "nikic/fast-route": "^1.0", | 244 | "nikic/fast-route": "^1.0", |
245 | "php": ">=5.5.0", | 245 | "php": ">=5.5.0", |
246 | "pimple/pimple": "^3.0", | 246 | "pimple/pimple": "^3.0", |
247 | + "psr/container": "^1.0", | ||
247 | "psr/http-message": "^1.0" | 248 | "psr/http-message": "^1.0" |
248 | }, | 249 | }, |
249 | "provide": { | 250 | "provide": { |
@@ -293,7 +294,7 @@ | @@ -293,7 +294,7 @@ | ||
293 | "micro", | 294 | "micro", |
294 | "router" | 295 | "router" |
295 | ], | 296 | ], |
296 | - "time": "2016-12-20T20:30:47+00:00" | 297 | + "time": "2017-03-19T17:55:20+00:00" |
297 | } | 298 | } |
298 | ], | 299 | ], |
299 | "packages-dev": [], | 300 | "packages-dev": [], |
controlador_ws.php
@@ -457,6 +457,22 @@ $app->group('/api/v1',function(){ | @@ -457,6 +457,22 @@ $app->group('/api/v1',function(){ | ||
457 | $rn = new MdWsSeiProcedimentoRN(); | 457 | $rn = new MdWsSeiProcedimentoRN(); |
458 | return $response->withJSON($rn->atribuirProcesso($api)); | 458 | return $response->withJSON($rn->atribuirProcesso($api)); |
459 | }); | 459 | }); |
460 | + $this->get('/verifica/acesso/{protocolo}', function($request, $response, $args){ | ||
461 | + /** @var $request Slim\Http\Request */ | ||
462 | + $rn = new MdWsSeiProcedimentoRN(); | ||
463 | + $dto = new ProtocoloDTO(); | ||
464 | + $dto->setDblIdProtocolo($request->getAttribute('route')->getArgument('protocolo')); | ||
465 | + return $response->withJSON($rn->verificaAcesso($dto)); | ||
466 | + }); | ||
467 | + $this->post('/identificacao/acesso', function($request, $response, $args){ | ||
468 | + /** @var $request Slim\Http\Request */ | ||
469 | + $usuarioDTO = new UsuarioDTO(); | ||
470 | + $usuarioDTO->setStrSenha($request->getParam('senha')); | ||
471 | + $protocoloDTO = new ProtocoloDTO(); | ||
472 | + $protocoloDTO->setDblIdProtocolo($request->getParam('protocolo')); | ||
473 | + $rn = new MdWsSeiProcedimentoRN(); | ||
474 | + return $response->withJSON($rn->identificacaoAcesso($usuarioDTO, $protocoloDTO)); | ||
475 | + }); | ||
460 | 476 | ||
461 | })->add( new TokenValidationMiddleware()); | 477 | })->add( new TokenValidationMiddleware()); |
462 | 478 |
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +<? | ||
2 | + | ||
3 | +class MdWsSeiAtividadeDTO extends AtividadeDTO{ | ||
4 | + | ||
5 | + public function montar(){ | ||
6 | + parent::montar(); | ||
7 | + | ||
8 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, | ||
9 | + 'ProtocoloFormatadoPesquisaProtocolo', | ||
10 | + 'protocolo_formatado_pesquisa', | ||
11 | + 'protocolo'); | ||
12 | + | ||
13 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, | ||
14 | + 'IdGrupoAcompanhamentoProcedimento', | ||
15 | + 'id_grupo_acompanhamento', | ||
16 | + 'acompanhamento'); | ||
17 | + | ||
18 | + | ||
19 | + $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); | ||
20 | + } | ||
21 | + | ||
22 | +} |
@@ -0,0 +1,22 @@ | @@ -0,0 +1,22 @@ | ||
1 | +<? | ||
2 | + | ||
3 | +class MdWsSeiPesquisarPendenciaDTO extends PesquisaPendenciaDTO{ | ||
4 | + | ||
5 | + public function montar(){ | ||
6 | + parent::montar(); | ||
7 | + | ||
8 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_STR, | ||
9 | + 'ProtocoloFormatadoPesquisaProtocolo', | ||
10 | + 'protocolo_formatado_pesquisa', | ||
11 | + 'protocolo'); | ||
12 | + | ||
13 | + $this->adicionarAtributoTabelaRelacionada(InfraDTO::$PREFIXO_NUM, | ||
14 | + 'IdGrupoAcompanhamentoProcedimento', | ||
15 | + 'id_grupo_acompanhamento', | ||
16 | + 'acompanhamento'); | ||
17 | + | ||
18 | + | ||
19 | + $this->configurarFK('IdProtocolo', 'acompanhamento', 'id_protocolo'); | ||
20 | + } | ||
21 | + | ||
22 | +} |
rn/MdWsSeiAtividadeRN.php
1 | <? | 1 | <? |
2 | require_once dirname(__FILE__).'/../../../SEI.php'; | 2 | require_once dirname(__FILE__).'/../../../SEI.php'; |
3 | 3 | ||
4 | -class MdWsSeiAtividadeRN extends InfraRN { | 4 | +class MdWsSeiAtividadeRN extends AtividadeRN { |
5 | 5 | ||
6 | protected function inicializarObjInfraIBanco(){ | 6 | protected function inicializarObjInfraIBanco(){ |
7 | return BancoSEI::getInstance(); | 7 | return BancoSEI::getInstance(); |
@@ -109,6 +109,320 @@ class MdWsSeiAtividadeRN extends InfraRN { | @@ -109,6 +109,320 @@ class MdWsSeiAtividadeRN extends InfraRN { | ||
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | + /** | ||
113 | + * Método clonado de AtividadeRN::listarPendenciasRN0754Conectado com alterações para pesquisa de processo | ||
114 | + * @param MdWsSeiPesquisarPendenciaDTO $objPesquisaPendenciaDTO | ||
115 | + * @return array | ||
116 | + * @throws InfraException | ||
117 | + */ | ||
118 | + protected function listarPendenciasConectado(MdWsSeiPesquisarPendenciaDTO $objPesquisaPendenciaDTO) { | ||
119 | + try { | ||
120 | + if (!$objPesquisaPendenciaDTO->isSetStrStaTipoAtribuicao()) { | ||
121 | + $objPesquisaPendenciaDTO->setStrStaTipoAtribuicao(self::$TA_TODAS); | ||
122 | + } | ||
123 | + | ||
124 | + if (!$objPesquisaPendenciaDTO->isSetNumIdUsuarioAtribuicao()) { | ||
125 | + $objPesquisaPendenciaDTO->setNumIdUsuarioAtribuicao(null); | ||
126 | + } | ||
127 | + | ||
128 | + if (!$objPesquisaPendenciaDTO->isSetStrSinMontandoArvore()) { | ||
129 | + $objPesquisaPendenciaDTO->setStrSinMontandoArvore('N'); | ||
130 | + } | ||
131 | + | ||
132 | + if (!$objPesquisaPendenciaDTO->isSetStrSinAnotacoes()) { | ||
133 | + $objPesquisaPendenciaDTO->setStrSinAnotacoes('N'); | ||
134 | + } | ||
135 | + | ||
136 | + if (!$objPesquisaPendenciaDTO->isSetStrSinSituacoes()) { | ||
137 | + $objPesquisaPendenciaDTO->setStrSinSituacoes('N'); | ||
138 | + } | ||
139 | + | ||
140 | + if (!$objPesquisaPendenciaDTO->isSetStrSinMarcadores()) { | ||
141 | + $objPesquisaPendenciaDTO->setStrSinMarcadores('N'); | ||
142 | + } | ||
143 | + | ||
144 | + if (!$objPesquisaPendenciaDTO->isSetStrSinInteressados()) { | ||
145 | + $objPesquisaPendenciaDTO->setStrSinInteressados('N'); | ||
146 | + } | ||
147 | + | ||
148 | + if (!$objPesquisaPendenciaDTO->isSetStrSinRetornoProgramado()) { | ||
149 | + $objPesquisaPendenciaDTO->setStrSinRetornoProgramado('N'); | ||
150 | + } | ||
151 | + | ||
152 | + if (!$objPesquisaPendenciaDTO->isSetStrSinCredenciais()) { | ||
153 | + $objPesquisaPendenciaDTO->setStrSinCredenciais('N'); | ||
154 | + } | ||
155 | + | ||
156 | + if (!$objPesquisaPendenciaDTO->isSetStrSinHoje()) { | ||
157 | + $objPesquisaPendenciaDTO->setStrSinHoje('N'); | ||
158 | + } | ||
159 | + | ||
160 | + $objAtividadeDTO = new MdWsSeiAtividadeDTO(); | ||
161 | + $objAtividadeDTO->retNumIdAtividade(); | ||
162 | + $objAtividadeDTO->retNumIdTarefa(); | ||
163 | + $objAtividadeDTO->retNumIdUsuarioAtribuicao(); | ||
164 | + $objAtividadeDTO->retNumIdUsuarioVisualizacao(); | ||
165 | + $objAtividadeDTO->retNumTipoVisualizacao(); | ||
166 | + $objAtividadeDTO->retNumIdUnidade(); | ||
167 | + $objAtividadeDTO->retDthConclusao(); | ||
168 | + $objAtividadeDTO->retDblIdProtocolo(); | ||
169 | + $objAtividadeDTO->retStrSiglaUnidade(); | ||
170 | + $objAtividadeDTO->retStrSinInicial(); | ||
171 | + $objAtividadeDTO->retNumIdUsuarioAtribuicao(); | ||
172 | + $objAtividadeDTO->retStrSiglaUsuarioAtribuicao(); | ||
173 | + $objAtividadeDTO->retStrNomeUsuarioAtribuicao(); | ||
174 | + | ||
175 | + $objAtividadeDTO->setNumIdUnidade($objPesquisaPendenciaDTO->getNumIdUnidade()); | ||
176 | + | ||
177 | + if ($objPesquisaPendenciaDTO->isSetStrProtocoloFormatadoPesquisaProtocolo()) { | ||
178 | + $strProtocoloFormatado = InfraUtil::retirarFormatacao( | ||
179 | + $objPesquisaPendenciaDTO->getStrProtocoloFormatadoPesquisaProtocolo(), false | ||
180 | + ); | ||
181 | + $objAtividadeDTO->setStrProtocoloFormatadoPesquisaProtocolo( | ||
182 | + '%'.$strProtocoloFormatado.'%', | ||
183 | + InfraDTO::$OPER_LIKE | ||
184 | + ); | ||
185 | + } | ||
186 | + if ($objPesquisaPendenciaDTO->isSetNumIdGrupoAcompanhamentoProcedimento()) { | ||
187 | + $objAtividadeDTO->setNumIdGrupoAcompanhamentoProcedimento($objPesquisaPendenciaDTO->getNumIdGrupoAcompanhamentoProcedimento()); | ||
188 | + } | ||
189 | + | ||
190 | + if ($objPesquisaPendenciaDTO->getStrSinHoje() == 'N') { | ||
191 | + $objAtividadeDTO->setDthConclusao(null); | ||
192 | + } else { | ||
193 | + $objAtividadeDTO->adicionarCriterio(array('Conclusao', 'Conclusao'), | ||
194 | + array(InfraDTO::$OPER_IGUAL, InfraDTO::$OPER_MAIOR_IGUAL), | ||
195 | + array(null, InfraData::getStrDataAtual() . ' 00:00:00'), | ||
196 | + array(InfraDTO::$OPER_LOGICO_OR)); | ||
197 | + } | ||
198 | + | ||
199 | + $objAtividadeDTO->setStrStaProtocoloProtocolo(ProtocoloRN::$TP_PROCEDIMENTO); | ||
200 | + | ||
201 | + if ($objPesquisaPendenciaDTO->getNumIdUsuario() == null) { | ||
202 | + $objAtividadeDTO->setStrStaNivelAcessoGlobalProtocolo(ProtocoloRN::$NA_SIGILOSO, InfraDTO::$OPER_DIFERENTE); | ||
203 | + } else { | ||
204 | + $objAtividadeDTO->adicionarCriterio(array('StaNivelAcessoGlobalProtocolo', 'IdUsuario'), | ||
205 | + array(InfraDTO::$OPER_DIFERENTE, InfraDTO::$OPER_IGUAL), | ||
206 | + array(ProtocoloRN::$NA_SIGILOSO, $objPesquisaPendenciaDTO->getNumIdUsuario()), | ||
207 | + array(InfraDTO::$OPER_LOGICO_OR)); | ||
208 | + } | ||
209 | + | ||
210 | + if ($objPesquisaPendenciaDTO->getStrStaTipoAtribuicao() == self::$TA_MINHAS) { | ||
211 | + $objAtividadeDTO->setNumIdUsuarioAtribuicao($objPesquisaPendenciaDTO->getNumIdUsuario()); | ||
212 | + } else if ($objPesquisaPendenciaDTO->getStrStaTipoAtribuicao() == self::$TA_DEFINIDAS) { | ||
213 | + $objAtividadeDTO->setNumIdUsuarioAtribuicao(null, InfraDTO::$OPER_DIFERENTE); | ||
214 | + } else if ($objPesquisaPendenciaDTO->getStrStaTipoAtribuicao() == self::$TA_ESPECIFICAS) { | ||
215 | + $objAtividadeDTO->setNumIdUsuarioAtribuicao($objPesquisaPendenciaDTO->getNumIdUsuarioAtribuicao()); | ||
216 | + } | ||
217 | + | ||
218 | + if ($objPesquisaPendenciaDTO->isSetDblIdProtocolo()) { | ||
219 | + if (!is_array($objPesquisaPendenciaDTO->getDblIdProtocolo())) { | ||
220 | + $objAtividadeDTO->setDblIdProtocolo($objPesquisaPendenciaDTO->getDblIdProtocolo()); | ||
221 | + } else { | ||
222 | + $objAtividadeDTO->setDblIdProtocolo($objPesquisaPendenciaDTO->getDblIdProtocolo(), InfraDTO::$OPER_IN); | ||
223 | + } | ||
224 | + } | ||
225 | + | ||
226 | + if ($objPesquisaPendenciaDTO->isSetStrStaEstadoProcedimento()) { | ||
227 | + if (is_array($objPesquisaPendenciaDTO->getStrStaEstadoProcedimento())) { | ||
228 | + $objAtividadeDTO->setStrStaEstadoProtocolo($objPesquisaPendenciaDTO->getStrStaEstadoProcedimento(), InfraDTO::$OPER_IN); | ||
229 | + } else { | ||
230 | + $objAtividadeDTO->setStrStaEstadoProtocolo($objPesquisaPendenciaDTO->getStrStaEstadoProcedimento()); | ||
231 | + } | ||
232 | + } | ||
233 | + | ||
234 | + if ($objPesquisaPendenciaDTO->isSetStrSinInicial()) { | ||
235 | + $objAtividadeDTO->setStrSinInicial($objPesquisaPendenciaDTO->getStrSinInicial()); | ||
236 | + } | ||
237 | + | ||
238 | + if ($objPesquisaPendenciaDTO->isSetNumIdMarcador()) { | ||
239 | + $objAtividadeDTO->setNumTipoFkAndamentoMarcador(InfraDTO::$TIPO_FK_OBRIGATORIA); | ||
240 | + $objAtividadeDTO->setNumIdMarcador($objPesquisaPendenciaDTO->getNumIdMarcador()); | ||
241 | + $objAtividadeDTO->setStrSinUltimoAndamentoMarcador('S'); | ||
242 | + } | ||
243 | + | ||
244 | + //ordenar pela data de abertura descendente | ||
245 | + //$objAtividadeDTO->setOrdDthAbertura(InfraDTO::$TIPO_ORDENACAO_DESC); | ||
246 | + $objAtividadeDTO->setOrdNumIdAtividade(InfraDTO::$TIPO_ORDENACAO_DESC); | ||
247 | + | ||
248 | + | ||
249 | + //paginação | ||
250 | + $objAtividadeDTO->setNumMaxRegistrosRetorno($objPesquisaPendenciaDTO->getNumMaxRegistrosRetorno()); | ||
251 | + $objAtividadeDTO->setNumPaginaAtual($objPesquisaPendenciaDTO->getNumPaginaAtual()); | ||
252 | + | ||
253 | + $arrAtividadeDTO = $this->listarRN0036($objAtividadeDTO); | ||
254 | + | ||
255 | + //paginação | ||
256 | + $objPesquisaPendenciaDTO->setNumTotalRegistros($objAtividadeDTO->getNumTotalRegistros()); | ||
257 | + $objPesquisaPendenciaDTO->setNumRegistrosPaginaAtual($objAtividadeDTO->getNumRegistrosPaginaAtual()); | ||
258 | + | ||
259 | + $arrProcedimentos = array(); | ||
260 | + | ||
261 | + //Se encontrou pelo menos um registro | ||
262 | + if (count($arrAtividadeDTO) > 0) { | ||
263 | + | ||
264 | + $objProcedimentoDTO = new ProcedimentoDTO(); | ||
265 | + | ||
266 | + $objProcedimentoDTO->retStrDescricaoProtocolo(); | ||
267 | + | ||
268 | + $arrProtocolosAtividades = array_unique(InfraArray::converterArrInfraDTO($arrAtividadeDTO, 'IdProtocolo')); | ||
269 | + $objProcedimentoDTO->setDblIdProcedimento($arrProtocolosAtividades, InfraDTO::$OPER_IN); | ||
270 | + | ||
271 | + if ($objPesquisaPendenciaDTO->getStrSinMontandoArvore() == 'S') { | ||
272 | + $objProcedimentoDTO->setStrSinMontandoArvore('S'); | ||
273 | + } | ||
274 | + | ||
275 | + if ($objPesquisaPendenciaDTO->getStrSinAnotacoes() == 'S') { | ||
276 | + $objProcedimentoDTO->setStrSinAnotacoes('S'); | ||
277 | + } | ||
278 | + | ||
279 | + if ($objPesquisaPendenciaDTO->getStrSinSituacoes() == 'S') { | ||
280 | + $objProcedimentoDTO->setStrSinSituacoes('S'); | ||
281 | + } | ||
282 | + | ||
283 | + if ($objPesquisaPendenciaDTO->getStrSinMarcadores() == 'S') { | ||
284 | + $objProcedimentoDTO->setStrSinMarcadores('S'); | ||
285 | + } | ||
286 | + | ||
287 | + if ($objPesquisaPendenciaDTO->isSetDblIdDocumento()) { | ||
288 | + $objProcedimentoDTO->setArrDblIdProtocoloAssociado(array($objPesquisaPendenciaDTO->getDblIdDocumento())); | ||
289 | + } | ||
290 | + | ||
291 | + $objProcedimentoRN = new ProcedimentoRN(); | ||
292 | + | ||
293 | + $arr = $objProcedimentoRN->listarCompleto($objProcedimentoDTO); | ||
294 | + | ||
295 | + $arrObjParticipanteDTO = null; | ||
296 | + if ($objPesquisaPendenciaDTO->getStrSinInteressados() == 'S') { | ||
297 | + | ||
298 | + $arrObjParticipanteDTO = array(); | ||
299 | + | ||
300 | + $objParticipanteDTO = new ParticipanteDTO(); | ||
301 | + $objParticipanteDTO->retDblIdProtocolo(); | ||
302 | + $objParticipanteDTO->retStrSiglaContato(); | ||
303 | + $objParticipanteDTO->retStrNomeContato(); | ||
304 | + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_INTERESSADO); | ||
305 | + $objParticipanteDTO->setDblIdProtocolo($arrProtocolosAtividades, InfraDTO::$OPER_IN); | ||
306 | + | ||
307 | + $objParticipanteRN = new ParticipanteRN(); | ||
308 | + $arrTemp = $objParticipanteRN->listarRN0189($objParticipanteDTO); | ||
309 | + | ||
310 | + foreach ($arrTemp as $objParticipanteDTO) { | ||
311 | + if (!isset($arrObjParticipanteDTO[$objParticipanteDTO->getDblIdProtocolo()])) { | ||
312 | + $arrObjParticipanteDTO[$objParticipanteDTO->getDblIdProtocolo()] = array($objParticipanteDTO); | ||
313 | + } else { | ||
314 | + $arrObjParticipanteDTO[$objParticipanteDTO->getDblIdProtocolo()][] = $objParticipanteDTO; | ||
315 | + } | ||
316 | + } | ||
317 | + } | ||
318 | + | ||
319 | + $arrObjRetornoProgramadoDTO = null; | ||
320 | + if ($objPesquisaPendenciaDTO->getStrSinRetornoProgramado() == 'S') { | ||
321 | + $objRetornoProgramadoDTO = new RetornoProgramadoDTO(); | ||
322 | + $objRetornoProgramadoDTO->retDblIdProtocoloAtividadeEnvio(); | ||
323 | + $objRetornoProgramadoDTO->retStrSiglaUnidadeOrigemAtividadeEnvio(); | ||
324 | + $objRetornoProgramadoDTO->retDtaProgramada(); | ||
325 | + $objRetornoProgramadoDTO->setNumIdUnidadeAtividadeEnvio($objPesquisaPendenciaDTO->getNumIdUnidade()); | ||
326 | + $objRetornoProgramadoDTO->setDblIdProtocoloAtividadeEnvio($arrProtocolosAtividades, InfraDTO::$OPER_IN); | ||
327 | + $objRetornoProgramadoDTO->setNumIdAtividadeRetorno(null); | ||
328 | + | ||
329 | + $objRetornoProgramadoRN = new RetornoProgramadoRN(); | ||
330 | + $arrObjRetornoProgramadoDTO = InfraArray::indexarArrInfraDTO($objRetornoProgramadoRN->listar($objRetornoProgramadoDTO), 'IdProtocoloAtividadeEnvio', true); | ||
331 | + } | ||
332 | + | ||
333 | + | ||
334 | + //Manter ordem obtida na listagem das atividades | ||
335 | + $arrAdicionados = array(); | ||
336 | + $arrIdProcedimentoSigiloso = array(); | ||
337 | + | ||
338 | + $arr = InfraArray::indexarArrInfraDTO($arr, 'IdProcedimento'); | ||
339 | + | ||
340 | + foreach ($arrAtividadeDTO as $objAtividadeDTO) { | ||
341 | + | ||
342 | + $objProcedimentoDTO = $arr[$objAtividadeDTO->getDblIdProtocolo()]; | ||
343 | + | ||
344 | + //pode não existir se o procedimento foi excluído | ||
345 | + if ($objProcedimentoDTO != null) { | ||
346 | + | ||
347 | + $dblIdProcedimento = $objProcedimentoDTO->getDblIdProcedimento(); | ||
348 | + | ||
349 | + if ($objProcedimentoDTO->getStrStaNivelAcessoGlobalProtocolo() == ProtocoloRN::$NA_SIGILOSO) { | ||
350 | + | ||
351 | + $objProcedimentoDTO->setStrSinCredencialProcesso('N'); | ||
352 | + $objProcedimentoDTO->setStrSinCredencialAssinatura('N'); | ||
353 | + | ||
354 | + $arrIdProcedimentoSigiloso[] = $dblIdProcedimento; | ||
355 | + } | ||
356 | + | ||
357 | + if (!isset($arrAdicionados[$dblIdProcedimento])) { | ||
358 | + | ||
359 | + $objProcedimentoDTO->setArrObjAtividadeDTO(array($objAtividadeDTO)); | ||
360 | + | ||
361 | + if (is_array($arrObjParticipanteDTO)) { | ||
362 | + if (isset($arrObjParticipanteDTO[$dblIdProcedimento])) { | ||
363 | + $objProcedimentoDTO->setArrObjParticipanteDTO($arrObjParticipanteDTO[$dblIdProcedimento]); | ||
364 | + } else { | ||
365 | + $objProcedimentoDTO->setArrObjParticipanteDTO(null); | ||
366 | + } | ||
367 | + } | ||
368 | + | ||
369 | + if (is_array($arrObjRetornoProgramadoDTO)) { | ||
370 | + if (isset($arrObjRetornoProgramadoDTO[$dblIdProcedimento])) { | ||
371 | + $objProcedimentoDTO->setArrObjRetornoProgramadoDTO($arrObjRetornoProgramadoDTO[$dblIdProcedimento]); | ||
372 | + } else { | ||
373 | + $objProcedimentoDTO->setArrObjRetornoProgramadoDTO(null); | ||
374 | + } | ||
375 | + } | ||
376 | + | ||
377 | + $arrProcedimentos[] = $objProcedimentoDTO; | ||
378 | + $arrAdicionados[$dblIdProcedimento] = 0; | ||
379 | + } else { | ||
380 | + $arrAtividadeDTOProcedimento = $objProcedimentoDTO->getArrObjAtividadeDTO(); | ||
381 | + $arrAtividadeDTOProcedimento[] = $objAtividadeDTO; | ||
382 | + $objProcedimentoDTO->setArrObjAtividadeDTO($arrAtividadeDTOProcedimento); | ||
383 | + } | ||
384 | + } | ||
385 | + } | ||
386 | + | ||
387 | + | ||
388 | + if ($objPesquisaPendenciaDTO->getStrSinCredenciais() == 'S' && count($arrIdProcedimentoSigiloso)) { | ||
389 | + | ||
390 | + $objAcessoDTO = new AcessoDTO(); | ||
391 | + $objAcessoDTO->retDblIdProtocolo(); | ||
392 | + $objAcessoDTO->retStrStaTipo(); | ||
393 | + $objAcessoDTO->setNumIdUsuario($objPesquisaPendenciaDTO->getNumIdUsuario()); | ||
394 | + $objAcessoDTO->setNumIdUnidade($objPesquisaPendenciaDTO->getNumIdUnidade()); | ||
395 | + $objAcessoDTO->setStrStaTipo(array(AcessoRN::$TA_CREDENCIAL_PROCESSO, AcessoRN::$TA_CREDENCIAL_ASSINATURA_PROCESSO), InfraDTO::$OPER_IN); | ||
396 | + $objAcessoDTO->setDblIdProtocolo($arrIdProcedimentoSigiloso, InfraDTO::$OPER_IN); | ||
397 | + | ||
398 | + $objAcessoRN = new AcessoRN(); | ||
399 | + $arrObjAcessoDTO = $objAcessoRN->listar($objAcessoDTO); | ||
400 | + | ||
401 | + /* | ||
402 | + foreach($arr as $objProcedimentoDTO){ | ||
403 | + $objProcedimentoDTO->setStrSinCredencialProcesso('N'); | ||
404 | + $objProcedimentoDTO->setStrSinCredencialAssinatura('N'); | ||
405 | + } | ||
406 | + */ | ||
407 | + | ||
408 | + foreach ($arrObjAcessoDTO as $objAcessoDTO) { | ||
409 | + if ($objAcessoDTO->getStrStaTipo() == AcessoRN::$TA_CREDENCIAL_PROCESSO) { | ||
410 | + $arr[$objAcessoDTO->getDblIdProtocolo()]->setStrSinCredencialProcesso('S'); | ||
411 | + } else if ($objAcessoDTO->getStrStaTipo() == AcessoRN::$TA_CREDENCIAL_ASSINATURA_PROCESSO) { | ||
412 | + $arr[$objAcessoDTO->getDblIdProtocolo()]->setStrSinCredencialAssinatura('S'); | ||
413 | + } | ||
414 | + } | ||
415 | + | ||
416 | + } | ||
417 | + } | ||
418 | + | ||
419 | + return $arrProcedimentos; | ||
420 | + | ||
421 | + } catch (Exception $e) { | ||
422 | + throw new InfraException('Erro recuperando processos abertos.', $e); | ||
423 | + } | ||
424 | + } | ||
425 | + | ||
112 | 426 | ||
113 | 427 | ||
114 | } | 428 | } |
115 | \ No newline at end of file | 429 | \ No newline at end of file |
rn/MdWsSeiProcedimentoRN.php
@@ -176,45 +176,53 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -176,45 +176,53 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
176 | */ | 176 | */ |
177 | protected function pesquisarProcedimentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) { | 177 | protected function pesquisarProcedimentoConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam) { |
178 | try{ | 178 | try{ |
179 | + $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); | ||
180 | + | ||
179 | $usuarioAtribuicaoAtividade = null; | 181 | $usuarioAtribuicaoAtividade = null; |
180 | - $mdWsSeiProtocoloDTOConsulta = new MdWsSeiProtocoloDTO(); | ||
181 | - $mdWsSeiProtocoloDTOConsulta->retDblIdProtocolo(); | ||
182 | - $mdWsSeiProtocoloDTOConsulta->retTodos(); | ||
183 | - $mdWsSeiProtocoloDTOConsulta->retStrNomeTipoProcedimentoProcedimento(); | ||
184 | - $mdWsSeiProtocoloDTOConsulta->retStrSiglaUnidadeGeradora(); | ||
185 | - $mdWsSeiProtocoloDTOConsulta->retStrSinCienciaProcedimento(); | 182 | + if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ |
183 | + $usuarioAtribuicaoAtividade = $mdWsSeiProtocoloDTOParam->getNumIdUsuarioAtribuicaoAtividade(); | ||
184 | + } | ||
186 | 185 | ||
186 | + if(!is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | ||
187 | + $pesquisaPendenciaDTO->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); | ||
188 | + }else{ | ||
189 | + $pesquisaPendenciaDTO->setNumPaginaAtual(0); | ||
190 | + } | ||
191 | + | ||
192 | + if($mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | ||
193 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); | ||
194 | + }else{ | ||
195 | + $pesquisaPendenciaDTO->setNumMaxRegistrosRetorno(10); | ||
196 | + } | ||
187 | if($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()){ | 197 | if($mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento()){ |
188 | - $mdWsSeiProtocoloDTOConsulta->setNumIdGrupoAcompanhamentoProcedimento( | ||
189 | - $mdWsSeiProtocoloDTOParam->isSetNumIdGrupoAcompanhamentoProcedimento() | 198 | + $pesquisaPendenciaDTO->setNumIdGrupoAcompanhamentoProcedimento( |
199 | + $mdWsSeiProtocoloDTOParam->getNumIdGrupoAcompanhamentoProcedimento() | ||
190 | ); | 200 | ); |
191 | } | 201 | } |
192 | if($mdWsSeiProtocoloDTOParam->isSetStrProtocoloFormatadoPesquisa()){ | 202 | if($mdWsSeiProtocoloDTOParam->isSetStrProtocoloFormatadoPesquisa()){ |
193 | $strProtocoloFormatado = InfraUtil::retirarFormatacao( | 203 | $strProtocoloFormatado = InfraUtil::retirarFormatacao( |
194 | - $mdWsSeiProtocoloDTOParam->getStrProtocoloFormatadoPesquisa(), false | ||
195 | - ); | ||
196 | - $mdWsSeiProtocoloDTOConsulta->setStrProtocoloFormatadoPesquisa( | 204 | + $mdWsSeiProtocoloDTOParam->getStrProtocoloFormatadoPesquisa(), false |
205 | + ); | ||
206 | + $pesquisaPendenciaDTO->setStrProtocoloFormatadoPesquisaProtocolo( | ||
197 | '%'.$strProtocoloFormatado.'%', | 207 | '%'.$strProtocoloFormatado.'%', |
198 | InfraDTO::$OPER_LIKE | 208 | InfraDTO::$OPER_LIKE |
199 | ); | 209 | ); |
200 | } | 210 | } |
201 | 211 | ||
202 | - if(is_null($mdWsSeiProtocoloDTOParam->getNumPaginaAtual())){ | ||
203 | - $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual(0); | ||
204 | - }else{ | ||
205 | - $mdWsSeiProtocoloDTOConsulta->setNumPaginaAtual($mdWsSeiProtocoloDTOParam->getNumPaginaAtual()); | ||
206 | - } | 212 | + $atividadeRN = new MdWsSeiAtividadeRN(); |
213 | + $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | ||
214 | + $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | ||
215 | + $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | ||
216 | + $pesquisaPendenciaDTO->setStrSinAnotacoes('S'); | ||
217 | + $pesquisaPendenciaDTO->setStrSinRetornoProgramado('S'); | ||
218 | + $pesquisaPendenciaDTO->setStrSinCredenciais('S'); | ||
219 | + $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | ||
220 | + $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | ||
207 | 221 | ||
208 | - if(!$mdWsSeiProtocoloDTOParam->isSetNumMaxRegistrosRetorno()){ | ||
209 | - $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno(10); | ||
210 | - }else{ | ||
211 | - $mdWsSeiProtocoloDTOConsulta->setNumMaxRegistrosRetorno($mdWsSeiProtocoloDTOParam->getNumMaxRegistrosRetorno()); | ||
212 | - } | ||
213 | - $protocoloRN = new ProtocoloRN(); | ||
214 | - $ret = $protocoloRN->listarRN0668($mdWsSeiProtocoloDTOConsulta); | 222 | + $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
215 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); | 223 | $result = $this->montaRetornoListagemProcessos($ret, $usuarioAtribuicaoAtividade); |
216 | 224 | ||
217 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $mdWsSeiProtocoloDTOConsulta->getNumTotalRegistros()); | 225 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result, $pesquisaPendenciaDTO->getNumTotalRegistros()); |
218 | }catch (Exception $e){ | 226 | }catch (Exception $e){ |
219 | return MdWsSeiRest::formataRetornoErroREST($e); | 227 | return MdWsSeiRest::formataRetornoErroREST($e); |
220 | } | 228 | } |
@@ -227,7 +235,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -227,7 +235,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
227 | */ | 235 | */ |
228 | protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam){ | 236 | protected function listarProcessosConectado(MdWsSeiProtocoloDTO $mdWsSeiProtocoloDTOParam){ |
229 | try{ | 237 | try{ |
230 | - $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | 238 | + $pesquisaPendenciaDTO = new MdWsSeiPesquisarPendenciaDTO(); |
231 | 239 | ||
232 | $usuarioAtribuicaoAtividade = null; | 240 | $usuarioAtribuicaoAtividade = null; |
233 | if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ | 241 | if($mdWsSeiProtocoloDTOParam->isSetNumIdUsuarioAtribuicaoAtividade()){ |
@@ -249,7 +257,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -249,7 +257,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
249 | $pesquisaPendenciaDTO->setStrStaTipoAtribuicao('M'); | 257 | $pesquisaPendenciaDTO->setStrStaTipoAtribuicao('M'); |
250 | } | 258 | } |
251 | 259 | ||
252 | - $atividadeRN = new AtividadeRN(); | 260 | + $atividadeRN = new MdWsSeiAtividadeRN(); |
253 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | 261 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
254 | $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); | 262 | $pesquisaPendenciaDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual()); |
255 | $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); | 263 | $pesquisaPendenciaDTO->setStrStaEstadoProcedimento(array(ProtocoloRN::$TE_NORMAL,ProtocoloRN::$TE_PROCEDIMENTO_BLOQUEADO)); |
@@ -261,10 +269,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -261,10 +269,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
261 | 269 | ||
262 | if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_R){ | 270 | if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_R){ |
263 | $pesquisaPendenciaDTO->setStrSinInicial('N'); | 271 | $pesquisaPendenciaDTO->setStrSinInicial('N'); |
264 | - $ret = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | 272 | + $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
265 | }else if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G){ | 273 | }else if($mdWsSeiProtocoloDTOParam->getStrSinTipoBusca() == MdWsSeiProtocoloDTO::SIN_TIPO_BUSCA_G){ |
266 | $pesquisaPendenciaDTO->setStrSinInicial('S'); | 274 | $pesquisaPendenciaDTO->setStrSinInicial('S'); |
267 | - $ret = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | 275 | + $ret = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
268 | }else{ | 276 | }else{ |
269 | throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); | 277 | throw new InfraException('O tipo de busca deve ser (R)ecebidos ou (G)erados'); |
270 | } | 278 | } |
@@ -297,6 +305,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -297,6 +305,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
297 | $tipoVisualizacao = 'N'; | 305 | $tipoVisualizacao = 'N'; |
298 | $retornoProgramado = 'N'; | 306 | $retornoProgramado = 'N'; |
299 | $retornoAtrasado = 'N'; | 307 | $retornoAtrasado = 'N'; |
308 | + $arrDadosAbertura = array(); | ||
309 | + $procedimentoDTO = null; | ||
300 | $protocoloDTO = new MdWsSeiProtocoloDTO(); | 310 | $protocoloDTO = new MdWsSeiProtocoloDTO(); |
301 | if($dto instanceof ProcedimentoDTO){ | 311 | if($dto instanceof ProcedimentoDTO){ |
302 | $protocoloDTO = new MdWsSeiProtocoloDTO(); | 312 | $protocoloDTO = new MdWsSeiProtocoloDTO(); |
@@ -323,7 +333,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -323,7 +333,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
323 | $processoDocumentoIncluidoAssinado = 'N'; | 333 | $processoDocumentoIncluidoAssinado = 'N'; |
324 | $processoPublicado = 'N'; | 334 | $processoPublicado = 'N'; |
325 | 335 | ||
326 | - $atividadeRN = new AtividadeRN(); | 336 | + $atividadeRN = new MdWsSeiAtividadeRN(); |
327 | $atividadeDTOConsulta = new AtividadeDTO(); | 337 | $atividadeDTOConsulta = new AtividadeDTO(); |
328 | $atividadeDTOConsulta->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | 338 | $atividadeDTOConsulta->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); |
329 | $atividadeDTOConsulta->retDblIdProtocolo(); | 339 | $atividadeDTOConsulta->retDblIdProtocolo(); |
@@ -349,7 +359,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -349,7 +359,8 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
349 | } | 359 | } |
350 | $arrAtividadePendenciaDTO = array(); | 360 | $arrAtividadePendenciaDTO = array(); |
351 | if($dto instanceof ProcedimentoDTO){ | 361 | if($dto instanceof ProcedimentoDTO){ |
352 | - $arrAtividadePendenciaDTO = $dto->getArrObjAtividadeDTO(); | 362 | + $procedimentoDTO = $dto; |
363 | + $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); | ||
353 | }else{ | 364 | }else{ |
354 | $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); | 365 | $pesquisaPendenciaDTO = new PesquisaPendenciaDTO(); |
355 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); | 366 | $pesquisaPendenciaDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario()); |
@@ -361,9 +372,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -361,9 +372,10 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
361 | $pesquisaPendenciaDTO->setStrSinSituacoes('S'); | 372 | $pesquisaPendenciaDTO->setStrSinSituacoes('S'); |
362 | $pesquisaPendenciaDTO->setStrSinMarcadores('S'); | 373 | $pesquisaPendenciaDTO->setStrSinMarcadores('S'); |
363 | $pesquisaPendenciaDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | 374 | $pesquisaPendenciaDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); |
364 | - $arrProcedimentoDTO = $atividadeRN->listarPendenciasRN0754($pesquisaPendenciaDTO); | 375 | + $arrProcedimentoDTO = $atividadeRN->listarPendencias($pesquisaPendenciaDTO); |
365 | if($arrProcedimentoDTO){ | 376 | if($arrProcedimentoDTO){ |
366 | - $arrAtividadePendenciaDTO = $arrProcedimentoDTO[0]->getArrObjAtividadeDTO(); | 377 | + $procedimentoDTO = $arrProcedimentoDTO[0]; |
378 | + $arrAtividadePendenciaDTO = $procedimentoDTO->getArrObjAtividadeDTO(); | ||
367 | } | 379 | } |
368 | } | 380 | } |
369 | if($arrAtividadePendenciaDTO){ | 381 | if($arrAtividadePendenciaDTO){ |
@@ -462,7 +474,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -462,7 +474,14 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
462 | 'staAnotacao' => $anotacaoDTO->getStrStaAnotacao() | 474 | 'staAnotacao' => $anotacaoDTO->getStrStaAnotacao() |
463 | ); | 475 | ); |
464 | } | 476 | } |
465 | - | 477 | + if($procedimentoDTO && $procedimentoDTO->getStrStaEstadoProtocolo() != ProtocoloRN::$TE_PROCEDIMENTO_ANEXADO){ |
478 | + $ret = $this->listarUnidadeAberturaProcedimento($procedimentoDTO); | ||
479 | + if(!$ret['sucesso']){ | ||
480 | + throw new Exception($ret['mensagem']); | ||
481 | + } | ||
482 | + $arrDadosAbertura = $ret['data']; | ||
483 | + } | ||
484 | + | ||
466 | $result[] = array( | 485 | $result[] = array( |
467 | 'id' => $protocoloDTO->getDblIdProtocolo(), | 486 | 'id' => $protocoloDTO->getDblIdProtocolo(), |
468 | 'status' => $protocoloDTO->getStrStaProtocolo(), | 487 | 'status' => $protocoloDTO->getStrStaProtocolo(), |
@@ -477,6 +496,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -477,6 +496,7 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
477 | 'idUnidade' => $protocoloDTO->getNumIdUnidadeGeradora(), | 496 | 'idUnidade' => $protocoloDTO->getNumIdUnidadeGeradora(), |
478 | 'sigla' => $protocoloDTO->getStrSiglaUnidadeGeradora() | 497 | 'sigla' => $protocoloDTO->getStrSiglaUnidadeGeradora() |
479 | ), | 498 | ), |
499 | + 'dados_abertura' => $arrDadosAbertura, | ||
480 | 'anotacoes' => $resultAnotacao, | 500 | 'anotacoes' => $resultAnotacao, |
481 | 'status' => array( | 501 | 'status' => array( |
482 | 'documentoSigiloso' => $protocoloDTO->getStrStaGrauSigilo(), | 502 | 'documentoSigiloso' => $protocoloDTO->getStrStaGrauSigilo(), |
@@ -506,6 +526,104 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -506,6 +526,104 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
506 | 526 | ||
507 | return $result; | 527 | return $result; |
508 | } | 528 | } |
529 | + | ||
530 | + protected function listarUnidadeAberturaProcedimentoConectado(ProcedimentoDTO $procedimentoDTO){ | ||
531 | + try{ | ||
532 | + $result = array(); | ||
533 | + $atividadeRN = new MdWsSeiAtividadeRN(); | ||
534 | + $strStaNivelAcessoGlobal = $procedimentoDTO->getStrStaNivelAcessoGlobalProtocolo(); | ||
535 | + $dblIdProcedimento = $procedimentoDTO->getDblIdProcedimento(); | ||
536 | + $atividadeDTO = new AtividadeDTO(); | ||
537 | + $atividadeDTO->setDistinct(true); | ||
538 | + $atividadeDTO->retStrSiglaUnidade(); | ||
539 | + $atividadeDTO->retNumIdUnidade(); | ||
540 | + $atividadeDTO->retStrDescricaoUnidade(); | ||
541 | + | ||
542 | + $atividadeDTO->setOrdStrSiglaUnidade(InfraDTO::$TIPO_ORDENACAO_ASC); | ||
543 | + | ||
544 | + if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | ||
545 | + $atividadeDTO->retNumIdUsuario(); | ||
546 | + $atividadeDTO->retStrSiglaUsuario(); | ||
547 | + $atividadeDTO->retStrNomeUsuario(); | ||
548 | + } else { | ||
549 | + $atividadeDTO->retNumIdUsuarioAtribuicao(); | ||
550 | + $atividadeDTO->retStrSiglaUsuarioAtribuicao(); | ||
551 | + $atividadeDTO->retStrNomeUsuarioAtribuicao(); | ||
552 | + | ||
553 | + //ordena descendente pois no envio de processo que já existe na unidade e está atribuído ficará com mais de um andamento em aberto | ||
554 | + //desta forma os andamentos com usuário nulo (envios do processo) serão listados depois | ||
555 | + $atividadeDTO->setOrdStrSiglaUsuarioAtribuicao(InfraDTO::$TIPO_ORDENACAO_DESC); | ||
556 | + | ||
557 | + } | ||
558 | + $atividadeDTO->setDblIdProtocolo($dblIdProcedimento); | ||
559 | + $atividadeDTO->setDthConclusao(null); | ||
560 | + | ||
561 | + //sigiloso sem credencial nao considera o usuario atual | ||
562 | + if ($strStaNivelAcessoGlobal == ProtocoloRN::$NA_SIGILOSO) { | ||
563 | + | ||
564 | + $acessoDTO = new AcessoDTO(); | ||
565 | + $acessoDTO->setDistinct(true); | ||
566 | + $acessoDTO->retNumIdUsuario(); | ||
567 | + $acessoDTO->setDblIdProtocolo($dblIdProcedimento); | ||
568 | + $acessoDTO->setStrStaTipo(AcessoRN::$TA_CREDENCIAL_PROCESSO); | ||
569 | + | ||
570 | + $acessoRN = new AcessoRN(); | ||
571 | + $arrAcessoDTO = $acessoRN->listar($acessoDTO); | ||
572 | + | ||
573 | + $atividadeDTO->setNumIdUsuario(InfraArray::converterArrInfraDTO($arrAcessoDTO, 'IdUsuario'), InfraDTO::$OPER_IN); | ||
574 | + } | ||
575 | + $arrAtividadeDTO = $atividadeRN->listarRN0036($atividadeDTO); | ||
576 | + | ||
577 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | ||
578 | + $arrAtividadeDTO = InfraArray::distinctArrInfraDTO($arrAtividadeDTO, 'SiglaUnidade'); | ||
579 | + } | ||
580 | + if (count($arrAtividadeDTO) == 0) { | ||
581 | + $result['info'] = 'Processo não possui andamentos abertos.'; | ||
582 | + $result['lista'] = array(); | ||
583 | + }else{ | ||
584 | + if (count($arrAtividadeDTO) == 1) { | ||
585 | + $atividadeDTO = $arrAtividadeDTO[0]; | ||
586 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | ||
587 | + $result['info'] = 'Processo aberto somente na unidade:'; | ||
588 | + $result['lista'][] = array( | ||
589 | + 'sigla' => $atividadeDTO->getStrSiglaUnidade() | ||
590 | + ); | ||
591 | + } else { | ||
592 | + $result['info'] = 'Processo aberto com o usuário:'; | ||
593 | + $atividadeDTO = $arrAtividadeDTO[0]; | ||
594 | + $result['lista'][] = array( | ||
595 | + 'sigla' => $atividadeDTO->getStrNomeUsuario() | ||
596 | + ); | ||
597 | + } | ||
598 | + } else { | ||
599 | + if ($strStaNivelAcessoGlobal != ProtocoloRN::$NA_SIGILOSO) { | ||
600 | + $result['info'] = 'Processo aberto nas unidades:'; | ||
601 | + foreach ($arrAtividadeDTO as $atividadeDTO) { | ||
602 | + $sigla = $atividadeDTO->getStrSiglaUnidade(); | ||
603 | + if ($atividadeDTO->getNumIdUsuarioAtribuicao() != null) { | ||
604 | + $sigla .= ' (atribuído a '.$atividadeDTO->getStrNomeUsuarioAtribuicao().')'; | ||
605 | + } | ||
606 | + $result['lista'][] = array( | ||
607 | + 'sigla' => $sigla | ||
608 | + ); | ||
609 | + } | ||
610 | + } else { | ||
611 | + $result['info'] = 'Processo aberto com os usuários:'; | ||
612 | + foreach ($arrAtividadeDTO as $atividadeDTO) { | ||
613 | + $sigla = $atividadeDTO->getStrNomeUsuario().' na unidade '.$atividadeDTO->getStrSiglaUnidade(); | ||
614 | + $result['lista'][] = array( | ||
615 | + 'sigla' => $sigla | ||
616 | + ); | ||
617 | + } | ||
618 | + } | ||
619 | + } | ||
620 | + } | ||
621 | + | ||
622 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $result); | ||
623 | + }catch (Exception $e){ | ||
624 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
625 | + } | ||
626 | + } | ||
509 | 627 | ||
510 | /** | 628 | /** |
511 | * Metodo que retorna as ciencias nos processos | 629 | * Metodo que retorna as ciencias nos processos |
@@ -674,6 +792,78 @@ class MdWsSeiProcedimentoRN extends InfraRN { | @@ -674,6 +792,78 @@ class MdWsSeiProcedimentoRN extends InfraRN { | ||
674 | } | 792 | } |
675 | } | 793 | } |
676 | 794 | ||
795 | + /** | ||
796 | + * Método que verifica o acesso a um processo ou documento | ||
797 | + * @param ProtocoloDTO $protocoloDTOParam | ||
798 | + * - Se acesso liberado e chamar autenticação for false, o usuário não pode de jeito nenhum visualizar o processo/documento | ||
799 | + * @return array | ||
800 | + */ | ||
801 | + protected function verificaAcessoConectado(ProtocoloDTO $protocoloDTOParam){ | ||
802 | + try{ | ||
803 | + $acessoLiberado = false; | ||
804 | + $chamarAutenticacao = false; | ||
805 | + $protocoloRN = new ProtocoloRN(); | ||
806 | + $protocoloDTO = new ProtocoloDTO(); | ||
807 | + $protocoloDTO->setDblIdProtocolo($protocoloDTOParam->getDblIdProtocolo()); | ||
808 | + $protocoloDTO->retStrStaNivelAcessoGlobal(); | ||
809 | + $protocoloDTO->retDblIdProtocolo(); | ||
810 | + $protocoloDTO = $protocoloRN->consultarRN0186($protocoloDTO); | ||
811 | + if($protocoloDTO->getStrStaNivelAcessoGlobal() == ProtocoloRN::$NA_SIGILOSO){ | ||
812 | + $objPesquisaProtocoloDTO = new PesquisaProtocoloDTO(); | ||
813 | + $objPesquisaProtocoloDTO->setStrStaTipo(ProtocoloRN::$TPP_PROCEDIMENTOS); | ||
814 | + $objPesquisaProtocoloDTO->setStrStaAcesso(ProtocoloRN::$TAP_AUTORIZADO); | ||
815 | + $objPesquisaProtocoloDTO->setDblIdProtocolo($protocoloDTO->getDblIdProtocolo()); | ||
816 | + | ||
817 | + $objProtocoloRN = new ProtocoloRN(); | ||
818 | + $arrProtocoloDTO = $objProtocoloRN->pesquisarRN0967($objPesquisaProtocoloDTO); | ||
819 | + if($arrProtocoloDTO){ | ||
820 | + $chamarAutenticacao = true; | ||
821 | + } | ||
822 | + }else{ | ||
823 | + $acessoLiberado = true; | ||
824 | + $chamarAutenticacao = false; | ||
825 | + } | ||
826 | + | ||
827 | + return MdWsSeiRest::formataRetornoSucessoREST( | ||
828 | + null, | ||
829 | + array('acessoLiberado' => $acessoLiberado, 'chamarAutenticacao' => $chamarAutenticacao) | ||
830 | + ); | ||
831 | + | ||
832 | + }catch (Exception $e){ | ||
833 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
834 | + } | ||
835 | + } | ||
836 | + | ||
837 | + /** | ||
838 | + * Identifica o acesso do usuário em um processo | ||
839 | + * @param UsuarioDTO $usuarioDTO | ||
840 | + * @param ProtocoloDTO $protocoloDTO | ||
841 | + * @return array | ||
842 | + */ | ||
843 | + protected function identificacaoAcessoConectado(UsuarioDTO $usuarioDTO, ProtocoloDTO $protocoloDTO){ | ||
844 | + try{ | ||
845 | + $objInfraSip = new InfraSip(SessaoSEI::getInstance()); | ||
846 | + $objInfraSip->autenticar(SessaoSEI::getInstance()->getNumIdOrgaoUsuario(), null, SessaoSEI::getInstance()->getStrSiglaUsuario(), $usuarioDTO->getStrSenha()); | ||
847 | + AuditoriaSEI::getInstance()->auditar('usuario_validar_acesso'); | ||
848 | + $ret = $this->verificaAcesso($protocoloDTO); | ||
849 | + if(!$ret['sucesso']){ | ||
850 | + return $ret; | ||
851 | + } | ||
852 | + $acessoAutorizado = false; | ||
853 | + if($ret['data']['acessoLiberado'] || $ret['data']['chamarAutenticacao']){ | ||
854 | + $acessoAutorizado = true; | ||
855 | + } | ||
856 | + | ||
857 | + return MdWsSeiRest::formataRetornoSucessoREST(null, array('acessoAutorizado' => $acessoAutorizado)); | ||
858 | + }catch (InfraException $e){ | ||
859 | + $infraValidacaoDTO = $e->getArrObjInfraValidacao()[0]; | ||
860 | + $eAuth = new Exception($infraValidacaoDTO->getStrDescricao(), $e->getCode(), $e); | ||
861 | + return MdWsSeiRest::formataRetornoErroREST($eAuth); | ||
862 | + }catch (Exception $e){ | ||
863 | + return MdWsSeiRest::formataRetornoErroREST($e); | ||
864 | + } | ||
865 | + } | ||
866 | + | ||
677 | 867 | ||
678 | 868 | ||
679 | } | 869 | } |
680 | \ No newline at end of file | 870 | \ No newline at end of file |
teste.php
@@ -10,12 +10,20 @@ ini_set('xdebug.var_display_max_data', 2048); | @@ -10,12 +10,20 @@ ini_set('xdebug.var_display_max_data', 2048); | ||
10 | echo '<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>'; | 10 | echo '<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>'; |
11 | 11 | ||
12 | $b = new MdWsSeiUsuarioRN(); | 12 | $b = new MdWsSeiUsuarioRN(); |
13 | -$token = $b->tokenEncode('teste', 'teste'); | 13 | +$token = $b->tokenEncode('teste2', 'teste2'); |
14 | echo 'Token: '; | 14 | echo 'Token: '; |
15 | echo $token; | 15 | echo $token; |
16 | echo '<BR>'; | 16 | echo '<BR>'; |
17 | $b->autenticarToken($token); | 17 | $b->autenticarToken($token); |
18 | 18 | ||
19 | +$arrProcessosVisitados = SessaoSEI::getInstance()->getAtributo('PROCESSOS_VISITADOS_' . SessaoSEI::getInstance()->getStrSiglaUnidadeAtual()); | ||
20 | +var_dump($arrProcessosVisitados); | ||
21 | +exit; | ||
22 | + | ||
23 | +require_once dirname(__FILE__).'/vendor/autoload.php'; | ||
24 | + | ||
25 | + | ||
26 | + | ||
19 | class TesteAtividade { | 27 | class TesteAtividade { |
20 | 28 | ||
21 | public function listarAtividadesProcessoConectado(){ | 29 | public function listarAtividadesProcessoConectado(){ |
@@ -122,7 +130,7 @@ class TesteDocumento { | @@ -122,7 +130,7 @@ class TesteDocumento { | ||
122 | public function downloadAnexoConectado(){ | 130 | public function downloadAnexoConectado(){ |
123 | $rn = new MdWsSeiDocumentoRN(); | 131 | $rn = new MdWsSeiDocumentoRN(); |
124 | $dto = new ProtocoloDTO(); | 132 | $dto = new ProtocoloDTO(); |
125 | - $dto->setDblIdProtocolo(32); | 133 | + $dto->setDblIdProtocolo(36); |
126 | var_dump($rn->downloadAnexo($dto)); | 134 | var_dump($rn->downloadAnexo($dto)); |
127 | } | 135 | } |
128 | 136 |
vendor/composer/installed.json
@@ -230,24 +230,25 @@ | @@ -230,24 +230,25 @@ | ||
230 | }, | 230 | }, |
231 | { | 231 | { |
232 | "name": "slim/slim", | 232 | "name": "slim/slim", |
233 | - "version": "3.7.0", | ||
234 | - "version_normalized": "3.7.0.0", | 233 | + "version": "3.8.1", |
234 | + "version_normalized": "3.8.1.0", | ||
235 | "source": { | 235 | "source": { |
236 | "type": "git", | 236 | "type": "git", |
237 | "url": "https://github.com/slimphp/Slim.git", | 237 | "url": "https://github.com/slimphp/Slim.git", |
238 | - "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef" | 238 | + "reference": "5385302707530b2bccee1769613ad769859b826d" |
239 | }, | 239 | }, |
240 | "dist": { | 240 | "dist": { |
241 | "type": "zip", | 241 | "type": "zip", |
242 | - "url": "https://api.github.com/repos/slimphp/Slim/zipball/4254e40d81559e35cdf856bcbaca5f3af468b7ef", | ||
243 | - "reference": "4254e40d81559e35cdf856bcbaca5f3af468b7ef", | 242 | + "url": "https://api.github.com/repos/slimphp/Slim/zipball/5385302707530b2bccee1769613ad769859b826d", |
243 | + "reference": "5385302707530b2bccee1769613ad769859b826d", | ||
244 | "shasum": "" | 244 | "shasum": "" |
245 | }, | 245 | }, |
246 | "require": { | 246 | "require": { |
247 | - "container-interop/container-interop": "^1.1", | 247 | + "container-interop/container-interop": "^1.2", |
248 | "nikic/fast-route": "^1.0", | 248 | "nikic/fast-route": "^1.0", |
249 | "php": ">=5.5.0", | 249 | "php": ">=5.5.0", |
250 | "pimple/pimple": "^3.0", | 250 | "pimple/pimple": "^3.0", |
251 | + "psr/container": "^1.0", | ||
251 | "psr/http-message": "^1.0" | 252 | "psr/http-message": "^1.0" |
252 | }, | 253 | }, |
253 | "provide": { | 254 | "provide": { |
@@ -257,7 +258,7 @@ | @@ -257,7 +258,7 @@ | ||
257 | "phpunit/phpunit": "^4.0", | 258 | "phpunit/phpunit": "^4.0", |
258 | "squizlabs/php_codesniffer": "^2.5" | 259 | "squizlabs/php_codesniffer": "^2.5" |
259 | }, | 260 | }, |
260 | - "time": "2016-12-20T20:30:47+00:00", | 261 | + "time": "2017-03-19T17:55:20+00:00", |
261 | "type": "library", | 262 | "type": "library", |
262 | "installation-source": "dist", | 263 | "installation-source": "dist", |
263 | "autoload": { | 264 | "autoload": { |
vendor/slim/slim/LICENSE.md
1 | -Copyright (c) 2011-2016 Josh Lockhart | 1 | +Copyright (c) 2011-2017 Josh Lockhart |
2 | 2 | ||
3 | Permission is hereby granted, free of charge, to any person obtaining a copy | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy |
4 | of this software and associated documentation files (the "Software"), to deal | 4 | of this software and associated documentation files (the "Software"), to deal |
vendor/slim/slim/Slim/App.php
@@ -3,19 +3,21 @@ | @@ -3,19 +3,21 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
10 | 10 | ||
11 | use Exception; | 11 | use Exception; |
12 | +use Slim\Exception\InvalidMethodException; | ||
13 | +use Slim\Http\Response; | ||
12 | use Throwable; | 14 | use Throwable; |
13 | use Closure; | 15 | use Closure; |
14 | use InvalidArgumentException; | 16 | use InvalidArgumentException; |
15 | use Psr\Http\Message\RequestInterface; | 17 | use Psr\Http\Message\RequestInterface; |
16 | use Psr\Http\Message\ServerRequestInterface; | 18 | use Psr\Http\Message\ServerRequestInterface; |
17 | use Psr\Http\Message\ResponseInterface; | 19 | use Psr\Http\Message\ResponseInterface; |
18 | -use Interop\Container\ContainerInterface; | 20 | +use Psr\Container\ContainerInterface; |
19 | use FastRoute\Dispatcher; | 21 | use FastRoute\Dispatcher; |
20 | use Slim\Exception\SlimException; | 22 | use Slim\Exception\SlimException; |
21 | use Slim\Exception\MethodNotAllowedException; | 23 | use Slim\Exception\MethodNotAllowedException; |
@@ -50,7 +52,7 @@ class App | @@ -50,7 +52,7 @@ class App | ||
50 | * | 52 | * |
51 | * @var string | 53 | * @var string |
52 | */ | 54 | */ |
53 | - const VERSION = '3.7.0'; | 55 | + const VERSION = '3.8.1'; |
54 | 56 | ||
55 | /** | 57 | /** |
56 | * Container | 58 | * Container |
@@ -287,10 +289,13 @@ class App | @@ -287,10 +289,13 @@ class App | ||
287 | */ | 289 | */ |
288 | public function run($silent = false) | 290 | public function run($silent = false) |
289 | { | 291 | { |
290 | - $request = $this->container->get('request'); | ||
291 | $response = $this->container->get('response'); | 292 | $response = $this->container->get('response'); |
292 | 293 | ||
293 | - $response = $this->process($request, $response); | 294 | + try { |
295 | + $response = $this->process($this->container->get('request'), $response); | ||
296 | + } catch (InvalidMethodException $e) { | ||
297 | + $response = $this->processInvalidMethod($e->getRequest(), $response); | ||
298 | + } | ||
294 | 299 | ||
295 | if (!$silent) { | 300 | if (!$silent) { |
296 | $this->respond($response); | 301 | $this->respond($response); |
@@ -300,6 +305,39 @@ class App | @@ -300,6 +305,39 @@ class App | ||
300 | } | 305 | } |
301 | 306 | ||
302 | /** | 307 | /** |
308 | + * Pull route info for a request with a bad method to decide whether to | ||
309 | + * return a not-found error (default) or a bad-method error, then run | ||
310 | + * the handler for that error, returning the resulting response. | ||
311 | + * | ||
312 | + * Used for cases where an incoming request has an unrecognized method, | ||
313 | + * rather than throwing an exception and not catching it all the way up. | ||
314 | + * | ||
315 | + * @param ServerRequestInterface $request | ||
316 | + * @param ResponseInterface $response | ||
317 | + * @return ResponseInterface | ||
318 | + */ | ||
319 | + protected function processInvalidMethod(ServerRequestInterface $request, ResponseInterface $response) | ||
320 | + { | ||
321 | + $router = $this->container->get('router'); | ||
322 | + if (is_callable([$request->getUri(), 'getBasePath']) && is_callable([$router, 'setBasePath'])) { | ||
323 | + $router->setBasePath($request->getUri()->getBasePath()); | ||
324 | + } | ||
325 | + | ||
326 | + $request = $this->dispatchRouterAndPrepareRoute($request, $router); | ||
327 | + $routeInfo = $request->getAttribute('routeInfo', [RouterInterface::DISPATCH_STATUS => Dispatcher::NOT_FOUND]); | ||
328 | + | ||
329 | + if ($routeInfo[RouterInterface::DISPATCH_STATUS] === Dispatcher::METHOD_NOT_ALLOWED) { | ||
330 | + return $this->handleException( | ||
331 | + new MethodNotAllowedException($request, $response, $routeInfo[RouterInterface::ALLOWED_METHODS]), | ||
332 | + $request, | ||
333 | + $response | ||
334 | + ); | ||
335 | + } | ||
336 | + | ||
337 | + return $this->handleException(new NotFoundException($request, $response), $request, $response); | ||
338 | + } | ||
339 | + | ||
340 | + /** | ||
303 | * Process a request | 341 | * Process a request |
304 | * | 342 | * |
305 | * This method traverses the application middleware stack and then returns the | 343 | * This method traverses the application middleware stack and then returns the |
vendor/slim/slim/Slim/CallableResolver.php
@@ -3,13 +3,13 @@ | @@ -3,13 +3,13 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
10 | 10 | ||
11 | use RuntimeException; | 11 | use RuntimeException; |
12 | -use Interop\Container\ContainerInterface; | 12 | +use Psr\Container\ContainerInterface; |
13 | use Slim\Interfaces\CallableResolverInterface; | 13 | use Slim\Interfaces\CallableResolverInterface; |
14 | 14 | ||
15 | /** | 15 | /** |
@@ -18,6 +18,8 @@ use Slim\Interfaces\CallableResolverInterface; | @@ -18,6 +18,8 @@ use Slim\Interfaces\CallableResolverInterface; | ||
18 | */ | 18 | */ |
19 | final class CallableResolver implements CallableResolverInterface | 19 | final class CallableResolver implements CallableResolverInterface |
20 | { | 20 | { |
21 | + const CALLABLE_PATTERN = '!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!'; | ||
22 | + | ||
21 | /** | 23 | /** |
22 | * @var ContainerInterface | 24 | * @var ContainerInterface |
23 | */ | 25 | */ |
@@ -46,45 +48,63 @@ final class CallableResolver implements CallableResolverInterface | @@ -46,45 +48,63 @@ final class CallableResolver implements CallableResolverInterface | ||
46 | */ | 48 | */ |
47 | public function resolve($toResolve) | 49 | public function resolve($toResolve) |
48 | { | 50 | { |
49 | - $resolved = $toResolve; | 51 | + if (is_callable($toResolve)) { |
52 | + return $toResolve; | ||
53 | + } | ||
54 | + | ||
55 | + if (!is_string($toResolve)) { | ||
56 | + $this->assertCallable($toResolve); | ||
57 | + } | ||
58 | + | ||
59 | + // check for slim callable as "class:method" | ||
60 | + if (preg_match(self::CALLABLE_PATTERN, $toResolve, $matches)) { | ||
61 | + $resolved = $this->resolveCallable($matches[1], $matches[2]); | ||
62 | + $this->assertCallable($resolved); | ||
63 | + | ||
64 | + return $resolved; | ||
65 | + } | ||
50 | 66 | ||
51 | - if (!is_callable($toResolve) && is_string($toResolve)) { | ||
52 | - // check for slim callable as "class:method" | ||
53 | - $callablePattern = '!^([^\:]+)\:([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)$!'; | ||
54 | - if (preg_match($callablePattern, $toResolve, $matches)) { | ||
55 | - $class = $matches[1]; | ||
56 | - $method = $matches[2]; | 67 | + $resolved = $this->resolveCallable($toResolve); |
68 | + $this->assertCallable($resolved); | ||
69 | + | ||
70 | + return $resolved; | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * Check if string is something in the DIC | ||
75 | + * that's callable or is a class name which has an __invoke() method. | ||
76 | + * | ||
77 | + * @param string $class | ||
78 | + * @param string $method | ||
79 | + * @return callable | ||
80 | + * | ||
81 | + * @throws \RuntimeException if the callable does not exist | ||
82 | + */ | ||
83 | + protected function resolveCallable($class, $method = '__invoke') | ||
84 | + { | ||
85 | + if ($this->container->has($class)) { | ||
86 | + return [$this->container->get($class), $method]; | ||
87 | + } | ||
57 | 88 | ||
58 | - if ($this->container->has($class)) { | ||
59 | - $resolved = [$this->container->get($class), $method]; | ||
60 | - } else { | ||
61 | - if (!class_exists($class)) { | ||
62 | - throw new RuntimeException(sprintf('Callable %s does not exist', $class)); | ||
63 | - } | ||
64 | - $resolved = [new $class($this->container), $method]; | ||
65 | - } | ||
66 | - } else { | ||
67 | - // check if string is something in the DIC that's callable or is a class name which | ||
68 | - // has an __invoke() method | ||
69 | - $class = $toResolve; | ||
70 | - if ($this->container->has($class)) { | ||
71 | - $resolved = $this->container->get($class); | ||
72 | - } else { | ||
73 | - if (!class_exists($class)) { | ||
74 | - throw new RuntimeException(sprintf('Callable %s does not exist', $class)); | ||
75 | - } | ||
76 | - $resolved = new $class($this->container); | ||
77 | - } | ||
78 | - } | 89 | + if (!class_exists($class)) { |
90 | + throw new RuntimeException(sprintf('Callable %s does not exist', $class)); | ||
79 | } | 91 | } |
80 | 92 | ||
81 | - if (!is_callable($resolved)) { | 93 | + return [new $class($this->container), $method]; |
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * @param Callable $callable | ||
98 | + * | ||
99 | + * @throws \RuntimeException if the callable is not resolvable | ||
100 | + */ | ||
101 | + protected function assertCallable($callable) | ||
102 | + { | ||
103 | + if (!is_callable($callable)) { | ||
82 | throw new RuntimeException(sprintf( | 104 | throw new RuntimeException(sprintf( |
83 | '%s is not resolvable', | 105 | '%s is not resolvable', |
84 | - is_array($toResolve) || is_object($toResolve) ? json_encode($toResolve) : $toResolve | 106 | + is_array($callable) || is_object($callable) ? json_encode($callable) : $callable |
85 | )); | 107 | )); |
86 | } | 108 | } |
87 | - | ||
88 | - return $resolved; | ||
89 | } | 109 | } |
90 | } | 110 | } |
vendor/slim/slim/Slim/CallableResolverAwareTrait.php
@@ -3,13 +3,13 @@ | @@ -3,13 +3,13 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
10 | 10 | ||
11 | use RuntimeException; | 11 | use RuntimeException; |
12 | -use Interop\Container\ContainerInterface; | 12 | +use Psr\Container\ContainerInterface; |
13 | use Slim\Interfaces\CallableResolverInterface; | 13 | use Slim\Interfaces\CallableResolverInterface; |
14 | 14 | ||
15 | /** | 15 | /** |
vendor/slim/slim/Slim/Collection.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
vendor/slim/slim/Slim/Container.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
vendor/slim/slim/Slim/DefaultServicesProvider.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
vendor/slim/slim/Slim/DeferredCallable.php
@@ -3,14 +3,14 @@ | @@ -3,14 +3,14 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | namespace Slim; | 10 | namespace Slim; |
11 | 11 | ||
12 | use Closure; | 12 | use Closure; |
13 | -use Interop\Container\ContainerInterface; | 13 | +use Psr\Container\ContainerInterface; |
14 | 14 | ||
15 | class DeferredCallable | 15 | class DeferredCallable |
16 | { | 16 | { |
vendor/slim/slim/Slim/Exception/ContainerException.php
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | /** | 2 | /** |
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | - * @link https://github.com/codeguy/Slim | ||
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | ||
7 | - * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) | 5 | + * @link https://github.com/slimphp/Slim |
6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart | ||
7 | + * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE (MIT License) | ||
8 | */ | 8 | */ |
9 | namespace Slim\Exception; | 9 | namespace Slim\Exception; |
10 | 10 |
vendor/slim/slim/Slim/Exception/ContainerValueNotFoundException.php
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | /** | 2 | /** |
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | - * @link https://github.com/codeguy/Slim | ||
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | ||
7 | - * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) | 5 | + * @link https://github.com/slimphp/Slim |
6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart | ||
7 | + * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE (MIT License) | ||
8 | */ | 8 | */ |
9 | namespace Slim\Exception; | 9 | namespace Slim\Exception; |
10 | 10 |
vendor/slim/slim/Slim/Exception/MethodNotAllowedException.php
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | /** | 2 | /** |
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | - * @link https://github.com/codeguy/Slim | ||
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | ||
7 | - * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) | 5 | + * @link https://github.com/slimphp/Slim |
6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart | ||
7 | + * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE (MIT License) | ||
8 | */ | 8 | */ |
9 | namespace Slim\Exception; | 9 | namespace Slim\Exception; |
10 | 10 |
vendor/slim/slim/Slim/Exception/NotFoundException.php
@@ -2,9 +2,9 @@ | @@ -2,9 +2,9 @@ | ||
2 | /** | 2 | /** |
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | - * @link https://github.com/codeguy/Slim | ||
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | ||
7 | - * @license https://github.com/codeguy/Slim/blob/master/LICENSE (MIT License) | 5 | + * @link https://github.com/slimphp/Slim |
6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart | ||
7 | + * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE (MIT License) | ||
8 | */ | 8 | */ |
9 | namespace Slim\Exception; | 9 | namespace Slim\Exception; |
10 | 10 |
vendor/slim/slim/Slim/Exception/SlimException.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Exception; | 9 | namespace Slim\Exception; |
vendor/slim/slim/Slim/Handlers/AbstractError.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
vendor/slim/slim/Slim/Handlers/AbstractHandler.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
vendor/slim/slim/Slim/Handlers/Error.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
@@ -81,7 +81,7 @@ class Error extends AbstractError | @@ -81,7 +81,7 @@ class Error extends AbstractError | ||
81 | 81 | ||
82 | while ($exception = $exception->getPrevious()) { | 82 | while ($exception = $exception->getPrevious()) { |
83 | $html .= '<h2>Previous exception</h2>'; | 83 | $html .= '<h2>Previous exception</h2>'; |
84 | - $html .= $this->renderHtmlException($exception); | 84 | + $html .= $this->renderHtmlExceptionOrError($exception); |
85 | } | 85 | } |
86 | } else { | 86 | } else { |
87 | $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; | 87 | $html = '<p>A website error has occurred. Sorry for the temporary inconvenience.</p>'; |
@@ -103,12 +103,30 @@ class Error extends AbstractError | @@ -103,12 +103,30 @@ class Error extends AbstractError | ||
103 | /** | 103 | /** |
104 | * Render exception as HTML. | 104 | * Render exception as HTML. |
105 | * | 105 | * |
106 | + * Provided for backwards compatibility; use renderHtmlExceptionOrError(). | ||
107 | + * | ||
106 | * @param \Exception $exception | 108 | * @param \Exception $exception |
107 | * | 109 | * |
108 | * @return string | 110 | * @return string |
109 | */ | 111 | */ |
110 | protected function renderHtmlException(\Exception $exception) | 112 | protected function renderHtmlException(\Exception $exception) |
111 | { | 113 | { |
114 | + return $this->renderHtmlExceptionOrError($exception); | ||
115 | + } | ||
116 | + | ||
117 | + /** | ||
118 | + * Render exception or error as HTML. | ||
119 | + * | ||
120 | + * @param \Exception|\Error $exception | ||
121 | + * | ||
122 | + * @return string | ||
123 | + */ | ||
124 | + protected function renderHtmlExceptionOrError($exception) | ||
125 | + { | ||
126 | + if (!$exception instanceof \Exception && !$exception instanceof \Error) { | ||
127 | + throw new \RuntimeException("Unexpected type. Expected Exception or Error."); | ||
128 | + } | ||
129 | + | ||
112 | $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception)); | 130 | $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception)); |
113 | 131 | ||
114 | if (($code = $exception->getCode())) { | 132 | if (($code = $exception->getCode())) { |
vendor/slim/slim/Slim/Handlers/NotAllowed.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
vendor/slim/slim/Slim/Handlers/NotFound.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
vendor/slim/slim/Slim/Handlers/PhpError.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers; | 9 | namespace Slim\Handlers; |
vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers\Strategies; | 9 | namespace Slim\Handlers\Strategies; |
vendor/slim/slim/Slim/Handlers/Strategies/RequestResponseArgs.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Handlers\Strategies; | 9 | namespace Slim\Handlers\Strategies; |
vendor/slim/slim/Slim/Http/Body.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Cookies.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Environment.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Headers.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Message.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Request.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
@@ -16,6 +16,8 @@ use Psr\Http\Message\ServerRequestInterface; | @@ -16,6 +16,8 @@ use Psr\Http\Message\ServerRequestInterface; | ||
16 | use Psr\Http\Message\UriInterface; | 16 | use Psr\Http\Message\UriInterface; |
17 | use Psr\Http\Message\StreamInterface; | 17 | use Psr\Http\Message\StreamInterface; |
18 | use Slim\Collection; | 18 | use Slim\Collection; |
19 | +use Slim\Exception\InvalidMethodException; | ||
20 | +use Slim\Exception\MethodNotAllowedException; | ||
19 | use Slim\Interfaces\Http\HeadersInterface; | 21 | use Slim\Interfaces\Http\HeadersInterface; |
20 | 22 | ||
21 | /** | 23 | /** |
@@ -131,7 +133,7 @@ class Request extends Message implements ServerRequestInterface | @@ -131,7 +133,7 @@ class Request extends Message implements ServerRequestInterface | ||
131 | * | 133 | * |
132 | * @param Environment $environment The Slim application Environment | 134 | * @param Environment $environment The Slim application Environment |
133 | * | 135 | * |
134 | - * @return self | 136 | + * @return static |
135 | */ | 137 | */ |
136 | public static function createFromEnvironment(Environment $environment) | 138 | public static function createFromEnvironment(Environment $environment) |
137 | { | 139 | { |
@@ -166,6 +168,7 @@ class Request extends Message implements ServerRequestInterface | @@ -166,6 +168,7 @@ class Request extends Message implements ServerRequestInterface | ||
166 | * @param array $serverParams The server environment variables | 168 | * @param array $serverParams The server environment variables |
167 | * @param StreamInterface $body The request body object | 169 | * @param StreamInterface $body The request body object |
168 | * @param array $uploadedFiles The request uploadedFiles collection | 170 | * @param array $uploadedFiles The request uploadedFiles collection |
171 | + * @throws InvalidMethodException on invalid HTTP method | ||
169 | */ | 172 | */ |
170 | public function __construct( | 173 | public function __construct( |
171 | $method, | 174 | $method, |
@@ -176,7 +179,12 @@ class Request extends Message implements ServerRequestInterface | @@ -176,7 +179,12 @@ class Request extends Message implements ServerRequestInterface | ||
176 | StreamInterface $body, | 179 | StreamInterface $body, |
177 | array $uploadedFiles = [] | 180 | array $uploadedFiles = [] |
178 | ) { | 181 | ) { |
179 | - $this->originalMethod = $this->filterMethod($method); | 182 | + try { |
183 | + $this->originalMethod = $this->filterMethod($method); | ||
184 | + } catch (InvalidMethodException $e) { | ||
185 | + $this->originalMethod = $method; | ||
186 | + } | ||
187 | + | ||
180 | $this->uri = $uri; | 188 | $this->uri = $uri; |
181 | $this->headers = $headers; | 189 | $this->headers = $headers; |
182 | $this->cookies = $cookies; | 190 | $this->cookies = $cookies; |
@@ -194,20 +202,36 @@ class Request extends Message implements ServerRequestInterface | @@ -194,20 +202,36 @@ class Request extends Message implements ServerRequestInterface | ||
194 | } | 202 | } |
195 | 203 | ||
196 | $this->registerMediaTypeParser('application/json', function ($input) { | 204 | $this->registerMediaTypeParser('application/json', function ($input) { |
197 | - return json_decode($input, true); | 205 | + $result = json_decode($input, true); |
206 | + if (!is_array($result)) { | ||
207 | + return null; | ||
208 | + } | ||
209 | + return $result; | ||
198 | }); | 210 | }); |
199 | 211 | ||
200 | $this->registerMediaTypeParser('application/xml', function ($input) { | 212 | $this->registerMediaTypeParser('application/xml', function ($input) { |
201 | $backup = libxml_disable_entity_loader(true); | 213 | $backup = libxml_disable_entity_loader(true); |
214 | + $backup_errors = libxml_use_internal_errors(true); | ||
202 | $result = simplexml_load_string($input); | 215 | $result = simplexml_load_string($input); |
203 | libxml_disable_entity_loader($backup); | 216 | libxml_disable_entity_loader($backup); |
217 | + libxml_clear_errors(); | ||
218 | + libxml_use_internal_errors($backup_errors); | ||
219 | + if ($result === false) { | ||
220 | + return null; | ||
221 | + } | ||
204 | return $result; | 222 | return $result; |
205 | }); | 223 | }); |
206 | 224 | ||
207 | $this->registerMediaTypeParser('text/xml', function ($input) { | 225 | $this->registerMediaTypeParser('text/xml', function ($input) { |
208 | $backup = libxml_disable_entity_loader(true); | 226 | $backup = libxml_disable_entity_loader(true); |
227 | + $backup_errors = libxml_use_internal_errors(true); | ||
209 | $result = simplexml_load_string($input); | 228 | $result = simplexml_load_string($input); |
210 | libxml_disable_entity_loader($backup); | 229 | libxml_disable_entity_loader($backup); |
230 | + libxml_clear_errors(); | ||
231 | + libxml_use_internal_errors($backup_errors); | ||
232 | + if ($result === false) { | ||
233 | + return null; | ||
234 | + } | ||
211 | return $result; | 235 | return $result; |
212 | }); | 236 | }); |
213 | 237 | ||
@@ -215,6 +239,11 @@ class Request extends Message implements ServerRequestInterface | @@ -215,6 +239,11 @@ class Request extends Message implements ServerRequestInterface | ||
215 | parse_str($input, $data); | 239 | parse_str($input, $data); |
216 | return $data; | 240 | return $data; |
217 | }); | 241 | }); |
242 | + | ||
243 | + // if the request had an invalid method, we can throw it now | ||
244 | + if (isset($e) && $e instanceof InvalidMethodException) { | ||
245 | + throw $e; | ||
246 | + } | ||
218 | } | 247 | } |
219 | 248 | ||
220 | /** | 249 | /** |
@@ -286,7 +315,7 @@ class Request extends Message implements ServerRequestInterface | @@ -286,7 +315,7 @@ class Request extends Message implements ServerRequestInterface | ||
286 | * changed request method. | 315 | * changed request method. |
287 | * | 316 | * |
288 | * @param string $method Case-sensitive method. | 317 | * @param string $method Case-sensitive method. |
289 | - * @return self | 318 | + * @return static |
290 | * @throws \InvalidArgumentException for invalid HTTP methods. | 319 | * @throws \InvalidArgumentException for invalid HTTP methods. |
291 | */ | 320 | */ |
292 | public function withMethod($method) | 321 | public function withMethod($method) |
@@ -321,10 +350,7 @@ class Request extends Message implements ServerRequestInterface | @@ -321,10 +350,7 @@ class Request extends Message implements ServerRequestInterface | ||
321 | 350 | ||
322 | $method = strtoupper($method); | 351 | $method = strtoupper($method); |
323 | if (!isset($this->validMethods[$method])) { | 352 | if (!isset($this->validMethods[$method])) { |
324 | - throw new InvalidArgumentException(sprintf( | ||
325 | - 'Unsupported HTTP method "%s" provided', | ||
326 | - $method | ||
327 | - )); | 353 | + throw new InvalidMethodException($this, $method); |
328 | } | 354 | } |
329 | 355 | ||
330 | return $method; | 356 | return $method; |
@@ -497,7 +523,7 @@ class Request extends Message implements ServerRequestInterface | @@ -497,7 +523,7 @@ class Request extends Message implements ServerRequestInterface | ||
497 | * @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various | 523 | * @link http://tools.ietf.org/html/rfc7230#section-2.7 (for the various |
498 | * request-target forms allowed in request messages) | 524 | * request-target forms allowed in request messages) |
499 | * @param mixed $requestTarget | 525 | * @param mixed $requestTarget |
500 | - * @return self | 526 | + * @return static |
501 | * @throws InvalidArgumentException if the request target is invalid | 527 | * @throws InvalidArgumentException if the request target is invalid |
502 | */ | 528 | */ |
503 | public function withRequestTarget($requestTarget) | 529 | public function withRequestTarget($requestTarget) |
@@ -555,7 +581,7 @@ class Request extends Message implements ServerRequestInterface | @@ -555,7 +581,7 @@ class Request extends Message implements ServerRequestInterface | ||
555 | * @link http://tools.ietf.org/html/rfc3986#section-4.3 | 581 | * @link http://tools.ietf.org/html/rfc3986#section-4.3 |
556 | * @param UriInterface $uri New request URI to use. | 582 | * @param UriInterface $uri New request URI to use. |
557 | * @param bool $preserveHost Preserve the original state of the Host header. | 583 | * @param bool $preserveHost Preserve the original state of the Host header. |
558 | - * @return self | 584 | + * @return static |
559 | */ | 585 | */ |
560 | public function withUri(UriInterface $uri, $preserveHost = false) | 586 | public function withUri(UriInterface $uri, $preserveHost = false) |
561 | { | 587 | { |
@@ -567,7 +593,7 @@ class Request extends Message implements ServerRequestInterface | @@ -567,7 +593,7 @@ class Request extends Message implements ServerRequestInterface | ||
567 | $clone->headers->set('Host', $uri->getHost()); | 593 | $clone->headers->set('Host', $uri->getHost()); |
568 | } | 594 | } |
569 | } else { | 595 | } else { |
570 | - if ($this->uri->getHost() !== '' && (!$this->hasHeader('Host') || $this->getHeader('Host') === null)) { | 596 | + if ($uri->getHost() !== '' && (!$this->hasHeader('Host') || $this->getHeaderLine('Host') === '')) { |
571 | $clone->headers->set('Host', $uri->getHost()); | 597 | $clone->headers->set('Host', $uri->getHost()); |
572 | } | 598 | } |
573 | } | 599 | } |
@@ -717,7 +743,7 @@ class Request extends Message implements ServerRequestInterface | @@ -717,7 +743,7 @@ class Request extends Message implements ServerRequestInterface | ||
717 | * updated cookie values. | 743 | * updated cookie values. |
718 | * | 744 | * |
719 | * @param array $cookies Array of key/value pairs representing cookies. | 745 | * @param array $cookies Array of key/value pairs representing cookies. |
720 | - * @return self | 746 | + * @return static |
721 | */ | 747 | */ |
722 | public function withCookieParams(array $cookies) | 748 | public function withCookieParams(array $cookies) |
723 | { | 749 | { |
@@ -778,7 +804,7 @@ class Request extends Message implements ServerRequestInterface | @@ -778,7 +804,7 @@ class Request extends Message implements ServerRequestInterface | ||
778 | * | 804 | * |
779 | * @param array $query Array of query string arguments, typically from | 805 | * @param array $query Array of query string arguments, typically from |
780 | * $_GET. | 806 | * $_GET. |
781 | - * @return self | 807 | + * @return static |
782 | */ | 808 | */ |
783 | public function withQueryParams(array $query) | 809 | public function withQueryParams(array $query) |
784 | { | 810 | { |
@@ -817,7 +843,7 @@ class Request extends Message implements ServerRequestInterface | @@ -817,7 +843,7 @@ class Request extends Message implements ServerRequestInterface | ||
817 | * updated body parameters. | 843 | * updated body parameters. |
818 | * | 844 | * |
819 | * @param array $uploadedFiles An array tree of UploadedFileInterface instances. | 845 | * @param array $uploadedFiles An array tree of UploadedFileInterface instances. |
820 | - * @return self | 846 | + * @return static |
821 | * @throws \InvalidArgumentException if an invalid structure is provided. | 847 | * @throws \InvalidArgumentException if an invalid structure is provided. |
822 | */ | 848 | */ |
823 | public function withUploadedFiles(array $uploadedFiles) | 849 | public function withUploadedFiles(array $uploadedFiles) |
@@ -915,7 +941,7 @@ class Request extends Message implements ServerRequestInterface | @@ -915,7 +941,7 @@ class Request extends Message implements ServerRequestInterface | ||
915 | * @see getAttributes() | 941 | * @see getAttributes() |
916 | * @param string $name The attribute name. | 942 | * @param string $name The attribute name. |
917 | * @param mixed $value The value of the attribute. | 943 | * @param mixed $value The value of the attribute. |
918 | - * @return self | 944 | + * @return static |
919 | */ | 945 | */ |
920 | public function withAttribute($name, $value) | 946 | public function withAttribute($name, $value) |
921 | { | 947 | { |
@@ -938,7 +964,7 @@ class Request extends Message implements ServerRequestInterface | @@ -938,7 +964,7 @@ class Request extends Message implements ServerRequestInterface | ||
938 | * updated attributes. | 964 | * updated attributes. |
939 | * | 965 | * |
940 | * @param array $attributes New attributes | 966 | * @param array $attributes New attributes |
941 | - * @return self | 967 | + * @return static |
942 | */ | 968 | */ |
943 | public function withAttributes(array $attributes) | 969 | public function withAttributes(array $attributes) |
944 | { | 970 | { |
@@ -960,7 +986,7 @@ class Request extends Message implements ServerRequestInterface | @@ -960,7 +986,7 @@ class Request extends Message implements ServerRequestInterface | ||
960 | * | 986 | * |
961 | * @see getAttributes() | 987 | * @see getAttributes() |
962 | * @param string $name The attribute name. | 988 | * @param string $name The attribute name. |
963 | - * @return self | 989 | + * @return static |
964 | */ | 990 | */ |
965 | public function withoutAttribute($name) | 991 | public function withoutAttribute($name) |
966 | { | 992 | { |
@@ -1048,7 +1074,7 @@ class Request extends Message implements ServerRequestInterface | @@ -1048,7 +1074,7 @@ class Request extends Message implements ServerRequestInterface | ||
1048 | * | 1074 | * |
1049 | * @param null|array|object $data The deserialized body data. This will | 1075 | * @param null|array|object $data The deserialized body data. This will |
1050 | * typically be in an array or object. | 1076 | * typically be in an array or object. |
1051 | - * @return self | 1077 | + * @return static |
1052 | * @throws \InvalidArgumentException if an unsupported argument type is | 1078 | * @throws \InvalidArgumentException if an unsupported argument type is |
1053 | * provided. | 1079 | * provided. |
1054 | */ | 1080 | */ |
@@ -1069,7 +1095,7 @@ class Request extends Message implements ServerRequestInterface | @@ -1069,7 +1095,7 @@ class Request extends Message implements ServerRequestInterface | ||
1069 | * | 1095 | * |
1070 | * Note: This method is not part of the PSR-7 standard. | 1096 | * Note: This method is not part of the PSR-7 standard. |
1071 | * | 1097 | * |
1072 | - * @return self | 1098 | + * @return $this |
1073 | */ | 1099 | */ |
1074 | public function reparseBody() | 1100 | public function reparseBody() |
1075 | { | 1101 | { |
@@ -1171,7 +1197,7 @@ class Request extends Message implements ServerRequestInterface | @@ -1171,7 +1197,7 @@ class Request extends Message implements ServerRequestInterface | ||
1171 | } | 1197 | } |
1172 | 1198 | ||
1173 | /** | 1199 | /** |
1174 | - * Fetch assocative array of body and query string parameters. | 1200 | + * Fetch associative array of body and query string parameters. |
1175 | * | 1201 | * |
1176 | * Note: This method is not part of the PSR-7 standard. | 1202 | * Note: This method is not part of the PSR-7 standard. |
1177 | * | 1203 | * |
vendor/slim/slim/Slim/Http/RequestBody.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Response.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
@@ -118,6 +118,13 @@ class Response extends Message implements ResponseInterface | @@ -118,6 +118,13 @@ class Response extends Message implements ResponseInterface | ||
118 | ]; | 118 | ]; |
119 | 119 | ||
120 | /** | 120 | /** |
121 | + * EOL characters used for HTTP response. | ||
122 | + * | ||
123 | + * @var string | ||
124 | + */ | ||
125 | + const EOL = "\r\n"; | ||
126 | + | ||
127 | + /** | ||
121 | * Create new HTTP response. | 128 | * Create new HTTP response. |
122 | * | 129 | * |
123 | * @param int $status The response status code. | 130 | * @param int $status The response status code. |
@@ -176,7 +183,7 @@ class Response extends Message implements ResponseInterface | @@ -176,7 +183,7 @@ class Response extends Message implements ResponseInterface | ||
176 | * @param string $reasonPhrase The reason phrase to use with the | 183 | * @param string $reasonPhrase The reason phrase to use with the |
177 | * provided status code; if none is provided, implementations MAY | 184 | * provided status code; if none is provided, implementations MAY |
178 | * use the defaults as suggested in the HTTP specification. | 185 | * use the defaults as suggested in the HTTP specification. |
179 | - * @return self | 186 | + * @return static |
180 | * @throws \InvalidArgumentException For invalid status code arguments. | 187 | * @throws \InvalidArgumentException For invalid status code arguments. |
181 | */ | 188 | */ |
182 | public function withStatus($code, $reasonPhrase = '') | 189 | public function withStatus($code, $reasonPhrase = '') |
@@ -254,7 +261,7 @@ class Response extends Message implements ResponseInterface | @@ -254,7 +261,7 @@ class Response extends Message implements ResponseInterface | ||
254 | * Proxies to the underlying stream and writes the provided data to it. | 261 | * Proxies to the underlying stream and writes the provided data to it. |
255 | * | 262 | * |
256 | * @param string $data | 263 | * @param string $data |
257 | - * @return self | 264 | + * @return $this |
258 | */ | 265 | */ |
259 | public function write($data) | 266 | public function write($data) |
260 | { | 267 | { |
@@ -277,7 +284,7 @@ class Response extends Message implements ResponseInterface | @@ -277,7 +284,7 @@ class Response extends Message implements ResponseInterface | ||
277 | * | 284 | * |
278 | * @param string|UriInterface $url The redirect destination. | 285 | * @param string|UriInterface $url The redirect destination. |
279 | * @param int|null $status The redirect HTTP status code. | 286 | * @param int|null $status The redirect HTTP status code. |
280 | - * @return self | 287 | + * @return static |
281 | */ | 288 | */ |
282 | public function withRedirect($url, $status = null) | 289 | public function withRedirect($url, $status = null) |
283 | { | 290 | { |
@@ -306,7 +313,7 @@ class Response extends Message implements ResponseInterface | @@ -306,7 +313,7 @@ class Response extends Message implements ResponseInterface | ||
306 | * @param int $status The HTTP status code. | 313 | * @param int $status The HTTP status code. |
307 | * @param int $encodingOptions Json encoding options | 314 | * @param int $encodingOptions Json encoding options |
308 | * @throws \RuntimeException | 315 | * @throws \RuntimeException |
309 | - * @return self | 316 | + * @return static |
310 | */ | 317 | */ |
311 | public function withJson($data, $status = null, $encodingOptions = 0) | 318 | public function withJson($data, $status = null, $encodingOptions = 0) |
312 | { | 319 | { |
@@ -461,11 +468,11 @@ class Response extends Message implements ResponseInterface | @@ -461,11 +468,11 @@ class Response extends Message implements ResponseInterface | ||
461 | $this->getStatusCode(), | 468 | $this->getStatusCode(), |
462 | $this->getReasonPhrase() | 469 | $this->getReasonPhrase() |
463 | ); | 470 | ); |
464 | - $output .= PHP_EOL; | 471 | + $output .= Response::EOL; |
465 | foreach ($this->getHeaders() as $name => $values) { | 472 | foreach ($this->getHeaders() as $name => $values) { |
466 | - $output .= sprintf('%s: %s', $name, $this->getHeaderLine($name)) . PHP_EOL; | 473 | + $output .= sprintf('%s: %s', $name, $this->getHeaderLine($name)) . Response::EOL; |
467 | } | 474 | } |
468 | - $output .= PHP_EOL; | 475 | + $output .= Response::EOL; |
469 | $output .= (string)$this->getBody(); | 476 | $output .= (string)$this->getBody(); |
470 | 477 | ||
471 | return $output; | 478 | return $output; |
vendor/slim/slim/Slim/Http/Stream.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/UploadedFile.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Http/Uri.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Http; | 9 | namespace Slim\Http; |
vendor/slim/slim/Slim/Interfaces/CallableResolverInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
vendor/slim/slim/Slim/Interfaces/CollectionInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
vendor/slim/slim/Slim/Interfaces/Http/CookiesInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces\Http; | 9 | namespace Slim\Interfaces\Http; |
vendor/slim/slim/Slim/Interfaces/Http/EnvironmentInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces\Http; | 9 | namespace Slim\Interfaces\Http; |
vendor/slim/slim/Slim/Interfaces/Http/HeadersInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces\Http; | 9 | namespace Slim\Interfaces\Http; |
vendor/slim/slim/Slim/Interfaces/InvocationStrategyInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
vendor/slim/slim/Slim/Interfaces/RouteGroupInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
vendor/slim/slim/Slim/Interfaces/RouteInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
@@ -25,16 +25,16 @@ interface RouteInterface | @@ -25,16 +25,16 @@ interface RouteInterface | ||
25 | * Retrieve a specific route argument | 25 | * Retrieve a specific route argument |
26 | * | 26 | * |
27 | * @param string $name | 27 | * @param string $name |
28 | - * @param mixed $default | 28 | + * @param string|null $default |
29 | * | 29 | * |
30 | - * @return mixed | 30 | + * @return string|null |
31 | */ | 31 | */ |
32 | public function getArgument($name, $default = null); | 32 | public function getArgument($name, $default = null); |
33 | 33 | ||
34 | /** | 34 | /** |
35 | * Get route arguments | 35 | * Get route arguments |
36 | * | 36 | * |
37 | - * @return array | 37 | + * @return string[] |
38 | */ | 38 | */ |
39 | public function getArguments(); | 39 | public function getArguments(); |
40 | 40 | ||
@@ -58,16 +58,16 @@ interface RouteInterface | @@ -58,16 +58,16 @@ interface RouteInterface | ||
58 | * @param string $name | 58 | * @param string $name |
59 | * @param string $value | 59 | * @param string $value |
60 | * | 60 | * |
61 | - * @return static | 61 | + * @return self |
62 | */ | 62 | */ |
63 | public function setArgument($name, $value); | 63 | public function setArgument($name, $value); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Replace route arguments | 66 | * Replace route arguments |
67 | * | 67 | * |
68 | - * @param array $arguments | 68 | + * @param string[] $arguments |
69 | * | 69 | * |
70 | - * @return static | 70 | + * @return self |
71 | */ | 71 | */ |
72 | public function setArguments(array $arguments); | 72 | public function setArguments(array $arguments); |
73 | 73 |
vendor/slim/slim/Slim/Interfaces/RouterInterface.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim\Interfaces; | 9 | namespace Slim\Interfaces; |
@@ -20,6 +20,10 @@ use Psr\Http\Message\ServerRequestInterface; | @@ -20,6 +20,10 @@ use Psr\Http\Message\ServerRequestInterface; | ||
20 | */ | 20 | */ |
21 | interface RouterInterface | 21 | interface RouterInterface |
22 | { | 22 | { |
23 | + // array keys from route result | ||
24 | + const DISPATCH_STATUS = 0; | ||
25 | + const ALLOWED_METHODS = 1; | ||
26 | + | ||
23 | /** | 27 | /** |
24 | * Add route | 28 | * Add route |
25 | * | 29 | * |
vendor/slim/slim/Slim/MiddlewareAwareTrait.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
@@ -63,8 +63,14 @@ trait MiddlewareAwareTrait | @@ -63,8 +63,14 @@ trait MiddlewareAwareTrait | ||
63 | $this->seedMiddlewareStack(); | 63 | $this->seedMiddlewareStack(); |
64 | } | 64 | } |
65 | $next = $this->stack->top(); | 65 | $next = $this->stack->top(); |
66 | - $this->stack[] = function (ServerRequestInterface $req, ResponseInterface $res) use ($callable, $next) { | ||
67 | - $result = call_user_func($callable, $req, $res, $next); | 66 | + $this->stack[] = function ( |
67 | + ServerRequestInterface $request, | ||
68 | + ResponseInterface $response | ||
69 | + ) use ( | ||
70 | + $callable, | ||
71 | + $next | ||
72 | + ) { | ||
73 | + $result = call_user_func($callable, $request, $response, $next); | ||
68 | if ($result instanceof ResponseInterface === false) { | 74 | if ($result instanceof ResponseInterface === false) { |
69 | throw new UnexpectedValueException( | 75 | throw new UnexpectedValueException( |
70 | 'Middleware must return instance of \Psr\Http\Message\ResponseInterface' | 76 | 'Middleware must return instance of \Psr\Http\Message\ResponseInterface' |
@@ -100,12 +106,12 @@ trait MiddlewareAwareTrait | @@ -100,12 +106,12 @@ trait MiddlewareAwareTrait | ||
100 | /** | 106 | /** |
101 | * Call middleware stack | 107 | * Call middleware stack |
102 | * | 108 | * |
103 | - * @param ServerRequestInterface $req A request object | ||
104 | - * @param ResponseInterface $res A response object | 109 | + * @param ServerRequestInterface $request A request object |
110 | + * @param ResponseInterface $response A response object | ||
105 | * | 111 | * |
106 | * @return ResponseInterface | 112 | * @return ResponseInterface |
107 | */ | 113 | */ |
108 | - public function callMiddlewareStack(ServerRequestInterface $req, ResponseInterface $res) | 114 | + public function callMiddlewareStack(ServerRequestInterface $request, ResponseInterface $response) |
109 | { | 115 | { |
110 | if (is_null($this->stack)) { | 116 | if (is_null($this->stack)) { |
111 | $this->seedMiddlewareStack(); | 117 | $this->seedMiddlewareStack(); |
@@ -113,8 +119,8 @@ trait MiddlewareAwareTrait | @@ -113,8 +119,8 @@ trait MiddlewareAwareTrait | ||
113 | /** @var callable $start */ | 119 | /** @var callable $start */ |
114 | $start = $this->stack->top(); | 120 | $start = $this->stack->top(); |
115 | $this->middlewareLock = true; | 121 | $this->middlewareLock = true; |
116 | - $resp = $start($req, $res); | 122 | + $response = $start($request, $response); |
117 | $this->middlewareLock = false; | 123 | $this->middlewareLock = false; |
118 | - return $resp; | 124 | + return $response; |
119 | } | 125 | } |
120 | } | 126 | } |
vendor/slim/slim/Slim/Routable.php
@@ -3,12 +3,12 @@ | @@ -3,12 +3,12 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
10 | 10 | ||
11 | -use Interop\Container\ContainerInterface; | 11 | +use Psr\Container\ContainerInterface; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * A routable, middleware-aware object | 14 | * A routable, middleware-aware object |
@@ -97,7 +97,7 @@ abstract class Routable | @@ -97,7 +97,7 @@ abstract class Routable | ||
97 | /** | 97 | /** |
98 | * Set the route pattern | 98 | * Set the route pattern |
99 | * | 99 | * |
100 | - * @set string | 100 | + * @param string $newPattern |
101 | */ | 101 | */ |
102 | public function setPattern($newPattern) | 102 | public function setPattern($newPattern) |
103 | { | 103 | { |
vendor/slim/slim/Slim/Route.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
@@ -265,7 +265,7 @@ class Route extends Routable implements RouteInterface | @@ -265,7 +265,7 @@ class Route extends Routable implements RouteInterface | ||
265 | * Retrieve a specific route argument | 265 | * Retrieve a specific route argument |
266 | * | 266 | * |
267 | * @param string $name | 267 | * @param string $name |
268 | - * @param mixed $default | 268 | + * @param string|null $default |
269 | * | 269 | * |
270 | * @return mixed | 270 | * @return mixed |
271 | */ | 271 | */ |
vendor/slim/slim/Slim/RouteGroup.php
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
vendor/slim/slim/Slim/Router.php
@@ -3,13 +3,13 @@ | @@ -3,13 +3,13 @@ | ||
3 | * Slim Framework (https://slimframework.com) | 3 | * Slim Framework (https://slimframework.com) |
4 | * | 4 | * |
5 | * @link https://github.com/slimphp/Slim | 5 | * @link https://github.com/slimphp/Slim |
6 | - * @copyright Copyright (c) 2011-2016 Josh Lockhart | 6 | + * @copyright Copyright (c) 2011-2017 Josh Lockhart |
7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) | 7 | * @license https://github.com/slimphp/Slim/blob/3.x/LICENSE.md (MIT License) |
8 | */ | 8 | */ |
9 | namespace Slim; | 9 | namespace Slim; |
10 | 10 | ||
11 | use FastRoute\Dispatcher; | 11 | use FastRoute\Dispatcher; |
12 | -use Interop\Container\ContainerInterface; | 12 | +use Psr\Container\ContainerInterface; |
13 | use InvalidArgumentException; | 13 | use InvalidArgumentException; |
14 | use RuntimeException; | 14 | use RuntimeException; |
15 | use Psr\Http\Message\ServerRequestInterface; | 15 | use Psr\Http\Message\ServerRequestInterface; |
@@ -199,7 +199,7 @@ class Router implements RouterInterface | @@ -199,7 +199,7 @@ class Router implements RouterInterface | ||
199 | * | 199 | * |
200 | * @param string[] $methods Array of HTTP methods | 200 | * @param string[] $methods Array of HTTP methods |
201 | * @param string $pattern The route pattern | 201 | * @param string $pattern The route pattern |
202 | - * @param callable $handler The route callable | 202 | + * @param callable $callable The route callable |
203 | * | 203 | * |
204 | * @return \Slim\Interfaces\RouteInterface | 204 | * @return \Slim\Interfaces\RouteInterface |
205 | */ | 205 | */ |
vendor/slim/slim/composer.json
@@ -32,7 +32,8 @@ | @@ -32,7 +32,8 @@ | ||
32 | "pimple/pimple": "^3.0", | 32 | "pimple/pimple": "^3.0", |
33 | "psr/http-message": "^1.0", | 33 | "psr/http-message": "^1.0", |
34 | "nikic/fast-route": "^1.0", | 34 | "nikic/fast-route": "^1.0", |
35 | - "container-interop/container-interop": "^1.1" | 35 | + "container-interop/container-interop": "^1.2", |
36 | + "psr/container": "^1.0" | ||
36 | }, | 37 | }, |
37 | "require-dev": { | 38 | "require-dev": { |
38 | "squizlabs/php_codesniffer": "^2.5", | 39 | "squizlabs/php_codesniffer": "^2.5", |