18 Pa.C.S.A. §312.  De minimis infractions.

(a)  General rule.–The court shall dismiss a prosecution if, having regard to the nature of the conduct charged to constitute an offense and the nature of the attendant circumstances, it finds that the conduct of the defendant:

(1)  was within a customary license or tolerance, neither expressly negatived by the person whose interest was infringed nor inconsistent with the purpose of the law defining the offense;

(2)  did not actually cause or threaten the harm or evil sought to be prevented by the law defining the offense or did so only to an extent too trivial to warrant the condemnation of conviction; or

(3)  presents such other extenuations that it cannot reasonably be regarded as envisaged by the General Assembly or other authority in forbidding the offense.

(b)  Written statement.–The court shall not dismiss a prosecution under this section without filing a written statement of its reasons, except that if the attorney for the Commonwealth is the moving party for such dismissal no such written statement need be filed.