Current File : //var/www/prestashop/modules/ps_metrics/vendor/squizlabs/php_codesniffer/src/Util/Common.php
<?php

/**
 * Basic util functions.
 *
 * @author    Greg Sherwood <gsherwood@squiz.net>
 * @copyright 2006-2015 Squiz Pty Ltd (ABN 77 084 670 600)
 * @license   https://github.com/PHPCSStandards/PHP_CodeSniffer/blob/master/licence.txt BSD Licence
 */
namespace ps_metrics_module_v4_0_6\PHP_CodeSniffer\Util;

use Phar;
class Common
{
    /**
     * An array of variable types for param/var we will check.
     *
     * @var string[]
     */
    public static $allowedTypes = ['array', 'boolean', 'float', 'integer', 'mixed', 'object', 'string', 'resource', 'callable'];
    /**
     * Return TRUE if the path is a PHAR file.
     *
     * @param string $path The path to use.
     *
     * @return bool
     */
    public static function isPharFile($path)
    {
        if (\strpos($path, 'phar://') === 0) {
            return \true;
        }
        return \false;
    }
    //end isPharFile()
    /**
     * Checks if a file is readable.
     *
     * Addresses PHP bug related to reading files from network drives on Windows.
     * e.g. when using WSL2.
     *
     * @param string $path The path to the file.
     *
     * @return boolean
     */
    public static function isReadable($path)
    {
        if (@\is_readable($path) === \true) {
            return \true;
        }
        if (@\file_exists($path) === \true && @\is_file($path) === \true) {
            $f = @\fopen($path, 'rb');
            if (\fclose($f) === \true) {
                return \true;
            }
        }
        return \false;
    }
    //end isReadable()
    /**
     * CodeSniffer alternative for realpath.
     *
     * Allows for PHAR support.
     *
     * @param string $path The path to use.
     *
     * @return string|false
     */
    public static function realpath($path)
    {
        // Support the path replacement of ~ with the user's home directory.
        if (\substr($path, 0, 2) === '~/') {
            $homeDir = \getenv('HOME');
            if ($homeDir !== \false) {
                $path = $homeDir . \substr($path, 1);
            }
        }
        // Check for process substitution.
        if (\strpos($path, '/dev/fd') === 0) {
            return \str_replace('/dev/fd', 'php://fd', $path);
        }
        // No extra work needed if this is not a phar file.
        if (self::isPharFile($path) === \false) {
            return \realpath($path);
        }
        // Before trying to break down the file path,
        // check if it exists first because it will mostly not
        // change after running the below code.
        if (\file_exists($path) === \true) {
            return $path;
        }
        $phar = Phar::running(\false);
        $extra = \str_replace('phar://' . $phar, '', $path);
        $path = \realpath($phar);
        if ($path === \false) {
            return \false;
        }
        $path = 'phar://' . $path . $extra;
        if (\file_exists($path) === \true) {
            return $path;
        }
        return \false;
    }
    //end realpath()
    /**
     * Removes a base path from the front of a file path.
     *
     * @param string $path     The path of the file.
     * @param string $basepath The base path to remove. This should not end
     *                         with a directory separator.
     *
     * @return string
     */
    public static function stripBasepath($path, $basepath)
    {
        if (empty($basepath) === \true) {
            return $path;
        }
        $basepathLen = \strlen($basepath);
        if (\substr($path, 0, $basepathLen) === $basepath) {
            $path = \substr($path, $basepathLen);
        }
        $path = \ltrim($path, \DIRECTORY_SEPARATOR);
        if ($path === '') {
            $path = '.';
        }
        return $path;
    }
    //end stripBasepath()
    /**
     * Detects the EOL character being used in a string.
     *
     * @param string $contents The contents to check.
     *
     * @return string
     */
    public static function detectLineEndings($contents)
    {
        if (\preg_match("/\r\n?|\n/", $contents, $matches) !== 1) {
            // Assume there are no newlines.
            $eolChar = "\n";
        } else {
            $eolChar = $matches[0];
        }
        return $eolChar;
    }
    //end detectLineEndings()
    /**
     * Check if STDIN is a TTY.
     *
     * @return boolean
     */
    public static function isStdinATTY()
    {
        // The check is slow (especially calling `tty`) so we static
        // cache the result.
        static $isTTY = null;
        if ($isTTY !== null) {
            return $isTTY;
        }
        if (\defined('STDIN') === \false) {
            return \false;
        }
        // If PHP has the POSIX extensions we will use them.
        if (\function_exists('posix_isatty') === \true) {
            $isTTY = \posix_isatty(\STDIN) === \true;
            return $isTTY;
        }
        // Next try is detecting whether we have `tty` installed and use that.
        if (\defined('PHP_WINDOWS_VERSION_PLATFORM') === \true) {
            $devnull = 'NUL';
            $which = 'where';
        } else {
            $devnull = '/dev/null';
            $which = 'which';
        }
        $tty = \trim(\shell_exec("{$which} tty 2> {$devnull}"));
        if (empty($tty) === \false) {
            \exec("tty -s 2> {$devnull}", $output, $returnValue);
            $isTTY = $returnValue === 0;
            return $isTTY;
        }
        // Finally we will use fstat.  The solution borrowed from
        // https://stackoverflow.com/questions/11327367/detect-if-a-php-script-is-being-run-interactively-or-not
        // This doesn't work on Mingw/Cygwin/... using Mintty but they
        // have `tty` installed.
        $type = ['S_IFMT' => 0170000, 'S_IFIFO' => 010000];
        $stat = \fstat(\STDIN);
        $mode = $stat['mode'] & $type['S_IFMT'];
        $isTTY = $mode !== $type['S_IFIFO'];
        return $isTTY;
    }
    //end isStdinATTY()
    /**
     * Escape a path to a system command.
     *
     * @param string $cmd The path to the system command.
     *
     * @return string
     */
    public static function escapeshellcmd($cmd)
    {
        $cmd = \escapeshellcmd($cmd);
        if (\stripos(\PHP_OS, 'WIN') === 0) {
            // Spaces are not escaped by escapeshellcmd on Windows, but need to be
            // for the command to be able to execute.
            $cmd = \preg_replace('`(?<!^) `', '^ ', $cmd);
        }
        return $cmd;
    }
    //end escapeshellcmd()
    /**
     * Prepares token content for output to screen.
     *
     * Replaces invisible characters so they are visible. On non-Windows
     * operating systems it will also colour the invisible characters.
     *
     * @param string   $content The content to prepare.
     * @param string[] $exclude A list of characters to leave invisible.
     *                          Can contain \r, \n, \t and a space.
     *
     * @return string
     */
    public static function prepareForOutput($content, $exclude = [])
    {
        if (\stripos(\PHP_OS, 'WIN') === 0) {
            if (\in_array("\r", $exclude, \true) === \false) {
                $content = \str_replace("\r", '\\r', $content);
            }
            if (\in_array("\n", $exclude, \true) === \false) {
                $content = \str_replace("\n", '\\n', $content);
            }
            if (\in_array("\t", $exclude, \true) === \false) {
                $content = \str_replace("\t", '\\t', $content);
            }
        } else {
            if (\in_array("\r", $exclude, \true) === \false) {
                $content = \str_replace("\r", "\x1b[30;1m\\r\x1b[0m", $content);
            }
            if (\in_array("\n", $exclude, \true) === \false) {
                $content = \str_replace("\n", "\x1b[30;1m\\n\x1b[0m", $content);
            }
            if (\in_array("\t", $exclude, \true) === \false) {
                $content = \str_replace("\t", "\x1b[30;1m\\t\x1b[0m", $content);
            }
            if (\in_array(' ', $exclude, \true) === \false) {
                $content = \str_replace(' ', "\x1b[30;1m·\x1b[0m", $content);
            }
        }
        //end if
        return $content;
    }
    //end prepareForOutput()
    /**
     * Returns true if the specified string is in the camel caps format.
     *
     * @param string  $string      The string the verify.
     * @param boolean $classFormat If true, check to see if the string is in the
     *                             class format. Class format strings must start
     *                             with a capital letter and contain no
     *                             underscores.
     * @param boolean $public      If true, the first character in the string
     *                             must be an a-z character. If false, the
     *                             character must be an underscore. This
     *                             argument is only applicable if $classFormat
     *                             is false.
     * @param boolean $strict      If true, the string must not have two capital
     *                             letters next to each other. If false, a
     *                             relaxed camel caps policy is used to allow
     *                             for acronyms.
     *
     * @return boolean
     */
    public static function isCamelCaps($string, $classFormat = \false, $public = \true, $strict = \true)
    {
        // Check the first character first.
        if ($classFormat === \false) {
            $legalFirstChar = '';
            if ($public === \false) {
                $legalFirstChar = '[_]';
            }
            if ($strict === \false) {
                // Can either start with a lowercase letter, or multiple uppercase
                // in a row, representing an acronym.
                $legalFirstChar .= '([A-Z]{2,}|[a-z])';
            } else {
                $legalFirstChar .= '[a-z]';
            }
        } else {
            $legalFirstChar = '[A-Z]';
        }
        if (\preg_match("/^{$legalFirstChar}/", $string) === 0) {
            return \false;
        }
        // Check that the name only contains legal characters.
        $legalChars = 'a-zA-Z0-9';
        if (\preg_match("|[^{$legalChars}]|", \substr($string, 1)) > 0) {
            return \false;
        }
        if ($strict === \true) {
            // Check that there are not two capital letters next to each other.
            $length = \strlen($string);
            $lastCharWasCaps = $classFormat;
            for ($i = 1; $i < $length; $i++) {
                $ascii = \ord($string[$i]);
                if ($ascii >= 48 && $ascii <= 57) {
                    // The character is a number, so it can't be a capital.
                    $isCaps = \false;
                } else {
                    if (\strtoupper($string[$i]) === $string[$i]) {
                        $isCaps = \true;
                    } else {
                        $isCaps = \false;
                    }
                }
                if ($isCaps === \true && $lastCharWasCaps === \true) {
                    return \false;
                }
                $lastCharWasCaps = $isCaps;
            }
        }
        //end if
        return \true;
    }
    //end isCamelCaps()
    /**
     * Returns true if the specified string is in the underscore caps format.
     *
     * @param string $string The string to verify.
     *
     * @return boolean
     */
    public static function isUnderscoreName($string)
    {
        // If there are space in the name, it can't be valid.
        if (\strpos($string, ' ') !== \false) {
            return \false;
        }
        $validName = \true;
        $nameBits = \explode('_', $string);
        if (\preg_match('|^[A-Z]|', $string) === 0) {
            // Name does not begin with a capital letter.
            $validName = \false;
        } else {
            foreach ($nameBits as $bit) {
                if ($bit === '') {
                    continue;
                }
                if ($bit[0] !== \strtoupper($bit[0])) {
                    $validName = \false;
                    break;
                }
            }
        }
        return $validName;
    }
    //end isUnderscoreName()
    /**
     * Returns a valid variable type for param/var tags.
     *
     * If type is not one of the standard types, it must be a custom type.
     * Returns the correct type name suggestion if type name is invalid.
     *
     * @param string $varType The variable type to process.
     *
     * @return string
     */
    public static function suggestType($varType)
    {
        if ($varType === '') {
            return '';
        }
        if (\in_array($varType, self::$allowedTypes, \true) === \true) {
            return $varType;
        } else {
            $lowerVarType = \strtolower($varType);
            switch ($lowerVarType) {
                case 'bool':
                case 'boolean':
                    return 'boolean';
                case 'double':
                case 'real':
                case 'float':
                    return 'float';
                case 'int':
                case 'integer':
                    return 'integer';
                case 'array()':
                case 'array':
                    return 'array';
            }
            //end switch
            if (\strpos($lowerVarType, 'array(') !== \false) {
                // Valid array declaration:
                // array, array(type), array(type1 => type2).
                $matches = [];
                $pattern = '/^array\\(\\s*([^\\s^=^>]*)(\\s*=>\\s*(.*))?\\s*\\)/i';
                if (\preg_match($pattern, $varType, $matches) !== 0) {
                    $type1 = '';
                    if (isset($matches[1]) === \true) {
                        $type1 = $matches[1];
                    }
                    $type2 = '';
                    if (isset($matches[3]) === \true) {
                        $type2 = $matches[3];
                    }
                    $type1 = self::suggestType($type1);
                    $type2 = self::suggestType($type2);
                    if ($type2 !== '') {
                        $type2 = ' => ' . $type2;
                    }
                    return "array({$type1}{$type2})";
                } else {
                    return 'array';
                }
                //end if
            } else {
                if (\in_array($lowerVarType, self::$allowedTypes, \true) === \true) {
                    // A valid type, but not lower cased.
                    return $lowerVarType;
                } else {
                    // Must be a custom type name.
                    return $varType;
                }
            }
            //end if
        }
        //end if
    }
    //end suggestType()
    /**
     * Given a sniff class name, returns the code for the sniff.
     *
     * @param string $sniffClass The fully qualified sniff class name.
     *
     * @return string
     */
    public static function getSniffCode($sniffClass)
    {
        $parts = \explode('\\', $sniffClass);
        $sniff = \array_pop($parts);
        if (\substr($sniff, -5) === 'Sniff') {
            // Sniff class name.
            $sniff = \substr($sniff, 0, -5);
        } else {
            // Unit test class name.
            $sniff = \substr($sniff, 0, -8);
        }
        $category = \array_pop($parts);
        $sniffDir = \array_pop($parts);
        $standard = \array_pop($parts);
        $code = $standard . '.' . $category . '.' . $sniff;
        return $code;
    }
    //end getSniffCode()
    /**
     * Removes project-specific information from a sniff class name.
     *
     * @param string $sniffClass The fully qualified sniff class name.
     *
     * @return string
     */
    public static function cleanSniffClass($sniffClass)
    {
        $newName = \strtolower($sniffClass);
        $sniffPos = \strrpos($newName, '\\sniffs\\');
        if ($sniffPos === \false) {
            // Nothing we can do as it isn't in a known format.
            return $newName;
        }
        $end = \strlen($newName) - $sniffPos + 1;
        $start = \strrpos($newName, '\\', $end * -1);
        if ($start === \false) {
            // Nothing needs to be cleaned.
            return $newName;
        }
        $newName = \substr($newName, $start + 1);
        return $newName;
    }
    //end cleanSniffClass()
}
//end class
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!