Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php namespace PowerComponents\LivewirePowerGrid\Actions; class SanitizeComponentName {..

Decoded Output download

<?php

namespace PowerComponents\LivewirePowerGrid\Actions;

class SanitizeComponentName
{
    public static function handle(string $componentName): string
    {
        return str($componentName)
            ->rtrim('.php')
            // Remove possible prefix
            ->ltrim('//')
            //Remove anything but alphanumeric, dot and slashes
            ->replaceMatches('#[^A-Za-z0-9 .//\\]#', '')
            //Convert multiple spaces into forward slashes
            ->replaceMatches('/\s+/', '//')
            //multiple back slashes into forward slashes
            ->replaceMatches('/\\{2,}/', "\")
            //Multiple forward slashes
            ->replaceMatches('/\/{2,}/', "\")
            //Multile dots
            ->replaceMatches('/\.{2,}/', ".")
            ->replace('.', '\')
            //Left over backslahes into forward slashes
            ->replace('/', '\')
            ->rtrim('\')
            ->toString();
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace PowerComponents\LivewirePowerGrid\Actions;

class SanitizeComponentName
{
    public static function handle(string $componentName): string
    {
        return str($componentName)
            ->rtrim('.php')
            // Remove possible prefix
            ->ltrim('//')
            //Remove anything but alphanumeric, dot and slashes
            ->replaceMatches('#[^A-Za-z0-9 .//\\\\]#', '')
            //Convert multiple spaces into forward slashes
            ->replaceMatches('/\s+/', '//')
            //multiple back slashes into forward slashes
            ->replaceMatches('/\\\{2,}/', "\\")
            //Multiple forward slashes
            ->replaceMatches('/\/{2,}/', "\\")
            //Multile dots
            ->replaceMatches('/\.{2,}/', ".")
            ->replace('.', '\\')
            //Left over backslahes into forward slashes
            ->replace('/', '\\')
            ->rtrim('\\')
            ->toString();
    }
}

Function Calls

None

Variables

None

Stats

MD5 081c584a12b4948033e44844843f6265
Eval Count 0
Decode Time 96 ms