Commit dc193ab7 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Test par les closures plutôt que is_callable, qui remonte des faux positifs

parent 51d02baf
Loading
Loading
Loading
Loading
+3 −3
Changes for admin/src/BddAdmin/Table.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -161,7 +161,7 @@ class Table
                $val = round($current * 100 / $count, 2);
                $this->getBdd()->logMsg("Copie de la table " . $this->getName() . " en cours (" . $val . "%)", true);
            }
            if (is_callable($fnc)) $data = $fnc($data);
            if ($fnc instanceof \Closure) $data = $fnc($data);
            if (null !== $data) {
                $this->insert($data);
            }
@@ -207,7 +207,7 @@ class Table
                $val = round($current * 100 / $count, 2);
                $this->getBdd()->logMsg("Sauvegarde de la table " . $this->getName() . " en cours (" . $val . "%)", true);
            }
            if (is_callable($fnc)) $data = $fnc($data);
            if ($fnc instanceof \Closure) $data = $fnc($data);
            if (null !== $data) {
                fwrite($buff, serialize($data) . "{<{//#end}>}\n");
            }
@@ -243,7 +243,7 @@ class Table
            $data .= $d;
            if (substr($d, -13) == "{<{//#end}>}\n") {
                $line = unserialize(substr($data, 0, -12));
                if (is_callable($fnc)) $line = $fnc($line);
                if ($fnc instanceof \Closure) $line = $fnc($line);
                $current++;
                $val = round($current * 100 / $count, 2);
                $this->getBdd()->logMsg("Restauration de la table " . $this->getName() . " en cours (" . $val . "%)", true);
+1 −1
Changes for module/Application/src/HostLocalization/HostLocalizationOse.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ class HostLocalizationOse implements HostLocalizationInterface
        if ($inEtablissement instanceof HostLocalizationInterface) {
            $inEtablissement = $inEtablissement->inEtablissement();
        }
        if (is_callable($inEtablissement)) {
        if ($inEtablissement instanceof \Closure) {
            $inEtablissement = $inEtablissement();
        }

+2 −2
Changes for module/Application/src/Hydrator/GenericHydrator.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ class GenericHydrator implements HydratorInterface
                $value = null;
                if (is_string($getter) && method_exists($object, $getter)) {
                    $value = $object->$getter();
                } elseif (is_callable($getter)) {
                } elseif ($getter instanceof \Closure) {
                    $value = $getter($object, $name);
                } elseif (method_exists($object, $gget = 'get' . ucFirst($name))) {
                    $value = $object->$gget();
@@ -125,7 +125,7 @@ class GenericHydrator implements HydratorInterface
                }

                /* Injection de la valeur dans l'objet */
                if (is_callable($setter)) {
                if ($setter instanceof \Closure) {
                    $setter($object, $value, $name);
                } elseif (is_string($setter) && method_exists($object, $setter)) {
                    $object->$setter($value);
+4 −2
Changes for module/Application/src/Provider/Privilege/Privileges.php: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -9,8 +9,7 @@ namespace Application\Provider\Privilege;
 *
 * @author UnicaenCode
 */
class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
{
class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges {

    const AGREMENT_CONSEIL_ACADEMIQUE_EDITION          = 'agrement-conseil-academique-edition';
    const AGREMENT_CONSEIL_ACADEMIQUE_SUPPRESSION      = 'agrement-conseil-academique-suppression';
@@ -140,6 +139,9 @@ class Privileges extends \UnicaenAuth\Provider\Privilege\Privileges
    const INTERVENANT_EXPORTER                                = 'intervenant-exporter';
    const INTERVENANT_FICHE                                   = 'intervenant-fiche';
    const INTERVENANT_LIEN_SYSTEME_INFORMATION                = 'intervenant-lien-systeme-information';
    const INTERVENANT_NOTE_EDITION                            = 'intervenant-note-edition';
    const INTERVENANT_NOTE_SUPPRESSION                        = 'intervenant-note-suppression';
    const INTERVENANT_NOTE_VISUALISATION                      = 'intervenant-note-visualisation';
    const INTERVENANT_RECHERCHE                               = 'intervenant-recherche';
    const INTERVENANT_STATUT_EDITION                          = 'intervenant-statut-edition';
    const INTERVENANT_STATUT_VISUALISATION                    = 'intervenant-statut-visualisation';
+3 −3
Changes for module/Application/src/Service/WorkflowService.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -298,14 +298,14 @@ class WorkflowService extends AbstractService
            $begin = microtime(true);
            $tbl   = $tbl['TBL_NAME'];
            $sql   = 'BEGIN UNICAEN_TBL.CALCULER(\'' . $tbl . '\'); END;';
            if (is_callable($beforeTrigger)) {
            if ($beforeTrigger instanceof \Closure) {
                $beforeTrigger([
                    'tableau-bord' => $tbl,
                ]);
            }
            try {
                $this->getEntityManager()->getConnection()->executeStatement($sql);
                if (is_callable($afterTrigger)) {
                if ($afterTrigger instanceof \Closure) {
                    $afterTrigger([
                        'tableau-bord' => $tbl,
                        'result'       => true,
@@ -313,7 +313,7 @@ class WorkflowService extends AbstractService
                    ]);
                }
            } catch (\Exception $e) {
                if (is_callable($afterTrigger)) {
                if ($afterTrigger instanceof \Closure) {
                    $afterTrigger([
                        'tableau-bord' => $tbl,
                        'result'       => false,